Projekt

Allgemein

Profil

ERPNext14 » Historie » Version 30

Jeremias Keihsler, 12.10.2023 13:10

1 1 Jeremias Keihsler
h1. ERPNext 14
2
3
h2. Bitnami based on Debian 11
4
5
out of the box ERPNext is installed. This describes what else can/needs to be done:
6
7
h3. convert VirtualBox-ova to be used with KVM
8
9
untar @.ova@
10
11
<pre><code class="shell">
12
tar xvf bitnami-erpnext-14.11.0-0-linux-vm-debian-11-x86_64-nami.ova
13
</code></pre>
14
15
convert @.vmdk@ to @.qcow2@ while showing 'progress'
16
17
<pre><code class="shell">
18
qemu-img convert -p -f vmdk -O qcow2 \
19
  bitnami-erpnext-14.11.0-0-linux-vm-debian-11-x86_64-nami-disk1.vmdk \
20
  bitnami-erpnext-14.11.0-0-linux-vm-debian-11-x86_64-nami-disk1.qcow2
21
</code></pre>
22
23
this is a sample virsh dumpxml with a bridged interface
24
25
<pre><code class="xml">
26
<domain type="kvm" id="7">
27 2 Jeremias Keihsler
  <name>bitnami_erpnext</name>
28
  <uuid>acf57964-b3d8-4148-9391-b4552a72a32c</uuid>
29
  <metadata>
30
    <libosinfo:libosinfo>
31
    <libosinfo:os id="http://debian.org/debian/11"/>
32
    </libosinfo:libosinfo>
33
  </metadata>
34
  <memory unit="KiB">4194304</memory>
35
  <currentMemory unit="KiB">4194304</currentMemory>
36
  <vcpu placement="static">2</vcpu>
37
  <resource>
38
    <partition>/machine</partition>
39
  </resource>
40
  <os>
41
    <type arch="x86_64" machine="pc-i440fx-rhel7.0.0">hvm</type>
42
    <boot dev="hd"/>
43
    <bootmenu enable="yes"/>
44
  </os>
45
  <features>
46
    <acpi/>
47
    <apic/>
48
  </features>
49
  <cpu mode="host-passthrough" check="none">
50
    <topology sockets="1" cores="1" threads="2"/>
51
  </cpu>
52
  <clock offset="utc">
53
    <timer name="rtc" tickpolicy="catchup"/>
54
    <timer name="pit" tickpolicy="delay"/>
55
    <timer name="hpet" present="no"/>
56
  </clock>
57
  <on_poweroff>destroy</on_poweroff>
58
  <on_reboot>restart</on_reboot>
59
  <on_crash>destroy</on_crash>
60
  <pm>
61
    <suspend-to-mem enabled="no"/>
62
    <suspend-to-disk enabled="no"/>
63
  </pm>
64
  <devices>
65
    <emulator>/usr/libexec/qemu-kvm</emulator>
66
    <disk type="file" device="disk">
67
      <driver name="qemu" type="qcow2"/>
68
      <source file="/../libvirt/images/bitnami-erpnext-14.11.0-0-linux-vm-debian-11-x86_64-nami-disk1.qcow2"/>
69
      <backingStore/>
70
      <target dev="vdb" bus="virtio"/>
71
      <alias name="virtio-disk1"/>
72
      <address type="pci" domain="0x0000" bus="0x00" slot="0x0b" function="0x0"/>
73
    </disk>
74
    <controller type="usb" index="0" model="ich9-ehci1">
75
      <alias name="usb"/>
76
      <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x7"/>
77
    </controller>
78
    <controller type="usb" index="0" model="ich9-uhci1">
79
      <alias name="usb"/>
80
      <master startport="0"/>
81
      <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x0" multifunction="on"/>
82
    </controller>
83
    <controller type="usb" index="0" model="ich9-uhci2">
84
      <alias name="usb"/>
85
      <master startport="2"/>
86
      <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x1"/>
87
    </controller>
88
    <controller type="usb" index="0" model="ich9-uhci3">
89
      <alias name="usb"/>
90
      <master startport="4"/>
91
      <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x2"/>
92
    </controller>
93
    <controller type="pci" index="0" model="pci-root">
94
      <alias name="pci.0"/>
95
    </controller>
96
    <controller type="virtio-serial" index="0">
97
      <alias name="virtio-serial0"/>
98
      <address type="pci" domain="0x0000" bus="0x00" slot="0x06" function="0x0"/>
99
    </controller>
100
    <controller type="scsi" index="0" model="virtio-scsi">
101
      <alias name="scsi0"/>
102
      <address type="pci" domain="0x0000" bus="0x00" slot="0x0a" function="0x0"/>
103
    </controller>
104
    <interface type="bridge">
105
      <mac address="52:54:00:29:00:87"/>
106
      <source bridge="br0"/>
107
      <target dev="vnet1"/>
108
      <model type="virtio"/>
109
      <alias name="net0"/>
110
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0"/>
111
    </interface>
112
    <serial type="pty">
113
      <source path="/dev/pts/9"/>
114
      <target type="isa-serial" port="0">
115
        <model name="isa-serial"/>
116
      </target>
117
      <alias name="serial0"/>
118
    </serial>
119
    <console type="pty" tty="/dev/pts/9">
120
      <source path="/dev/pts/9"/>
121
      <target type="serial" port="0"/>
122
      <alias name="serial0"/>
123
    </console>
124
    <channel type="unix">
125
      <source mode="bind" path="/var/lib/libvirt/qemu/channel/target/domain-7-bitnami_erpnext/org.qemu.guest_agent.0"/>
126
      <target type="virtio" name="org.qemu.guest_agent.0" state="disconnected"/>
127
      <alias name="channel0"/>
128
      <address type="virtio-serial" controller="0" bus="0" port="1"/>
129
    </channel>
130
    <channel type="spicevmc">
131
      <target type="virtio" name="com.redhat.spice.0" state="disconnected"/>
132
      <alias name="channel1"/>
133
      <address type="virtio-serial" controller="0" bus="0" port="2"/>
134
    </channel>
135
    <input type="tablet" bus="usb">
136
      <alias name="input0"/>
137
      <address type="usb" bus="0" port="1"/>
138
    </input>
139
    <input type="mouse" bus="ps2">
140
      <alias name="input1"/>
141
    </input>
142
    <input type="keyboard" bus="ps2">
143
      <alias name="input2"/>
144
    </input>
145
    <graphics type="spice" port="5901" autoport="yes" listen="127.0.0.1">
146
      <listen type="address" address="127.0.0.1"/>
147
    </graphics>
148
    <sound model="ich6">
149
      <alias name="sound0"/>
150
      <address type="pci" domain="0x0000" bus="0x00" slot="0x04" function="0x0"/>
151
    </sound>
152
    <video>
153
      <model type="qxl" ram="65536" vram="65536" vgamem="16384" heads="1" primary="yes"/>
154
      <alias name="video0"/>
155
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
156
    </video>
157
    <redirdev bus="usb" type="spicevmc">
158
      <alias name="redir0"/>
159
      <address type="usb" bus="0" port="2"/>
160
    </redirdev>
161
    <redirdev bus="usb" type="spicevmc">
162
      <alias name="redir1"/>
163
      <address type="usb" bus="0" port="3"/>
164
    </redirdev>
165
    <memballoon model="virtio">
166
      <alias name="balloon0"/>
167
      <address type="pci" domain="0x0000" bus="0x00" slot="0x08" function="0x0"/>
168
    </memballoon>
169
    <rng model="virtio">
170
      <backend model="random">/dev/urandom</backend>
171
      <alias name="rng0"/>
172
      <address type="pci" domain="0x0000" bus="0x00" slot="0x09" function="0x0"/>
173
    </rng>
174
  </devices>
175
  <seclabel type="dynamic" model="selinux" relabel="yes">
176
    <label>system_u:system_r:svirt_t:s0:c328,c377</label>
177
    <imagelabel>system_u:object_r:svirt_image_t:s0:c328,c377</imagelabel>
178
  </seclabel>
179
  <seclabel type="dynamic" model="dac" relabel="yes">
180
    <label>+107:+107</label>
181
    <imagelabel>+107:+107</imagelabel>
182
  </seclabel>
183 1 Jeremias Keihsler
</domain>
184
</code></pre>
185
186 12 Jeremias Keihsler
h3. set static IP address
187
188
taken from https://docs.bitnami.com/virtual-machine/faq/configuration/configure-static-address/
189
190
check link and current IPs
191
192
<pre><code class="shell">
193
sudo ifconfig
194
</code></pre>
195
196
<pre><code class="shell">
197
cd /etc/systemd/network
198
sudo touch 25-wired.network
199
</code></pre>
200
201
add following lines
202
203
<pre>
204
[Match]
205 30 Jeremias Keihsler
Name=ens3
206 12 Jeremias Keihsler
207
[Network]
208
Address=HOST-IP-ADDRESS
209
Gateway=GATEWAY-IP-ADDRESS
210
</pre>
211
212
restart service
213
214
<pre><code class="shell">
215 1 Jeremias Keihsler
sudo systemctl restart systemd-networkd.service
216 30 Jeremias Keihsler
sudo systemctl enable systemd-networkd
217 12 Jeremias Keihsler
</code></pre>
218
219 2 Jeremias Keihsler
h3. activate SSH-Server
220 1 Jeremias Keihsler
221 2 Jeremias Keihsler
taken from https://docs.bitnami.com/virtual-machine/faq/get-started/enable-ssh/
222 1 Jeremias Keihsler
223 2 Jeremias Keihsler
<pre><code class="shell">
224
sudo rm -f /etc/ssh/sshd_not_to_be_run
225
sudo systemctl enable ssh
226
sudo systemctl start ssh
227
</code></pre>
228 1 Jeremias Keihsler
229 3 Jeremias Keihsler
h3. ... password-based SSH auth (are you serious?)
230
231
maybe ok for testing .. 
232
taken from https://docs.bitnami.com/virtual-machine/faq/get-started/enable-ssh-password/
233
234
edit @/etc/ssh/sshd_config@ and add/modify the following line
235
236
<pre><code class="shell">
237
  PasswordAuthentication yes
238
</code></pre>
239
240
restart SSH server
241
242
<pre><code class="shell">
243
  sudo /etc/init.d/ssh force-reload
244
  sudo /etc/init.d/ssh restart
245
</code></pre>
246
247 28 Jeremias Keihsler
h3. ... and of course cert-based ..
248
249
from the remote machine just
250
251
<pre><code class="shell">
252
ssh-copy-id bitnami@example.com
253
</code></pre>
254
255
256 17 Jeremias Keihsler
h3. install 'dialog'
257
258
<pre><code class="shell">
259
sudo apt install dialog
260
</code></pre>
261
262 4 Jeremias Keihsler
h3. modify keyboard layout
263
264
taken from https://docs.bitnami.com/virtual-machine/faq/configuration/configure-keyboard/
265
266
<pre><code class="shell">
267
  sudo apt-get install keyboard-configuration console-setup
268
  sudo dpkg-reconfigure keyboard-configuration
269
  sudo systemctl restart keyboard-setup
270
</code></pre>
271
272 5 Jeremias Keihsler
h3. alias ll
273
274 6 Jeremias Keihsler
for everyone .. taken from https://www.server-world.info/en/note?os=Debian_11&p=initial_conf&f=2
275
276 5 Jeremias Keihsler
<pre><code class="shell">
277
sudo vim /etc/profile.d/command_alias.sh
278
</code></pre>
279
280
<pre>
281
# create new file
282
# add alias you'd like to set
283
alias ll='ls $LS_OPTIONS -l'
284
# alias l='ls $LS_OPTIONS -lA'
285
# alias rm='rm -i'
286
# alias cp='cp -i'
287
# alias mv='mv -i'
288
</pre>
289
290
<pre><code class="shell">
291
source /etc/profile.d/command_alias.sh
292
</code></pre>
293
294 13 Jeremias Keihsler
h3. Install the Wkhtmltopdf extension
295
296
taken from https://docs.bitnami.com/aws/apps/erpnext/configuration/install-wkhtmltopdf/
297
298
<pre><code class="shell">
299
find /opt/bitnami/common/bin -name fc-* | sudo xargs -I {} mv {} {}.bak
300 22 Jeremias Keihsler
sudo apt install zlib1g fontconfig libxrender1 libfreetype6 libxext6 libx11-6
301 14 Jeremias Keihsler
</code></pre>
302
303
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.
304
305
https://github.com/wkhtmltopdf/wkhtmltopdf/releases/
306
307 15 Jeremias Keihsler
as of 2023-02-16 https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb
308
309 14 Jeremias Keihsler
<pre><code class="shell">
310 13 Jeremias Keihsler
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/X.Y.Z/wkhtmltox_X.Y.Z.PLATFORM.deb
311
sudo apt install -f ./wkhtmltox_X.Y.Z.PLATFORM.deb
312
sudo /opt/bitnami/ctlscript.sh restart
313
</code></pre>
314
315 21 Jeremias Keihsler
h4. install alternative way?
316
317
without QT but with virtual X11-Server
318
319
https://packages.debian.org/bullseye/xvfb
320
https://installati.one/debian/11/wkhtmltopdf/
321
https://packages.debian.org/stable/wkhtmltopdf
322
323
needs some testing
324
325 23 Jeremias Keihsler
h4. Troubleshooting PDF formating issues
326 18 Jeremias Keihsler
327
taken from https://discuss.frappe.io/t/pdf-alignment-problem/34425/7
328
329
set the IP-adr. in @site_config.json@
330
331
<pre><code class="shell">
332
vim /opt/bitnami/erpnext/frappe-bench/sites/erpnext/site_config.json
333
</code></pre>
334
335 24 Jeremias Keihsler
replace @http:localhost@ with the @https://hostname-ip:443@
336 18 Jeremias Keihsler
337
<pre>
338 24 Jeremias Keihsler
 "host_name": "https://192.168.41.131:443"
339 18 Jeremias Keihsler
</pre>
340
341 20 Jeremias Keihsler
h4. Troubleshooting (is just a reminder ... I stumbled across but didn't do it, as there were no related issues yet)
342 13 Jeremias Keihsler
343
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:
344
345
<pre><code class="shell">
346
sudo dpkg --remove --force-depends xfonts-75dpi
347
sudo dpkg --remove --force-depends xfonts-100dpi
348 18 Jeremias Keihsler
</code></pre>
349 13 Jeremias Keihsler
350 16 Jeremias Keihsler
h3. install weasyprint
351
352
taken from https://packages.debian.org/bullseye/weasyprint
353
354
<pre><code class="shell">
355
sudo apt install weasyprint
356
</code></pre>
357
358 29 Jeremias Keihsler
h3. automatic backup of ERPNext
359 25 Jeremias Keihsler
360
<pre><code class="shell">
361
sudo vim /usr/local/bin/erpnext-backup.sh
362
</code></pre>
363
364
<pre><code class="shell">
365 26 Jeremias Keihsler
#!/bin/bash -l
366 1 Jeremias Keihsler
367 26 Jeremias Keihsler
# there is some 'magic' in the shebang, the '-l' is invoking the environment of the calling user (in this case 'bitnami')
368 1 Jeremias Keihsler
# JKE 2023-08-24
369 25 Jeremias Keihsler
cd /opt/bitnami/erpnext/frappe-bench
370 26 Jeremias Keihsler
bench backup-all-sites
371 25 Jeremias Keihsler
</code></pre>
372
373
<pre><code class="shell">
374
sudo chmod +x /usr/local/bin/erpnext-backup.sh
375 1 Jeremias Keihsler
</code></pre>
376
377 26 Jeremias Keihsler
<pre><code class="shell">
378
sudo vim /etc/cron.d/erpnext-backup
379
</code></pre>
380 1 Jeremias Keihsler
381 26 Jeremias Keihsler
<pre><code class="shell">
382
# JKE 2023-08-24
383
#
384
#    min  hr   dom  month dow     user    command
385
#    -    -    -    -     -
386
#    |    |    |    |     |
387
#    |    |    |    |     +-day of week (0-7) sunday=0 or 7
388
#    |    |    |    +---------month (1-12)
389
#    |    |    +----------------day of month (1-31)
390
#    |    +-----------------------hour (0-23)
391
#    +------------------------------min (0-59)
392
#
393
#     32   13   *    *     *       bitnami  /usr/local/bin/erpnext-backup.sh >> /home/bitnami/erpnext-backup.log 2>&1
394
     15   18   *    *     *       bitnami  /usr/local/bin/erpnext-backup.sh
395
</code></pre>
396
397
here is again some 'magic', there is no MTA available. So any output from the cron-job gets discarded.
398
use the upper construct to debug and append the output to @/home/bitnami/erpnext-backup.log@
399 25 Jeremias Keihsler
400 1 Jeremias Keihsler
the backups are stored in @/opt/bitnami/erpnext/frappe-bench/sites/erpnext/private/backups@
401 29 Jeremias Keihsler
402
h4. retrieve backups from external machine
403
404
rsync is not installed by default ..
405
406
<pre><code class="shell">
407
sudo apt-get install rsync
408
</code></pre>
409
410
from the external machine, just invoke like
411
412
<pre><code class="shell">
413
rsync --verbose --progress --stats --recursive bitnami@example.com:/opt/bitnami/erpnext/frappe-bench/sites/erpnext/private/backups/* .
414
</code></pre>
415
416 16 Jeremias Keihsler
417 7 Jeremias Keihsler
h3. migrate ERPNext to new server
418 1 Jeremias Keihsler
419 7 Jeremias Keihsler
h4. backup
420
421 5 Jeremias Keihsler
<pre><code class="shell">
422
cd /opt/bitnami/erpnext/frappe-bench
423 1 Jeremias Keihsler
bench backup-all-sites
424 7 Jeremias Keihsler
</code></pre>
425
426
files are saved very deep
427
428
<pre><code class="shell">
429
cd /opt/bitnami/erpnext/frappe-bench/sites/erpnext/private/backups/
430
</code></pre>
431
432
h4. restore
433
434
copy files to new server into @/home/bitnami@
435
436
<pre><code class="shell">
437
gunzip yyyymmdd_hhmmss-erpnext-database.sql.gz
438
</code></pre>
439
440 1 Jeremias Keihsler
connect to MariaDB (password is the same as application-password)
441 8 Jeremias Keihsler
taken from https://docs.bitnami.com/general/apps/erpnext/get-started/connect-mariadb/
442 7 Jeremias Keihsler
443
<pre><code class="shell">
444
mysql -u root -p
445
</code></pre>
446
447 1 Jeremias Keihsler
<pre><code class="sql">
448
DROP DATABASE bitnami_erpnext;
449 8 Jeremias Keihsler
\q
450
</code></pre>
451
452 9 Jeremias Keihsler
*as of 2023-02-07 restore seems not to work following the instructions*
453
454 8 Jeremias Keihsler
<pre><code class="shell">
455
cd /opt/bitnami/erpnext/frappe-bench/
456 5 Jeremias Keihsler
bench restore /home/bitnami
457
</code></pre>
458 1 Jeremias Keihsler
459
h2. vanilla install based on Ubuntu
460 10 Jeremias Keihsler
461 11 Jeremias Keihsler
h3. backup and load into test-site
462 10 Jeremias Keihsler
463
To create a staging site from a production site backup:
464
465
<pre><code class="shell">
466
cd <frappe/erpnext Verzeichnis>
467
mkdir ~/backup/
468
469
bench --site prod.example.net set-maintenance-mode on
470
bench --site prod.example.net set-config pause_scheduler 1
471
bench --site prod.example.net backup --with-files --compress --backup-path ~/backup/ 
472
# notice: Database Public & Private from stdout
473
bench --site prod.example.net set-maintenance-mode off
474
475
restore into other Staging instance:
476
477
bench new-site staging.example.net
478
bench --site staging.example.net set-maintenance-mode on
479
480
bench --site staging.example.net restore ~/backup/YYYYMMDD_HHMMSS-prod.example.net-database.sql.gz
481
  --with-public-files  ~/backup/YYYYMMDD_HHMMSS-prod.example.net-files.tar.gz
482
  --with-private-files ~/backup/YYYYMMDD_HHMMSS-prod.example.net-private-files.tar.gz
483
  MySQL root password:
484
485
bench --site staging.example.net mute_emails true
486
bench --site staging.example.net set-maintenance-mode off
487
rm -r ~/backup/
488
</code></pre>