[RPM Packaging] How to define the bench dir?

Hi

Today python-nun2words has passed the fedora.review and the is only once depency to go to get all depencies for frappe and erpnext in place.

https://copr.fedoraproject.org/coprs/williamjmorenor/ERPNext/

Spec files are here:

python-frappe:
https://github.com/williamjmorenor/fedora-specs/blob/master/python-frappe.spec

python-frappe-bench:
https://github.com/williamjmorenor/fedora-specs/blob/master/python-frappe-bench.spec

erpnext:
https://github.com/williamjmorenor/fedora-specs/blob/master/erpnext.spec

And everything is compiling fine:
https://copr.fedoraproject.org/coprs/williamjmorenor/ERPNext/monitor/

  • I can not use virtual-env in rpm packaging
  • I can not package only bench and install erpnext using the packaged bench

But I have a issue, I need to tell to the bench than frappe and frappe apps will not be under /home/frappe/frappe-bench it will be under /usr/share/frappe/

I am creating:

/usr/share/frappe
/usr/share/frappe/apps
/usr/share/frappe/config
/usr/share/frappe/logs
/usr/share/frappe/sites

Also I am creating a frappe system user with /user/share/frappe ass home to avoid run frappe service as root (this will be handled with systemd)

But I need to tell the bench where to find the frappe dir, so I need to ask:

The frappe dir is hardcoded into the bench code? It is defined in runtime? or it is a variable than can be configured at install?

Please if you can help me with this I will can continue working to get ERPNext packaged in RPM, after the Fedora packaging I will try to get all dependencies ready in CentOS 7 via the epel-repo.

Regards

The frappe dir is hardcoded into the bench code? It is defined in runtime? or it is a variable than can be configured at install?

You can store the path to the bench dir in /etc/frappe_bench_dir
Also, if you’re packaging bench, set update_bench_on_bench as false in config.json

Why don’t you package only bench and post install of bench package, initiate one in /var/frappe-bench?

Hi @pdvyas so I can put a plain text file under /etc/frappe_bench_dir with the path to frappe dir?

This is the second time than I ask about packaging frappe, frappe-bench and erpnext, first time was for v4 but how the v5 were coming fast I take the desicion to split the packaging after the v5 became stable.

I can package olny the bench for a informal package, but if I want to make the package official in Fedora repos and then work to get all depencies in CentOS 7and manybe CentOS 6 (note than the epel work for RedHat and Cientific Linux to, I am not sure is there will be a user of ERPNext than will run the service in RedHat), this same spec can help other people to make a rpm for other Operative System based in rpm like OpenSuse and Mageia, even it can help to make a .deb package

Fedora Packaging Guidelines do not allow to python apps to download from pypi, all packages must downloaded as rpm packages from the repo, also I can put content than will be served under /home and /usr/share is the best place to put frappe as because python code can be considered multi arch.

Regards

https://fedoraproject.org/wiki/Changes/frappe-framework

http://www.linuxadictos.com/fedora-23-incluira-el-framework-frappe-y-permitira-las-actualizaciones-de-uefi.html

Sorry for the late reply.

Yes

I am of the opinion that you should package only bench as we release very often and updates are important. Also, the bench assumes the presence of a virtualenv.

You can place the bench in /var/frappe-bench

frappe and bench are now in Fedora Repos and it is testing time

https://admin.fedoraproject.org/pkgdb/package/python-frappe/
https://admin.fedoraproject.org/pkgdb/package/python-frappe-bench/

I am getting this error

IOError: [Errno 13] Permission denied: ‘/var/frappe-bench/logs/bench.log’

:pensive:

There is any way to let the bench command to run as root?

I have created the frappe group and user and they are the owners of /var/frappe-bench/logs/ (this is done by the spec) but the bench can not create files there :frowning:

I am looking for a way to handle this with the spec but if not, other way could be to run the bench comand as root :confused:

Two things,

In the spec, delete that bench.log file after install if it gives perms error

You can run a command as root if you define frappe_user in config.json. If run as root in this case, bench will drop to that user before running the command.