Table of Contents
Classic update
Introduction
The update process depends very much on the customisation that has been made to your Esia plugins.
The more plugins you have added, the greater the risk that these plugins will go into error after the update. It is therefore all the more important to respect the backup process in addition to the snapshot in order to avoid having to perform a rollback.
The rest of the tutorial covers :
- Prerequisites Necessary to start the update.
- Updating process Steps required to complete the update.
We strongly recommend that you read this tutorial in its entirety at least 1 time before starting the production update.
Prerequisites
Before starting the update, all of the following points must be met:
- Have an internet connection to download the update packages.
- Make a snapshot of the VM beforehand in order to quickly return to the previous state in the event of MAJOR problems.
- Make a backup of certain Esia files. To avoid having to rollback the snapshot in the event of a SMALL problem. This step is NECESSARY in the event of a support call. See point 3.1.1 « Make a backup of your Esia »
Update steps
Pre-update preparation
The following 3 steps should be carried out in the desired order.
Make a backup of your Esia
This will avoid having to return to the snapshot in the event of a simple plugin error or similar. Plugin errors are sometimes unavoidable and make this task necessary.
The steps are :
Check that you have enough disk space for the backup using the command :
- copy
df -h /root
The disk space required for the backup depends on your Esia. But if you use less than 50% of your disk space. You are sure to have enough.
- backup.sh
#!/bin/bash cd / mkdir -p /root/BACKUP_ESIA su postgres -c pg_dumpall > /root/BACKUP_ESIA/pg_database.sql cp -r /usr/local/esia/plugins /root/BACKUP_ESIA/plugins cp -r /usr/local/esia/public_html /root/BACKUP_ESIA/public_html cp -r /etc/apache2 /root/BACKUP_ESIA/apache2 cp -r /etc/esia /root/BACKUP_ESIA/esia_conf iptables-save > /root/BACKUP_ESIA/iptables.txt dpkg -l > /root/BACKUP_ESIA/version.txt
You can check whether the backup was successful by entering the following command:
- copy
du -sh /root/BACKUP_ESIA/*
Examples:
On a small esia
root@debian:~# cd / root@debian:/# mkdir -p /root/BACKUP_ESIA root@debian:/# su postgres -c pg_dumpall > /root/BACKUP_ESIA/pg_database.sql root@debian:/# cp -r /usr/local/esia/plugins /root/BACKUP_ESIA/plugins root@debian:/# cp -r /usr/local/esia/public_html /root/BACKUP_ESIA/public_html root@debian:/# cp -r /etc/apache2 /root/BACKUP_ESIA/apache2 root@debian:/# cp -r /etc/esia /root/BACKUP_ESIA/esia_conf root@debian:/# iptables-save > /root/BACKUP_ESIA/iptables.txt root@debian:/# dpkg -l > /root/BACKUP_ESIA/version.txt root@debian:/# du -sh /root/BACKUP_ESIA/* 652K /root/BACKUP_ESIA/apache2 32K /root/BACKUP_ESIA/esia_conf 4,0K /root/BACKUP_ESIA/iptables.txt 660K /root/BACKUP_ESIA/pg_database.sql 7.9M /root/BACKUP_ESIA/plugins 23M /root/BACKUP_ESIA/public_html 96K /root/BACKUP_ESIA/version.txt root@debian-jessie:/#
In case of error, files/directories are missing or empty
root@debian:/# cd / root@debian:/# mkdir -p /root/BACKUP_ESIA root@debian:/# su postgres -c pg_dumpall > /root/BACKUP_ESIA/pg_database.sql pg_dumpall: could not connect to database "template1": could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? root@debian:/# cp -r /usr/local/esia/plugins /root/BACKUP_ESIA/plugins root@debian:/# cp -r /usr/local/esia/public_html /root/BACKUP_ESIA/public_html root@debian:/# cp -r /etc/apache2 /root/BACKUP_ESIA/apache2 root@debian:/# cp -r /etc/esia /root/BACKUP_ESIA/esia_conf root@debian:/# iptables-save > /root/BACKUP_ESIA/iptables.txt root@debian:/# dpkg -l > /root/BACKUP_ESIA/version.txt root@debian-jessie:/# du -sh /root/BACKUP_ESIA/* 652K /root/BACKUP_ESIA/apache2 32K /root/BACKUP_ESIA/esia_conf 4,0K /root/BACKUP_ESIA/iptables.txt 0 /root/BACKUP_ESIA/pg_database.sql 7.9M /root/BACKUP_ESIA/plugins 23M /root/BACKUP_ESIA/public_html 96K /root/BACKUP_ESIA/version.txt root@debian-jessie:/#
Make a snapshot of the VM
In order to come back quickly in case of a complete crash.
Disable the alerting system
To avoid receiving false positives during the update.
- copy
chmod -x /usr/local/esia/plugins/alerting/*
Updating
Prepare the update:
Check that the Esia repository is present in your source file.
- copy
cat /etc/apt/sources.list
You should have this line in your
- copy
deb http://stable.repository.esia-sa.com/esia bullseye contrib non-free
Update the list of your packages with the following command
- copy
apt update
Example
root@debian-jessie:/# apt-get update Get:1 http://10.8.0.9 stretch InRelease [2,271 B] Get:2 http://10.8.0.9 stretch/contrib amd64 Packages [7,200 B] Get:3 http://10.8.0.9 stretch/non-free amd64 Packages [1,963 B] Ign http://10.8.0.9 stretch/contrib Translation-en_US Ign http://10.8.0.9 stretch/contrib Translation-en Ign http://10.8.0.9 stretch/non-free Translation-en_US Ign http://10.8.0.9 stretch/non-free Translation-en Ign http://ftp.be.debian.org stretch InRelease Get:4 http://ftp.be.debian.org stretch Release.gpg [2,410 B] Get:5 http://ftp.be.debian.org stretch Release [118 kB] Get:6 http://ftp.be.debian.org stretch/main amd64 Packages [7,080 kB] Get:7 http://ftp.be.debian.org stretch/main Translation-en [5,377 kB] Fetched 12.6 MB in 2s (4,354 kB/s) Reading package lists... Done root@debian-jessie:/#
Check the current state of your system:
Note what time it is.
Update the list of your packages with the following command
- copy
apt-get update
Run the update :
To download the ESIA + OS update
- copy
apt-get dist-upgrade
Before confirming, check that you have enough disk space:
In the example below, you will need 92 MB + 101 MB during installation.
125 upgraded, 1 newly installed, 4 to remove and 0 not upgraded. Need to get 92 MB of archives. After this operation, 101 MB of additional disk space will be used. Do you want to continue? [Y/n]
The apt program will now update your Esia and your operating system.
Once the update is complete, don't forget to reload your browser's cache.
Reactivate the alert system
Once your Esia is working properly, don't forget to reactivate the alerting system:
Activation :
- copy
chmod +x /usr/local/esia/plugins/alerting/*
Check if it is activated :
- copy
ls --color -l /usr/local/esia/plugins/alerting/*
In the examples below, the green colour indicates that the scripts are executable. They are therefore activated.
Examples :
Alerting disabled
Alerting on
Now you need to check that you are receiving the alert emails.
- copy
/usr/local/esia/plugins/alerting/send_mail_html.pl -e min -t <votre adresse mail> -D
Check whether an email has arrived in your inbox.