Upon several trials to install erpnext on Ubuntu 16.04 and 18.04 VPS, the below issue were found,
Please advice on disable the creation of swap through the installation process.
my VPS have already 6GB RAM and doesn’t need swap partition.
Upon several trials to install erpnext on Ubuntu 16.04 and 18.04 VPS, the below issue were found,
Please advice on disable the creation of swap through the installation process.
my VPS have already 6GB RAM and doesn’t need swap partition.
Please advice on disable the below task,
TASK [swap : Turn swap on] *****************************************************
task path: /tmp/.bench/playbooks/roles/swap/tasks/main.yml:13
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1571817392.3486488-158177141077193 `" && echo ansible-tmp-1571817392.3486488-158177141077193="` echo /root/.ansible/tmp/ansible-tmp-1571817392.3486488-158177141077193 `" ) && sleep 0'
Using module file /usr/local/lib/python3.6/dist-packages/ansible/modules/commands/command.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-15977uuaip5h7/tmpai15v1b1 TO /root/.ansible/tmp/ansible-tmp-1571817392.3486488-158177141077193/AnsiballZ_command.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1571817392.3486488-158177141077193/ /root/.ansible/tmp/ansible-tmp-1571817392.3486488-158177141077193/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1571817392.3486488-158177141077193/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1571817392.3486488-158177141077193/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
"changed": true,
"cmd": [
"swapon",
"-a"
],
"delta": "0:00:00.004310",
"end": "2019-10-23 07:56:32.522575",
"invocation": {
"module_args": {
"_raw_params": "swapon -a",
"_uses_shell": false,
"argv": null,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"stdin": null,
"stdin_add_newline": true,
"strip_empty_ends": true,
"warn": true
}
},
"msg": "non-zero return code",
"rc": 255,
"start": "2019-10-23 07:56:32.518265",
"stderr": "swapon: /extraswap: insecure permissions 0644, 0600 suggested.\nswapon: /extraswap: swapon failed: Operation not permitted\nswapon: /swapfile: swapon failed: Operation not permitted",
"stderr_lines": [
"swapon: /extraswap: insecure permissions 0644, 0600 suggested.",
"swapon: /extraswap: swapon failed: Operation not permitted",
"swapon: /swapfile: swapon failed: Operation not permitted"
],
"stdout": "",
"stdout_lines": []
}
These look more like permissions errors than memory errors. As which user did you install, and using which method?
the below commands were used,
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
sudo python install.py --production --user frappe
well, I kept digging to understand why installation fails with Ubuntu 16.04 and 18.04 which works normally with physical or virtual machines at which swap partition would be there.
yeah, it might appear as permissions issue but it is not, as operation not permitted by the ‘Host’ not the ‘Guest’ system.
but cause I’m currently use OpenVZ VPS at which no way to get swap partition, I have skipped the swap creation task as below,
- hosts: localhost
become: yes
become_user: root
roles:
- { role: common, tags: common }
- { role: locale, tags: locale }
- { role: mariadb, tags: mariadb }
- { role: nodejs, tags: nodejs }
# - { role: swap, tags: swap, when: production and not container }
- { role: logwatch, tags: logwatch, when: production }
- { role: bash_screen_wall, tags: bash_screen_wall, when: production }
- { role: frappe_selinux, tags: frappe_selinux, when: production }
- { role: dns_caching, tags: dns_caching, when: production }
- { role: ntpd, tags: ntpd, when: production }
- { role: wkhtmltopdf, tags: wkhtmltopdf }
- { role: psutil, tags: psutil }
- { role: redis, tags: redis }
- { role: supervisor, tags: supervisor, when: production }
- { role: nginx, tags: nginx, when: production }
- { role: fail2ban, tags: fail2ban, when: production }
so that installation has been completed successfully, the current problem is home page is loading too slowly with excessive CPU usage which I’m not sure yet, Is it because of no swap or the current design by erpnext team.
Hi. Its the OpenVZ issue. This link may help you. I trust with what @bkm has mentioned here based on his experience and knowledge.
well, while dealing with OpenVZ based VPS the command swapon -a
will results in “Operation is not permitted” error i.e. by the Host
system not the Guest
.
The alternative approach is to use --container
flag while running the install script,
sudo python install.py --production --user USER --version 11 --container
Installation continues but results in unjustified excessive CPU usage as shown below,
It’s not clear to me yet, what’s the use of swappiness
settings while the system having 8GB RAM as long as the --container
flag is available to consider installation using LXC containers!
When the easy install breaks about this error, go to the breaking file and clear all content. Have not seen any after effects in a low profile environment. Been working under this setting for more than 2 years.
using the below command, install script doesn’t breaks
sudo python install.py --production --user USER --version 11 --container
That excessive CPU usage still the same while installing without --container
flag and comment commands here /playbooks/roles/swap/tasks/main.yml
sorry, I didn’t get you, do you mean LXD container?
I checked out some topics here and I found LXD can be used for development
purpose but not reliable for production
environment.
LXD is a container platform native to Linux - independent of what kind of VM you use. It likely will only run on KVM and not on OpenVZ (same for Docker). OpenVZ itself is a virtual container type environment and --container flag may be needed for install. Did not try it myself.
I am using LXD for production in a light load environment. Is stable - frankly deal more issues related to ERPNext. As with any container environment, you need to have an additional reverse proxy container that routes traffic to the appropriate container.
I got informed by hosting guys that, OpenVZ v7 can run Docker and I install it already with no issues but I’m not fan of Docker actually.
I didn’t go through LXD cause I consider it as nested virtualization having poor performance,
I wish I’m wrong but that’s was the conclusion I got from many places over the internet.
It might be much developments have been done with LXD v3 and I can give it a try after checking out OpenVZ v7 capability to do so (by assuming LXD/Docker have same concepts) in case you confirm its reliability for production and the ease of regular backup/restore tasks.
I have no issues with it. The good thing about open source is you can choose the platform most suited for your needs.
well, I will go through LXD and let you know.
Thanks for advise
LXD doesn’t work with OpenVZ v7 due to failure to mount storage,
# lxd init
Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]: Disk
Name of the storage backend to use (btrfs, ceph, dir, lvm) [default=btrfs]:
Create a new BTRFS pool? (yes/no) [default=yes]:
Would you like to use an existing block device? (yes/no) [default=no]:
Size in GB of the new loop device (1GB minimum) [default=15GB]: 10GB
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]:
What should the new bridge be called? [default=lxdbr0]:
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
Would you like LXD to be available over the network? (yes/no) [default=no]:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:
Error: Failed to create storage pool 'Disk': Failed to prepare loop device for "/var/snap/lxd/common/lxd/disks/Disk.img": bad file descriptor
manual try to mount also fails,
sudo mount -o loop /var/snap/lxd/common/lxd/disks/Disk.img /home/Disk
mount: /home/Disk: mount failed: Operation not permitted.