@@ -690,19 +690,19 @@ Create directories required to store data, backups and archives:
690690
691691* Create the directory */mnt/diskbackup/backup*:
692692
693- If an optional dedicated disk was created for the backup (different than disk for home) :
693+ If you have not a dedicated disk for backup :
694694
695695[source, bash]
696696---------------
697- mkdir /mnt/diskbackup/backup
697+ mkdir /mnt/diskhome/backup; chown admin /mnt/diskhome/backup;
698+ ln -fs /mnt/diskhome/backup /mnt/diskbackup
698699---------------
699700
700- If you have not a dedicated disk for backup:
701+ And if an optional dedicated disk was created for the backup (different than disk for home) :
701702
702703[source, bash]
703704---------------
704- mkdir /mnt/diskhome/backup; chown admin /mnt/diskhome/backup;
705- ln -fs /mnt/diskhome/backup /mnt/diskbackup
705+ mkdir /mnt/diskbackup/backup
706706---------------
707707
708708* Create the other directories on the *Deployment* servers:
@@ -3676,15 +3676,15 @@ You must have inside the cron of user *admin* (You can view the cron with *cront
36763676---------------
36773677# m h dom mon dow command
36783678# cron master admin
3679- */10 * * * * /home/admin/wwwroot/dolibarr/scripts/cron/cron_run_jobs.php <securitykeydefinedinscheduledjobsetup> anonymousbatch >> /home/admin/wwwroot/dolibarr_documents/cron_run_jobs.php.log 2>&1
3679+ */10 * * * * [ "$(hostname -I | awk '{print $1}')" = "ip.of.master.server" ] && /home/admin/wwwroot/dolibarr/scripts/cron/cron_run_jobs.php <securitykeydefinedinscheduledjobsetup> anonymousbatch >> /home/admin/wwwroot/dolibarr_documents/cron_run_jobs.php.log 2>&1
368036805 5 * * * /home/admin/wwwroot/dolibarr/htdocs/custom/sellyoursaas/scripts/batch_customers.php updatestatsonly >> /home/admin/logs/batch_customers-updatedatabase.log 2>&1
368136817 7 * * * /home/admin/wwwroot/dolibarr/htdocs/custom/sellyoursaas/scripts/git_update_sources.sh /home/admin/wwwroot/dolibarr_documents/sellyoursaas/git >> /home/admin/logs/git_update_sources.log 2>&1
36823682# cron master and deployment admin
36833683#7 7 * * * /home/admin/wwwroot/dolibarr/htdocs/custom/sellyoursaas/scripts/git_update_sellyoursaas.sh /home/admin/wwwroot >> /home/admin/logs/git_update_sellyoursaas.log 2>&1
368436845 0 * * * /home/admin/wwwroot/dolibarr/htdocs/custom/sellyoursaas/scripts/batch_customers.php backupdelete >> /home/admin/logs/batch_customers-backup.log 2>&1
36853685---------------
36863686
3687- Note: *securitykeydefinedinscheduledjobsetup* is the value of the key to decide. And *anonymousbatch* is the user dedicated for batch processing. You will set them
3687+ Note: *ip.of.master.server* is the IP of the server so if you clone the server on another instance with another IP, you are sure the batch won't be executed on the new server without a manual change here, * securitykeydefinedinscheduledjobsetup* is the value of the key to decide. And *anonymousbatch* is the user dedicated for batch processing. You will set them
36883688later on the Dolibarr master.
36893689
36903690
@@ -3714,6 +3714,26 @@ You must have inside the cron of user *admin* (You can view the cron with *cront
37143714---------------
37153715
37163716
3717+ ==== On master and deployment server
3718+
3719+ Add a protection to disable cron tasks if IP of server has changed so if you clone the server on another instance with another IP, you are sure the batch won't be executed on the new server without a manual change here.
3720+
3721+ Create a copy of the cron service override file */etc/systemd/system/cron.service.d/override.conf*:
3722+
3723+ [source,bash]
3724+ ---------------
3725+ mkdir /etc/systemd/system/cron.service.d;
3726+ cp /home/admin/wwwroot/dolibarr/htdocs/custom/sellyoursaas/etc/systemd/system/cron.service.d/override.conf /etc/systemd/system/cron.service.d/override.conf
3727+ ---------------
3728+
3729+ Then edit the file to change the allowed IP
3730+
3731+ [source,bash]
3732+ ---------------
3733+ vi /etc/systemd/system/cron.service.d/override.conf
3734+ ---------------
3735+
3736+
37173737==== Check that launching of cron is ok
37183738
37193739Take from */etc/crontab* the commands for testing daily, weekly and monthly crontab launches and test by launching manually. For example, with:
@@ -4792,13 +4812,43 @@ glance image-download --file image-myfile-server1.qcow2 aaab785d-8a34-40f5-bdcd-
47924812 ou openstack image save --file image-myfile-server1.qcow2 aaab785d-8a34-40f5-bdcd-0a3c3c350c5a
47934813---------------
47944814
4815+ To make image smaller
4816+
4817+ [source,bash]
4818+ ---------------
4819+ qemu-img info image-myfile-server1.qcow2
4820+
4821+ modprobe nbd max_part=16
4822+ qemu-nbd -c /dev/nbd0 image-myfile-server1.qcow2
4823+
4824+ fdisk -l /dev/nbd0
4825+ mkdir /mnt/myimg;
4826+
4827+ mount /dev/nbd0p1 /mnt/myimg
4828+ rm -rf /mnt/myimg/tmp/*
4829+ rm -f /mnt/myimg/var/log/*.gz /mnt/myimg/var/log/*.log /mnt/myimg/var/log/journal/*
4830+ umount /mnt/myimg
4831+
4832+ zerofree -v /dev/nbd0p1
4833+
4834+ mount /dev/nbd0p1 /mnt/myimg
4835+ ls /mnt/myimg
4836+ umount /mnt/myimg
4837+
4838+ qemu-nbd -d /dev/nbd0
4839+ qemu-img convert -O qcow2 -c image-myfile-server1.qcow2 image-myfile-server1-compacted.qcow2
4840+ qemu-img info image-myfile-server1.qcow2
4841+ ---------------
4842+
4843+
47954844To push an instance's image on a project:
47964845
47974846[source,bash]
47984847---------------
47994848source openrctarget.sh
48004849export OS_REGION_NAME=SBG1
48014850glance image-create --name nom_image_snaphot_new_server --disk-format qcow2 --container-format bare --file mon_fichier_snap_serveur1.qcow2
4851+ ou openstack image create --disk-format qcow2 --container-format bare --file votre_image_compacte.qcow2 --public "Nom de votre image"
48024852---------------
48034853
48044854To build a volume image, you need to create it from the detached volume (can't use a snapshot)
@@ -4825,6 +4875,7 @@ To push an image on a project:
48254875
48264876
48274877- To restore
4878+
48284879openstack server create --flavor FLAVOR_ID --image BACKUP_IMAGE_ID --nic net-id=NETWORK_ID INSTANCE_NAME
48294880
48304881
0 commit comments