@@ -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,19 @@ 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 link to the service file */etc/systemd/system/sellyoursaas-disable-cron-if-wrong-ip.service*:
3722+
3723+ [source,bash]
3724+ ---------------
3725+ cd /etc/systemd/system;
3726+ ln -fs /home/admin/wwwroot/dolibarr/htdocs/custom/sellyoursaas/etc/systemd/system/sellyoursaas-disable-cron-if-wrong-ip.service
3727+ ---------------
3728+
3729+
37173730==== Check that launching of cron is ok
37183731
37193732Take from */etc/crontab* the commands for testing daily, weekly and monthly crontab launches and test by launching manually. For example, with:
@@ -4792,13 +4805,43 @@ glance image-download --file image-myfile-server1.qcow2 aaab785d-8a34-40f5-bdcd-
47924805 ou openstack image save --file image-myfile-server1.qcow2 aaab785d-8a34-40f5-bdcd-0a3c3c350c5a
47934806---------------
47944807
4808+ To make image smaller
4809+
4810+ [source,bash]
4811+ ---------------
4812+ qemu-img info image-myfile-server1.qcow2
4813+
4814+ modprobe nbd max_part=16
4815+ qemu-nbd -c /dev/nbd0 image-myfile-server1.qcow2
4816+
4817+ fdisk -l /dev/nbd0
4818+ mkdir /mnt/myimg;
4819+
4820+ mount /dev/nbd0p1 /mnt/myimg
4821+ rm -rf /mnt/myimg/tmp/*
4822+ rm -f /mnt/myimg/var/log/*.gz /mnt/myimg/var/log/*.log /mnt/myimg/var/log/journal/*
4823+ umount /mnt/myimg
4824+
4825+ zerofree -v /dev/nbd0p1
4826+
4827+ mount /dev/nbd0p1 /mnt/myimg
4828+ ls /mnt/myimg
4829+ umount /mnt/myimg
4830+
4831+ qemu-nbd -d /dev/nbd0
4832+ qemu-img convert -O qcow2 -c image-myfile-server1.qcow2 image-myfile-server1-compacted.qcow2
4833+ qemu-img info image-myfile-server1.qcow2
4834+ ---------------
4835+
4836+
47954837To push an instance's image on a project:
47964838
47974839[source,bash]
47984840---------------
47994841source openrctarget.sh
48004842export OS_REGION_NAME=SBG1
48014843glance image-create --name nom_image_snaphot_new_server --disk-format qcow2 --container-format bare --file mon_fichier_snap_serveur1.qcow2
4844+ ou openstack image create --disk-format qcow2 --container-format bare --file votre_image_compacte.qcow2 --public "Nom de votre image"
48024845---------------
48034846
48044847To build a volume image, you need to create it from the detached volume (can't use a snapshot)
@@ -4825,6 +4868,7 @@ To push an image on a project:
48254868
48264869
48274870- To restore
4871+
48284872openstack server create --flavor FLAVOR_ID --image BACKUP_IMAGE_ID --nic net-id=NETWORK_ID INSTANCE_NAME
48294873
48304874
0 commit comments