ERPNext14 » Historie » Revision 63
« Zurück |
Revision 63/64
(Vergleich)
| Weiter »
Jeremias Keihsler, 17.10.2023 18:18
ERPNext 14¶
long term goal is to run ERPNext in a podman-pod. Maybe this can be a first stepping stone:
https://piotrkrzyzek.com/how-to-setup-self-host-erpnext-in-docker-without-treafik-nginx-only/
until then we use Bitnami VMs.
Bitnami based on Debian 11¶
out of the box ERPNext is installed. This describes what else can/needs to be done:
convert VirtualBox-ova to be used with KVM¶
untar .ova
tar xvf bitnami-erpnext-14.44.0-r0-debian-11-x86_64-amd64.ova
convert .vmdk
to .qcow2
while showing 'progress'
qemu-img convert -p -f vmdk -O qcow2 \
bitnami-erpnext-14-14.44.0-r0-debian-11-x86_64-amd64-disk-0.vmdk \
bitnami-erpnext-14-14.44.0-r0-debian-11-x86_64-amd64-disk-0.qcow2
this is a sample virsh dumpxml with a bridged interface
<domain type="kvm" id="7">
<name>bitnami_erpnext</name>
<uuid>acf57964-b3d8-4148-9391-b4552a72a32c</uuid>
<metadata>
<libosinfo:libosinfo>
<libosinfo:os id="http://debian.org/debian/11"/>
</libosinfo:libosinfo>
</metadata>
<memory unit="KiB">4194304</memory>
<currentMemory unit="KiB">4194304</currentMemory>
<vcpu placement="static">2</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch="x86_64" machine="pc-i440fx-rhel7.0.0">hvm</type>
<boot dev="hd"/>
<bootmenu enable="yes"/>
</os>
<features>
<acpi/>
<apic/>
</features>
<cpu mode="host-passthrough" check="none">
<topology sockets="1" cores="1" threads="2"/>
</cpu>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/../libvirt/images/bitnami-erpnext-14.11.0-0-linux-vm-debian-11-x86_64-nami-disk1.qcow2"/>
<backingStore/>
<target dev="vdb" bus="virtio"/>
<alias name="virtio-disk1"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x0b" function="0x0"/>
</disk>
<controller type="usb" index="0" model="ich9-ehci1">
<alias name="usb"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x7"/>
</controller>
<controller type="usb" index="0" model="ich9-uhci1">
<alias name="usb"/>
<master startport="0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x0" multifunction="on"/>
</controller>
<controller type="usb" index="0" model="ich9-uhci2">
<alias name="usb"/>
<master startport="2"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x1"/>
</controller>
<controller type="usb" index="0" model="ich9-uhci3">
<alias name="usb"/>
<master startport="4"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x2"/>
</controller>
<controller type="pci" index="0" model="pci-root">
<alias name="pci.0"/>
</controller>
<controller type="virtio-serial" index="0">
<alias name="virtio-serial0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x06" function="0x0"/>
</controller>
<controller type="scsi" index="0" model="virtio-scsi">
<alias name="scsi0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x0a" function="0x0"/>
</controller>
<interface type="bridge">
<mac address="52:54:00:29:00:87"/>
<source bridge="br0"/>
<target dev="vnet1"/>
<model type="virtio"/>
<alias name="net0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0"/>
</interface>
<serial type="pty">
<source path="/dev/pts/9"/>
<target type="isa-serial" port="0">
<model name="isa-serial"/>
</target>
<alias name="serial0"/>
</serial>
<console type="pty" tty="/dev/pts/9">
<source path="/dev/pts/9"/>
<target type="serial" port="0"/>
<alias name="serial0"/>
</console>
<channel type="unix">
<source mode="bind" path="/var/lib/libvirt/qemu/channel/target/domain-7-bitnami_erpnext/org.qemu.guest_agent.0"/>
<target type="virtio" name="org.qemu.guest_agent.0" state="disconnected"/>
<alias name="channel0"/>
<address type="virtio-serial" controller="0" bus="0" port="1"/>
</channel>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0" state="disconnected"/>
<alias name="channel1"/>
<address type="virtio-serial" controller="0" bus="0" port="2"/>
</channel>
<input type="tablet" bus="usb">
<alias name="input0"/>
<address type="usb" bus="0" port="1"/>
</input>
<input type="mouse" bus="ps2">
<alias name="input1"/>
</input>
<input type="keyboard" bus="ps2">
<alias name="input2"/>
</input>
<graphics type="spice" port="5901" autoport="yes" listen="127.0.0.1">
<listen type="address" address="127.0.0.1"/>
</graphics>
<sound model="ich6">
<alias name="sound0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x04" function="0x0"/>
</sound>
<video>
<model type="qxl" ram="65536" vram="65536" vgamem="16384" heads="1" primary="yes"/>
<alias name="video0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
</video>
<redirdev bus="usb" type="spicevmc">
<alias name="redir0"/>
<address type="usb" bus="0" port="2"/>
</redirdev>
<redirdev bus="usb" type="spicevmc">
<alias name="redir1"/>
<address type="usb" bus="0" port="3"/>
</redirdev>
<memballoon model="virtio">
<alias name="balloon0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x08" function="0x0"/>
</memballoon>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
<alias name="rng0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x09" function="0x0"/>
</rng>
</devices>
<seclabel type="dynamic" model="selinux" relabel="yes">
<label>system_u:system_r:svirt_t:s0:c328,c377</label>
<imagelabel>system_u:object_r:svirt_image_t:s0:c328,c377</imagelabel>
</seclabel>
<seclabel type="dynamic" model="dac" relabel="yes">
<label>+107:+107</label>
<imagelabel>+107:+107</imagelabel>
</seclabel>
</domain>
modify keyboard layout¶
taken from https://docs.bitnami.com/virtual-machine/faq/configuration/configure-keyboard/
sudo apt update
sudo apt install keyboard-configuration console-setup
set static IP address¶
taken from https://docs.bitnami.com/virtual-machine/faq/configuration/configure-static-address/
check link and current IPs
sudo ifconfig
cd /etc/systemd/network
sudo touch 25-wired.network
add following lines
[Match] Name=ens3 [Network] Address=HOST-IP-ADDRESS Gateway=GATEWAY-IP-ADDRESS
restart service
sudo systemctl restart systemd-networkd
sudo systemctl enable systemd-networkd
activate SSH-Server¶
taken from https://docs.bitnami.com/virtual-machine/faq/get-started/enable-ssh/
sudo rm -f /etc/ssh/sshd_not_to_be_run
sudo systemctl enable ssh
sudo systemctl start ssh
... password-based SSH auth (are you serious?)¶
maybe ok for testing ..
taken from https://docs.bitnami.com/virtual-machine/faq/get-started/enable-ssh-password/
edit /etc/ssh/sshd_config
and add/modify the following line
PasswordAuthentication yes
restart SSH server
sudo systemctl restart ssh
... and of course cert-based ..¶
from the remote machine just
ssh-copy-id bitnami@example.com
install some little tools¶
sudo apt install vim htop rsync wget
alias ll¶
for everyone .. taken from https://www.server-world.info/en/note?os=Debian_11&p=initial_conf&f=2
sudo vim /etc/profile.d/command_alias.sh
# create new file # add alias you'd like to set alias ll='ls $LS_OPTIONS -l' # alias l='ls $LS_OPTIONS -lA' # alias rm='rm -i' # alias cp='cp -i' # alias mv='mv -i'
source /etc/profile.d/command_alias.sh
Install the Wkhtmltopdf extension¶
taken from https://docs.bitnami.com/aws/apps/erpnext/configuration/install-wkhtmltopdf/
alternatively it should be possible to install via something like bench install wkhtmltopdf
but it's not working as of 2023-10-17
# cd /opt/bitnami/erpnext/frappe-bench/apps/erpnext/
# . ../../../venv/bin/activate
# pip install ansible
# sudo bench install wkhtmltopdf
find /opt/bitnami/common/bin -name fc-* | sudo xargs -I {} mv {} {}.bak
sudo apt install zlib1g fontconfig libxrender1 libfreetype6 libxext6 libx11-6
Download the latest version of the package from the Wkhtmltopdf project releases page and install it. Replace the X.Y.Z and PLATFORM placeholders with the correct version and platform strings from the release filename.
https://github.com/wkhtmltopdf/wkhtmltopdf/releases/
as of 2023-02-16 https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/X.Y.Z/wkhtmltox_X.Y.Z.PLATFORM.deb
sudo apt install -f ./wkhtmltox_X.Y.Z.PLATFORM.deb
sudo /opt/bitnami/ctlscript.sh restart
install alternative way?¶
without QT but with virtual X11-Server
https://packages.debian.org/bullseye/xvfb
https://installati.one/debian/11/wkhtmltopdf/
https://packages.debian.org/stable/wkhtmltopdf
needs some testing
Troubleshooting PDF formating issues¶
taken from https://discuss.frappe.io/t/pdf-alignment-problem/34425/7
set the IP-adr. in site_config.json
vim /opt/bitnami/erpnext/frappe-bench/sites/erpnext/site_config.json
replace http:localhost
with the https://hostname-ip:443
"host_name": "https://192.168.41.131:443"
Troubleshooting (is just a reminder ... I stumbled across but didn't do it, as there were no related issues yet)¶
If you experience issues with display resolution on Linux platforms, they could be related to the xfonts-75dpi or xfonts-100dpi packages. Uninstall them by executing:
sudo dpkg --remove --force-depends xfonts-75dpi
sudo dpkg --remove --force-depends xfonts-100dpi
Troubleshooting post migration¶
upload attachments fail (private/public files)¶
sudo chmod g+w /opt/bitnami/erpnext/frappe-bench/sites/erpnext/private/files
sudo chown bitnami:daemon /opt/bitnami/erpnext/frappe-bench/sites/erpnext/private/files/*
sudo chmod g+w /opt/bitnami/erpnext/frappe-bench/sites/erpnext/public/files
sudo chown bitnami:daemon /opt/bitnami/erpnext/frappe-bench/sites/erpnext/public/files/*
sending mails fail¶
encryption key needs to transfered from original installation
sudo vim /opt/bitnami/erpnext/frappe-bench/sites/erpnext/site_config.json
"encryption_key": "super_lksdjfdlskfdlskf_secret",
automatic backup of ERPNext¶
sudo vim /usr/local/bin/erpnext-backup.sh
#!/bin/bash -l
# there is some 'magic' in the shebang, the '-l' is invoking the environment of the calling user (in this case 'bitnami')
# JKE 2023-08-24
cd /opt/bitnami/erpnext/frappe-bench
# JKE 2023-10-13 backup sites individually and with files
# bench backup-all-sites
# bench --site erpnext backup --with-files
# bench --site erpnext set-maintenance-mode on
bench --site all backup --with-files
# bench --site erpnext set-maintenance-mode off
# bench --site all backup --with-files --compress --backup-path /var/cache/myerpnext.bak/
# /JKE 2023-10-13
sudo chmod +x /usr/local/bin/erpnext-backup.sh
sudo vim /etc/cron.d/erpnext-backup
# JKE 2023-08-24
#
# min hr dom month dow user command
# - - - - -
# | | | | |
# | | | | +-day of week (0-7) sunday=0 or 7
# | | | +---------month (1-12)
# | | +----------------day of month (1-31)
# | +-----------------------hour (0-23)
# +------------------------------min (0-59)
#
# 32 13 * * * bitnami /usr/local/bin/erpnext-backup.sh >> /home/bitnami/erpnext-backup.log 2>&1
15 18 * * * bitnami /usr/local/bin/erpnext-backup.sh
here is again some 'magic', there is no MTA available. So any output from the cron-job gets discarded.
use the upper construct to debug and append the output to /home/bitnami/erpnext-backup.log
the backups are stored in /opt/bitnami/erpnext/frappe-bench/sites/erpnext/private/backups
retrieve backups from external machine¶
rsync is not installed by default ..
sudo apt install rsync
from the external machine, just invoke like
rsync --verbose --progress --stats --recursive bitnami@example.com:/opt/bitnami/erpnext/frappe-bench/sites/erpnext/private/backups/* .
check ERPNext version¶
cd /opt/bitnami/erpnext/frappe-bench
bench version
migrate ERPNext to new server¶
backup complete machine¶
come on, you know how to do that image..
check the current version¶
cd /opt/bitnami/erpnext/frappe-bench
bench version
bench --version
upgrade ERPNext¶
taken from: https://docs.bitnami.com/general/apps/erpnext/administration/upgrade/
Executing the following commands as bitnami user or the user who installed the application:
this may also help: https://medium.com/@prasantpant141/update-your-frappe-to-specific-latest-version-a08689fcd296
cd /opt/bitnami/erpnext/frappe-bench/apps/erpnext
. ../../../venv/bin/activate
bench update
deactivate
bench --site erpnext migrate
maybe it is necessary to update pip
and/or frappe-bench
to make it happen:
cd /opt/bitnami/erpnext/frappe-bench
pip install --upgrade pip
pip3 install --upgrade frappe-bench
troubleshoot¶
the update from v14.16 upwards seem to miss 2 log-files.
cd /opt/bitnami/erpnext/frappe-bench/logs
sudo touch database.log
sudo chown daemon:daemon database.log
sudo chmod 666 database.log
cd /opt/bitnami/erpnext/frappe-bench/sites/erpnext/logs
sudo touch database.log
sudo chown daemon:daemon database.log
sudo chmod 666 database.log
backup¶
see also: https://medium.com/@anjanadhakal09/erpnext-frappe-backup-and-restore-in-new-site-4aa908dc3fb0
cd /opt/bitnami/erpnext/frappe-bench
bench --site all backup --with-files
files are saved very deep
cd /opt/bitnami/erpnext/frappe-bench/sites/erpnext/private/backups/
restore¶
also have a look at:- https://frappeframework.com/docs/user/en/bench/reference/restore
- https://serverok.in/erpnext-restore-backup
copy files to new server into /home/bitnami
cd /opt/bitnami/erpnext/frappe-bench/
bench --site erpnext restore /home/bitnami/yyyymmdd_hhmmss-erpnext-database.sql.gz --with-public-files /home/bitnami/yyyymmdd_hhmmss-erpnext-files.tar --with-private-files /home/bitnami/yyyymmdd_hhmmss-erpnext-private-files.tar
bench --site erpnext migrate
vanilla install based on Ubuntu¶
backup and load into test-site¶
also have a look at: https://www.it-management-kirchberger.at/manuals-tutorials/server-centos-7/erpnext/todo.html
To create a staging site from a production site backup:
cd <frappe/erpnext Verzeichnis>
mkdir ~/backup/
bench --site prod.example.net set-maintenance-mode on
bench --site prod.example.net set-config pause_scheduler 1
bench --site prod.example.net backup --with-files --compress --backup-path ~/backup/
# notice: Database Public & Private from stdout
bench --site prod.example.net set-maintenance-mode off
restore into other Staging instance:
bench new-site staging.example.net
bench --site staging.example.net set-maintenance-mode on
bench --site staging.example.net restore ~/backup/YYYYMMDD_HHMMSS-prod.example.net-database.sql.gz
--with-public-files ~/backup/YYYYMMDD_HHMMSS-prod.example.net-files.tar.gz
--with-private-files ~/backup/YYYYMMDD_HHMMSS-prod.example.net-private-files.tar.gz
MySQL root password:
bench --site staging.example.net mute_emails true
bench --site staging.example.net set-maintenance-mode off
rm -r ~/backup/
Von Jeremias Keihsler vor etwa 1 Jahr aktualisiert · 63 Revisionen