Projekt

Allgemein

Profil

ERPNext14 » Historie » Revision 12

Revision 11 (Jeremias Keihsler, 07.02.2023 23:14) → Revision 12/64 (Jeremias Keihsler, 16.02.2023 10:44)

h1. ERPNext 14 

 h2. Bitnami based on Debian 11 

 out of the box ERPNext is installed. This describes what else can/needs to be done: 

 h3. convert VirtualBox-ova to be used with KVM 

 untar @.ova@ 

 <pre><code class="shell"> 
 tar xvf bitnami-erpnext-14.11.0-0-linux-vm-debian-11-x86_64-nami.ova 
 </code></pre> 

 convert @.vmdk@ to @.qcow2@ while showing 'progress' 

 <pre><code class="shell"> 
 qemu-img convert -p -f vmdk -O qcow2 \ 
   bitnami-erpnext-14.11.0-0-linux-vm-debian-11-x86_64-nami-disk1.vmdk \ 
   bitnami-erpnext-14.11.0-0-linux-vm-debian-11-x86_64-nami-disk1.qcow2 
 </code></pre> 

 this is a sample virsh dumpxml with a bridged interface 

 <pre><code class="xml"> 
 <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> 
 </code></pre> 

 h3. set static IP address 

 taken from https://docs.bitnami.com/virtual-machine/faq/configuration/configure-static-address/ 

 check link and current IPs 

 <pre><code class="shell"> 
 sudo ifconfig 
 </code></pre> 

 <pre><code class="shell"> 
 cd /etc/systemd/network 
 sudo touch 25-wired.network 
 </code></pre> 

 add following lines 

 <pre> 
 [Match] 
 Name=enp0s3 

 [Network] 
 Address=HOST-IP-ADDRESS 
 Gateway=GATEWAY-IP-ADDRESS 
 </pre> 

 restart service 

 <pre><code class="shell"> 
 sudo systemctl restart systemd-networkd.service 
 </code></pre> 

 h3. activate SSH-Server 

 taken from https://docs.bitnami.com/virtual-machine/faq/get-started/enable-ssh/ 

 <pre><code class="shell"> 
 sudo rm -f /etc/ssh/sshd_not_to_be_run 
 sudo systemctl enable ssh 
 sudo systemctl start ssh 
 </code></pre> 

 h3. ... 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 

 <pre><code class="shell"> 
   PasswordAuthentication yes 
 </code></pre> 

 restart SSH server 

 <pre><code class="shell"> 
   sudo /etc/init.d/ssh force-reload 
   sudo /etc/init.d/ssh restart 
 </code></pre> 

 h3. modify keyboard layout 

 taken from https://docs.bitnami.com/virtual-machine/faq/configuration/configure-keyboard/ 

 <pre><code class="shell"> 
   sudo apt-get install keyboard-configuration console-setup 
   sudo dpkg-reconfigure keyboard-configuration 
   sudo systemctl restart keyboard-setup 
 </code></pre> 

 h3. alias ll 

 for everyone .. taken from https://www.server-world.info/en/note?os=Debian_11&p=initial_conf&f=2 

 <pre><code class="shell"> 
 sudo vim /etc/profile.d/command_alias.sh 
 </code></pre> 

 <pre> 
 # 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' 
 </pre> 

 <pre><code class="shell"> 
 source /etc/profile.d/command_alias.sh 
 </code></pre> 

 h3. migrate ERPNext to new server 

 h4. backup 

 <pre><code class="shell"> 
 cd /opt/bitnami/erpnext/frappe-bench 
 bench backup-all-sites 
 </code></pre> 

 files are saved very deep 

 <pre><code class="shell"> 
 cd /opt/bitnami/erpnext/frappe-bench/sites/erpnext/private/backups/ 
 </code></pre> 

 h4. restore 

 copy files to new server into @/home/bitnami@ 

 <pre><code class="shell"> 
 gunzip yyyymmdd_hhmmss-erpnext-database.sql.gz 
 </code></pre> 

 connect to MariaDB (password is the same as application-password) 
 taken from https://docs.bitnami.com/general/apps/erpnext/get-started/connect-mariadb/ 

 <pre><code class="shell"> 
 mysql -u root -p 
 </code></pre> 

 <pre><code class="sql"> 
 DROP DATABASE bitnami_erpnext; 
 \q 
 </code></pre> 

 *as of 2023-02-07 restore seems not to work following the instructions* 

 <pre><code class="shell"> 
 cd /opt/bitnami/erpnext/frappe-bench/ 
 bench restore /home/bitnami 
 </code></pre> 

 h2. vanilla install based on Ubuntu 

 h3. backup and load into test-site 

 To create a staging site from a production site backup: 

 <pre><code class="shell"> 
 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/ 
 </code></pre>