[ARCHLINUX] [LXC containers] Installation troubleshooting

Seems promising but installation is too complicated and stability is questionable

Hi,
Thank you for your great work. However I have several comments regarding a new user trying to install and use ERPNEXT.

  1. Installation
    Configuration
  • micro server gen10
  • SSD for server OS
  • 2 HDDs RAID 1 for LXC containers

By the way: i tried LXD without success and gave up (instability when doing snapshots save/restore)

Server OS: archlinux
Containers: LXC with archlinux inside

Container Archlinux commands to install ERPNEXT (# means root, $ means user):

pacman -Syu

pacman -S mariadb redis python-pip python-setuptools wkhtmltopdf git npm cronie nginx

pip install -U pyOpenSSL

npm install -g yarn

Remark: Please see that we need to install pyOpenSSL and yarn to proceed during ERPNext installation (could be interesting to add it in the installation procedure)

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

systemctl start mariadb

mysql_secure_installation

mysql -V ### Check that mariadb version is 10.1.34 due to a known bug - see ERPNext forum

nano /etc/mysql/my.cnf

[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4

systemctl start mariadb redis

systemctl enable cronie mariadb redis

$ git clone https://github.com/frappe/bench bench-repo
$ echo “export PATH=$HOME/.local/bin:$PATH” >> ~/.bashrc
$ pip install --user -e bench-repo
$ bench init frappe-bench && cd frappe-bench
$ bench get-app erpnext https://github.com/frappe/erpnext
$ systemctl status mariadb redis cronie # check that services are up and running before proceeding
$ bench new-site site1.local
$ bench --site site1.local install-app erpnext
$ bench use site1.local
$ bench start

Remark: it was necessary to use Python3 to end the installation procedure

  1. Maintenance and deployment

Regarding the previous install, you can see that i did not select any ERPNext versions.
As a company, i want to have a stable version installed. How do we do that ?
If we look at the github frappe/erpnext repository we can see that all the branches (more or less) do not success in the continuous integration process. Is this normal?

My point of view is that ERPNext team should:

  • provide release and tell people on how to install it in an easy way (checking several platform and environments) The first impression always gives something important for user adoption
  • provide stable fix on the release in order to prevent any major issue for a production env.
  • offer a dev branch to test latest development

The main concern is that your communication is not clear, your procedure to switch from one version to another is not clear and more important it seems that you develop more new features than correcting bugs and improving first installation impression.

I am really convince that ERPNext is an interesting product but installation and upgrade is a nightmare!

  1. Finally, it seems that on the dev branch you can not do a “bench update” without doing a git stash in apps/frappe_io
    This is definitely crazy, why don’t you fix that?

Industrial users need stability and confidence,
It took me 1 month to install the hardware, the server OS, the containers and finally ERPNext which is the hardest part.

If you think that I should have tried an Ubuntu installation, the answer is I did but without success. Virtual box is also not a solution (only for testing IMHO).

I do not think that my experience is special regarding industrial user needs but i can tell you that my my patience has been put to the test.

Continue your great job but please focus on installation, maintenance, update procedure and up to date documentation in order to have plenty of happy users.

Best

1 Like

Hi,

I am also a new user on erpnext. I am exploring it from education prospective.
First concern was the installation. I started it up with the Linux Debian 8 version and failed!
I tried the Manual Install Setup, community assist to some level but it didnt work.

Later, i tried Ubuntu 16.05 and use Easy Install as per recommendation from one of the community member.
Easy Install --> Does all the pre-requisites install and do all installation and configuration for you. So, you may have to focus on its features and stability !

I would suggest you to also try Easy Install (Once you are sure with the software stability and happy with the required features). You may dive deep in architecture, repositary updates and maintenance concerns.

I also have to explore Backup and Disaster Recovery Concerns.

thanks

1 Like

I have tried several times to install ERPNext on ArchLinux - I have not yet succeede 100%. Specifically, @codingCoffee recommends NOT using archlinux for a production ERPNext machine.
I personally don’t like ubuntu, but debian is very stable and if you follow https://discuss.erpnext.com/t/guide-manual-install-erpnext-on-ubuntu-16-xx-debian-v8-9/22596 you will be fine

@flyinglionel

We’ve never tried installing it in an LXC container. To be frank, that has never been the target or even a priority for us. You are probably the 1st person to try using it on LXC. Kudos to your efforts! If you could elaborate on the problems you faced, I would gladly try to help you out to the best of my ability.

Installation on a baremetal server, or a hardware based virtualization, like virtualbox or VMWare is what we we’re focused on. We have a install script for it, and it works on Ubuntu, Debian and CentOS. It is perfect for spawning up an instance quickly for evaluation or production use. Yes, I know having it only for 3 major distributions may seem very limited, but given that we’re a small team, it makes sense to focus majorly on making the system feature rich and killing bugs, rather that try and support every platform out there. Secondly for the target audience of an ERP the installation platform is hardly ever a major concern.

Yes I agree we do lack when it comes to documenting the installation process very well, and listing out the commonly faced pitfalls, which is an essential thing for developers, we’re actively working on it.

I don’t think pyOpenSSL is really needed. But maybe, pacman -S openssl is. Regardless, noted! I’ve amended the wiki accordingly! Also maybe next time you could update it yourself. We would really love to have contributions coming in. :wink:

I don’t see why this was necessary. We support both python 2 and 3 currently. I too use Arch Linux as my daily driver and have successfully setup ERPNext on both Python 2 and 3.

By default the develop version is installed. As I mentioned earlier, we have an easy install script for setting up a production environment. In case you didn’t stumble upon it, here is the link. Here is the way our branches work:

  • master: stable branch (probably what you should use in production, if stability is your main concern) (currently at the time of writing this post v10)
  • staging: the next version release branch (currently at the time of writing this post v11). This isn’t exactly stable, there might be a few things breaking here and there, but at the same time we’re actively monitoring and fixing the issues.
  • develop: bleeding edge (you’ll find all the latest features here)

Also it might be worth mentioning here that in ERPNext there’s no way to rollback to a previous version. This means, if you’re on develop, you simply cannot switch to master branch, since there are a lot of DB Schema changes happening in between branches, rollback is not an option.

Have sent a PR, will soon be fixed! Thanks for mentioning.


Given, your long post it does seem that your 1st impression of ERPNext was really bad. Apologies for the same. Maybe you should give it another try. Setup an empty Debian/Ubuntu server, and use these setups for installing the production setup. You’ll have an ERPNext instance up and running in no time.

cd ~ && apt-get update && apt-get upgrade -y && apt-get install -y curl zsh git vim python-dev
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py && sudo python install.py --production --user frappe --mysql-root-password frappe --admin-password frappe

In case you want to setup a developer instance the Hitchhiker’s guide might interest you.

3 Likes

I seem to recall @lefebvre_bern or one of his team members had LXD working, but I don’t remember the details.

Hi

Thank you for your answer. I appreciate you took the time to look at my concern. However you did not convince me on some points, see below. By the way, I read all the links you mentioned.

  1. I won’t switch to debian or ubuntu due to the fact that the only Linux distribution we are using for both embedded products, server and desktop is ArchLinux (admin concern).
    Therefore, I do not need a link to an easy script. I need to understand what commands i have to issue to have a stable and functional ERPNext.
    By the way, as ArchLinux is minimalist, launching ERPNext on it should not be a problem. Neither for LXC containers that are natively supported by the kernel.

  2. Stuck in develop branch -> no way for a company
    You mentioned that as soon as I am, by default, in the development branches, ther is no possibility to revert to a stable branch called “master”.
    Thus i decided to do another trial inside a brand new container.
    Here are the commands issued:

git clone https://github.com/frappe/bench bench-repo
echo “export PATH=$HOME/.local/bin:$PATH” >> ~/.bashrc
pip install --user -e bench-repo
bench init frappe-bench && cd frappe-bench
bench get-app erpnext https://github.com/frappe/erpnext

And then prior to install the site (and the associated database) I decided to switch to the master to follow your advice (with the following command).

bench switch-to-master

Here is the output:

=================
[user1@erpnext-base frappe-bench]$ bench switch-to-master
Switching for frappe
INFO:bench.utils:git config --unset-all remote.upstream.fetch
INFO:bench.utils:git config --add remote.upstream.fetch ‘+refs/heads/:refs/remotes/upstream/
INFO:bench.utils:git fetch upstream
INFO:bench.utils:git checkout master
Branch ‘master’ set up to track remote branch ‘master’ from ‘upstream’.
Switched to a new branch ‘master’
INFO:bench.utils:git merge upstream/master
Already up to date.
Branch master does not exist in Upstream for erpnext
Successfully switched branches for:
frappe

Switched to master
Please run bench update --patch to be safe from any differences in database schema

As you can see, there is no branch Master it seems.

So what should I do?

I want to have a stable ERPNext inside a LXC container powered by ArchLinux in order to switch to the next release when this latter will be available. I do not care about the development branches that is too dangerous for a company (it may interesting to experiment in a dedicated container the new development but for the production environment it is a no go).

I really appreciate your efforts and I will continue to do some efforts to fully understand the upgrade/maintenance mechanism of ERPNext but please give me a straight forward solution to install a stable version that I can update when v11 will be release.

Note : the hitchhiker guide does not cover my concerns

I do think I am quiet close to the solution but it is still painful. Please keep up your good job and if you have time to support me I will appreciate.

Thanks

Hi,

Yes i did a successful installation of LXD but it does not support various copy of containers or snapshoting.
I ended with a rsync copy problems.

I do not recommend LXD for production use. If you check its adoption by archlinux community it is very low compare to LXC (which is stable enough, i think).

Therefore, my advice is to get rid of LXD (even if it is a little less complex to administrate) and go with LXC for small and efficient containers.

Thanks @flyinglionel, this is good background. I’m not very familiar with either Arch or LXD/LXC. I did try developing with the Docker container for a while and it wasn’t an awesome experience, but I think that’s where most of the effort in this vein is going, so I do expect it to improve.

Let me try to help with switch-to-master, behind which is a script that changes the git heads of ERPNext and and Frappe, which you can and should do manually now that you’ve run into an issue. After a change in branch, run bench build and bench migrate so that changes in the node packages and database schema are picked up. I have had a lot of difficulty doing this cleanly myself and I wish that the switch-to-master worked a little better out of the box.

I finally switch to master branch by doing two things:

bench get-app erpnext https://github.com/frappe/erpnext --branch master
bench switch-to-master

However, master branch of ERPNEXt is not compatible with python 3 (only devlopment banch is).

Thus i have the following error (see below):

This is a disaster i am stuck in the development branch (!!!)

What is interesting to note is that I am not the only one to do not understand the release process.


Dear ERPNext developers, if someday your concern is to have an industrial product, please take in considerations our feedbacks. We need stable release that is by default installed (and if we want to test the latest dev we will fetch the right things BUT not the opposite - it does not make sense to have the develop branch fetch instead of master by default)

[user1@erpnext-base frappe-bench]$ bench update --reset --force
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up to date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python3.6/site-packages
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
INFO:bench.app:pulling frappe
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/master
HEAD is now at b9fffc991 Merge branch ‘hotfix’
INFO:bench.utils:find . -name “.pyc" -delete
INFO:bench.app:pulling frappe_io
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/master
HEAD is now at 62bf139 Datatable
INFO:bench.utils:find . -name "
.pyc” -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/master
HEAD is now at 8ca5940f76 Merge branch ‘hotfix’
INFO:bench.utils:find . -name “.pyc" -delete
INFO:bench.app:pulling foundation
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/master
HEAD is now at 6d2f203 style + sidebar
INFO:bench.utils:find . -name "
.pyc” -delete
Updating Python libraries…
INFO:bench.utils:./env/bin/pip install --upgrade pip==9.0.3
Requirement already up-to-date: pip==9.0.3 in ./env/lib/python3.6/site-packages
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
INFO:bench.utils:./env/bin/pip install -q -r /home/user1/bench-repo/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/foundation/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe_io/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
Updating node packages…
INFO:bench.utils:npm install
npm WARN frappe@ No description
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})

audited 2626 packages in 4.296s
found 0 vulnerabilities

Backing up sites…
Patching sites…
Traceback (most recent call last):
File “/home/user1/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 64, in get_app_commands
app_command_module = importlib.import_module(app + ‘.commands’)
File “/home/user1/frappe-bench/env/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘frappe_io.commands’
Traceback (most recent call last):
File “/home/user1/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 64, in get_app_commands
app_command_module = importlib.import_module(app + ‘.commands’)
File “/home/user1/frappe-bench/env/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘foundation.commands’
*** Error compiling ‘…/apps/erpnext/erpnext/education/doctype/guardian/guardian.py’…
File “…/apps/erpnext/erpnext/education/doctype/guardian/guardian.py”, line 40
print guardian_as_user
^
SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(guardian_as_user)?

*** Error compiling ‘…/apps/erpnext/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py’…
Sorry: TabError: inconsistent use of tabs and spaces in indentation (healthcare_settings.py, line 28)
*** Error compiling ‘…/apps/erpnext/erpnext/hr/doctype/payroll_entry/test_payroll_entry.py’…
File “…/apps/erpnext/erpnext/hr/doctype/payroll_entry/test_payroll_entry.py”, line 170
new_year = dt + relativedelta(month=01, day=01, year=dt.year)
^
SyntaxError: invalid token

*** Error compiling ‘…/apps/erpnext/erpnext/patches/v4_0/validate_v3_patch.py’…
File “…/apps/erpnext/erpnext/patches/v4_0/validate_v3_patch.py”, line 11
raise Exception, “site not ready to migrate to version 4”
^
SyntaxError: invalid syntax

*** Error compiling ‘…/apps/erpnext/erpnext/setup/utils.py’…
File “…/apps/erpnext/erpnext/setup/utils.py”, line 131
except frappe.DuplicateEntryError, e:
^

I agree with you - the installation and upgrading procedure is wobbly.
After I got burnt twice, I decided to go “stable” from the very start, which needed a few tricks. Here you go (copied from my DokuWiki, unfortunately, I am not allowed to attach any [.pdf] files):

Install ERPNext
Create Users and Groups for the ERPNext Instance
Enter the www_py jail, and create a non-privileged user for each ERPNext instance with correct locales for Python3 as follows:
ezjail-admin console www_py
setenv APP frappe
setenv ENVIRONMENT [prd]
setenv INSTANCE ${APP}_${ENVIRONMENT}
setenv INSTANCE_UID_GID [3600]
pw groupadd ${INSTANCE} -g ${INSTANCE_UID_GID}
pw useradd -c “${INSTANCE} user” -d /usr/local/${INSTANCE} -n ${INSTANCE} -s /bin/csh -u ${INSTANCE_UID_GID} -w no
echo ‘setenv LC_ALL en_US.UTF-8’ > /usr/local/${INSTANCE}/.cshrc
echo ‘setenv LANG en_US.UTF-8’ >> /usr/local/${INSTANCE}/.cshrc
passwd ${INSTANCE}
Replace placeholders in [brackets] with their appropriate values.
System prompt
Your response
New password
[[instance [password]
Retype new password
[[instance] password]
Give the [instance] user access to cron by issuing the following as root from within the jail:
echo “${INSTANCE}” >> /var/cron/cron.allow
/etc/rc.d/cron restart

Install Frappé Bench in a Virtual Environment
Enter the www_py jail and issue the following as root for each ERPNext instance::
ezjail-admin console www_py
setenv APP frappe
setenv ENVIRONMENT [prd]
setenv INSTANCE ${APP}${ENVIRONMENT}
Replace placeholders in [brackets] with their appropriate values. The database and user name [app]
[site_id][environment] must not exceed 16 letters, or MariaDB will throw an error.
cd /usr/local
virtualenv --system-site-packages ${INSTANCE}
chown -R ${INSTANCE}:www /usr/local/${INSTANCE}
chmod -R o-rwx /usr/local/${INSTANCE}
cd /usr/local/${INSTANCE}
su - ${INSTANCE}
setenv APP frappe
setenv ENVIRONMENT [prd]
setenv INSTANCE ${APP}
${ENVIRONMENT}
source bin/activate.csh
rm -rf /usr/local/${INSTANCE}/.cache/pip
rm -rf /usr/local/${INSTANCE}/.cache/yarn
git clone https://github.com/frappe/bench bench-repo
pip install -e bench-repo
deactivate
exit
chown -R ${INSTANCE}:www /usr/local/${INSTANCE}
chmod -R o-rwx /usr/local/${INSTANCE}
rm -rf /usr/local/${INSTANCE}/.cache/pip
rm -rf /usr/local/${INSTANCE}/.cache/yarn
cd /usr/local/${INSTANCE}
su - ${INSTANCE}
setenv APP frappe
setenv ENVIRONMENT [prd]
setenv INSTANCE ${APP}_${ENVIRONMENT}
setenv SITE_ID [organisation acronym]
setenv VIRTUAL_DOMAIN [my.domain]
setenv SUBDOMAIN erpnext
source bin/activate.csh
bench init frappe-bench
cd frappe-bench
bench switch-to-master
bench update --reset
./env/bin/pip install --global-option=build_ext --global-option="-I/usr/local/include/" --global-option="-L/usr/local/lib" python-ldap
Replace placeholders in [brackets] with their appropriate values.
Provide database server details:
cd /usr/local/${INSTANCE}/frappe-bench
bench set-mariadb-host mysql.jail.vlan

Install ERPNext to a New Site
In a second window, enter the www_py jail and issue the following as root from within the jail:
ezjail-admin console www_py
setenv APP frappe
setenv ENVIRONMENT [prd]
setenv INSTANCE ${APP}${ENVIRONMENT}
su - ${INSTANCE}
source bin/activate.csh
cd frappe-bench
setenv LC_ALL en_US.UTF-8
setenv LANG en_US.UTF-8
bench start
Replace placeholders in [brackets] with their appropriate values.
Back in the first window, create a new site [subdomain].[virtual.domain] within Frappe:
bench new-site --db-name ${APP}
${SITE_ID}_${ENVIRONMENT} --force --verbose ${SUBDOMAIN}.${VIRTUAL_DOMAIN}
System prompt
Your Response
MySQL root password
[mysql root passsword]
Set administrator password
[administrator password]
Re-enter administrator password
[administrator password]
Replace the placeholders in [brackets] with their appropriate values.
Get the ERPNext application and install it into the newly created site:
bench get-app --branch master erpnext https://github.com/frappe/erpnext
bench --site ${SUBDOMAIN}.${VIRTUAL_DOMAIN} install-app erpnext
bench setup-help
rm -rf /usr/local/${INSTANCE}/.cache/pip
rm -rf /usr/local/${INSTANCE}/.cache/yarn
Make sure Frappé is running in the second window during the above commands. We are going to use the stable master branch throughout.
Close the second window.

Configure Frappé Bench and ERPNext
As [instance] user, issue the following from within the virtual environment and the jail:
bench set-url-root ${SUBDOMAIN}.${VIRTUAL_DOMAIN} https://${SUBDOMAIN}.${VIRTUAL_DOMAIN}
bench set-nginx-port ${SUBDOMAIN}.${VIRTUAL_DOMAIN} [7000]
bench setup supervisor
Replace placeholders in [brackets] with their appropriate values. Increment port number by +1 for each site. This will create sample configuration files for supervisord and Nginx in /usr/local/${APP}/frappe-bench/config/.
Backup the original configuration files:
cp -p /usr/local/${INSTANCE}/frappe-bench/config/redis_cache.conf /usr/local/${INSTANCE}/frappe-bench/config/redis_cache.conf.orig
cp -p /usr/local/${INSTANCE}/frappe-bench/config/redis_queue.conf /usr/local/${INSTANCE}/frappe-bench/config/redis_queue.conf.orig
cp -p /usr/local/${INSTANCE}/frappe-bench/config/redis_socketio.conf /usr/local/${INSTANCE}/frappe-bench/config/redis_socketio.conf.orig
cp -p /usr/local/${INSTANCE}/frappe-bench/config/supervisor.conf /usr/local/${INSTANCE}/frappe-bench/config/supervisor.conf.orig
cp -p /usr/local/${INSTANCE}/frappe-bench/sites/common_site_config.json /usr/local/${INSTANCE}/frappe-bench/sites/common_site_config.json.orig
Edit /usr/local/${INSTANCE}/frappe-bench/config/redis_cache.conf as follows (only changed sections are shown):
#bind 127.0.0.1
bind 127.0.1.113
Edit /usr/local/${INSTANCE}/frappe-bench/config/redis_queue.conf as follows (only changed sections are shown):
#bind 127.0.0.1
bind 127.0.1.113
Edit /usr/local/${INSTANCE}/frappe-bench/config/redis_socketio.conf as follows (only changed sections are shown):
#bind 127.0.0.1
bind 127.0.1.113
Edit /usr/local/${INSTANCE}/frappe-bench/config/supervisor.conf as follows (only changed sections are shown):
;command=/usr/local/frappe_prd/frappe-bench/env/bin/gunicorn -b 127.0.0.1:8000 -w 8 -t 120 frappe.app:application --preload
command=/usr/local/frappe_prd/frappe-bench/env/bin/gunicorn -b :8000 -w 4 -t 120 frappe.app:application --preload
ERPNext wants Gunicoirn to run on 127.0.0.1. We need it to run on 127.0.1.113, too.
Edit /usr/local/${INSTANCE}/frappe-bench/sites/common_site_config.json as follows (only changed sections are shown):
“gunicorn_workers”: 4,
“redis_cache”: “redis://www_py.jail.vlan:13000”,
“redis_queue”: “redis://www_py.jail.vlan:11000”,
“redis_socketio”: “redis://www_py.jail.vlan:12000”,
“restart_supervisor_on_update”: false,
Become root and secure permissions:
exit
chown -R ${INSTANCE}:www /usr/local/${INSTANCE}
chmod -R o-rwx /usr/local/${INSTANCE}
cd /usr/local/${INSTANCE}
chmod -R g-rwx ./.cache ./.mc ./.node-gyp ./.yarn ./bench-repo ./bin ./include ./lib ./.yarnrc ./pip-selfcheck.json
chmod 400 /usr/local/${INSTANCE}/.cshrc
Make logs more accessible and prepare Frappé for automatic boot-up by issuing the following as root from within the jail, yet do not start Frappé yet:
ln -fs /usr/local/${INSTANCE}/frappe-bench/logs /var/log/${INSTANCE}
ln -fs /usr/local/${INSTANCE}/frappe-bench/config/supervisor.conf /usr/local/etc/supervisord.conf.d/${INSTANCE}.conf
/usr/local/etc/rc.d/supervisord stop
Edit /var/cron/tabs/[instance] as follows (only changed sections are shown):
#0 */6 * * * cd /usr/local/${INSTANCE}/frappe-bench && /usr/local/${INSTANCE}/bin/bench --site all backup >> /usr/local/${INSTANCE}/frappe-bench/logs/backup.log 2>&1
0 */6 * * * cd /usr/local/${INSTANCE}/frappe-bench && /usr/local/${INSTANCE}/bin/bench --site all backup >> /usr/local/${INSTANCE}/frappe-bench/logs/backup.log
#0 10 * * * cd /usr/local/${INSTANCE}/frappe-bench && /usr/local/${INSTANCE}/frappe-bench/env/bin/bench update --auto >> /usr/local/${INSTANCE}/frappe-bench/logs/auto_update_log.log 2>&1
0 10 * * * cd /usr/local/${INSTANCE}/frappe-bench && /usr/local/${INSTANCE}/bin/bench update --auto >> /usr/local/${INSTANCE}/frappe-bench/logs/auto_update_log.log
Restart the jail:
exit
ezjail-admin restart www_py

Update Frappé Bench in a Virtual Environment
Enter the www_py jail and issue the following as root:
ezjail-admin console www_py
setenv APP frappe
setenv ENVIRONMENT [prd]
setenv INSTANCE ${APP}_${ENVIRONMENT}
su - ${INSTANCE}
source bin/activate.csh
cd frappe-bench
bench update
./env/bin/pip install -U --global-option=build_ext --global-option="-I/usr/local/include/" --global-option="-L/usr/local/lib" python-ldap
bench clear-cache
bench clear-website-cache
rm -rf /usr/local/${INSTANCE}/.cache/pip
rm -rf /usr/local/${INSTANCE}/.cache/yarn
cd
deactivate
exit
Adjust placeholders in [brackets] with the appropriate values. You may have to issue bench update --reset to perform a clean update. However, this will write over any modifications you may have done to any apps.
Restart the jail:
exit
ezjail-admin restart www_py

Configure LDAP
Log into your ERPNext instance as privileged user.
Goto
System prompt
Your response
Setup

Integrations

LDAP settings
Enabled
Yes

LDAP server URL
ldaps://ldap.jail.vlan:636

Organisational unit
ou=People,o=[organisation]

Base DN
cn=LDAPReader,ou=Roles,o=[organisation]

Password for base DN
[LDAPReader password]

LDAP search string
(&(objectclass=inetOrgPerson)(memberOf=cn=[subdomain].[my.domain],ou=Groups,o=[organisation])(mail={}))

LDAP first name field
givenName

LDAP email field
mail

LDAP username field
mail

Reset admin Password
Enter the www_py jail and issue the following as root:
ezjail-admin console www_py
setenv APP frappe
setenv ENVIRONMENT [prd]
setenv INSTANCE ${APP}_${ENVIRONMENT}
su - ${INSTANCE}
setenv SUBDOMAIN erpnext
setenv VIRTUAL_DOMAIN [my.domain]
cd frappe-bench
bench --site ${SUBDOMAIN}.${VIRTUAL_DOMAIN} set-admin-password [admin password]
Adjust placeholders in [brackets] with the appropriate values.

Note: The above system runs FreeBSD and ERPNext has been deployed inside a jail (www_py.jail.vlan, IP: 127.0.1.113), all running behind an Nginx reverse proxy in a different jail. So far, this stuff has worked, including upgrades. Maybe it can help you?
Chris

1 Like

it’s funny that you say that to everyone who brings the LXC (or LXD) matter up. And just to clarify … this is not quite accurate. There are some ppl who actually run ERPNext inside an LXD/LXC container and others who have tried to get it running with different outcomes.

I personally believe it would be superhandy to do this and I have had sucess with the easyinstall script about a year ago. but lately it does not seems to work inside a LXD/LXC container any more. Manual installation has worked for me last time I tried.

@vrms if you’d like to take leadership in regards to LXC/LXD, you are free to do so!

Hi
Just to let you know. I gave up to use my own ERPNext server for the following reasons.

ERPNext is just stable enough regarding the installation process and the update process (two much variables according to the server environments). I have switched to the ERPnext cloud version.

From my experience, i had two main problems with LXC maintenance:

  • setup of network within the linux host (difficult to have a bullet proof setup that let’s LXC containers communicate in both direction)
  • LXC containers under ArchLinux are not easy to maintain with ERPnext. I did not succeed to do clean upgrade for example.

Note: I gave up with LXD because it is not stable compared to LXC which is.

I will probably try again when ERPNext install and upgrade process will evolve in the right direction.

Coming from Dolibarr, this latter is very well managed regarding update process.

Do not give up.
Best
Lionel

Just fyi - using ERPNext with Snap LXD (on Ubuntu Minimal 18.04). Stable with some really nice features - can auto snapshot (every minute if needed) and backup entire storage pool off-site.

To run the install script inside a container add flag --container and it installed for me without issues. Did not try on ArchLinux.

Cloud Version of ERPNext though is best as it is headache free.