Changing Distribution
This article describes how to change the distribution BlueMind works on. It can be used to update the distribution (Ubuntu 20.04 to Ubuntu 22.04 for instance).
This procedure is based on installing a target system to which the data is migrated. This new system will then take the place of the first, at network level.
Prerequisites
Installing and configuring BlueMind
- Install a BlueMind version identical to the original system on the target system: if the original system uses BlueMind 5.0.x, the target system must have BlueMind 5.0.x.
⚠️ Database password
The database password is automatically generated when BlueMind is installed and written to the/etc/bm/bm.inifile. This file will be overwritten by data synchronization ⇒ copy and save database password before proceeding with migration operations. - Play the installation wizard (or the Setup Wizard) on the target server.
- Install on the target server all plugins used on the source server (LDAP import, company signatures...)
- Configure the target server's external URL: if the original external URL is
bluemind.domain.tld, the target system's BlueMind must be configured withbluemind.domain.tld.For further information see the page Configuring external URLs and autodiscover. - Run Setting up the subscription, which must be valid for this OS. *Note: In this case, it is possible to reuse the same subscription, with the new server replacing the old one.
- The
rootuser on the target server must be able to authenticate asrooton the origin server, ideally using key authentication. - The
rsyncutility must be installed on both systems.
System
- The
rsyncutility must be installed on both systems. - Stop the following services if necessary:
- firewalld
- PostgreSQL
RedHat
For RedHat servers :
- add rpms adapted to the version
Example for version 8:dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpmdnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm - Disable Getenforce:
sed -i s/=enforcing/=disabled/ /etc/selinux/config
Data Migration
Data migration is done in three steps to minimize service downtime:
- Hot synchronization of data from the source server to the target server - time-consuming operation, but does not cause downtime
- Cold synchronization - fast operation, but causes a service interruption
- Replacing Servers
Hot synchronization
This synchronization allows you to make the initial copy of data without interruption of the service.
To minimize downtime during synchronization, It is recommended to perform hot synchronization as often as possible. This allows to limit the volume of data to be transmitted between the two machines.
The shorter the time between hot synchronization and cold synchronization, the faster cold synchronization will be.
Procedure:
- Connect as
rooton the target server:su - - Stop services on it:
bmctl stopsystemctl stop postfix.service
- Synchronize BlueMind data using the rsync utility:
rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-hsm/ /var/spool/bm-hsm/rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-elasticsearch/ /var/spool/bm-elasticsearch/rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-docs/ /var/spool/bm-docs/rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-filehosting/ /var/spool/bm-filehosting/rsync -avH --delete root@origsrv.domain.tld:/var/spool/cyrus/ /var/spool/cyrus/
These operations can be interrupted and/or performed several times.
Cold synchronization
Caution: these operations momentarily cut off access to BlueMind and may disconnect users, who may then lose their work in progress. They must therefore be carried out at a time when there is no risk of impacting users.
Procedure:
- Stop services on origin and target servers:
bmctl stopsystemctl stop postfix.service
- From the target server, perform a new data synchronization:
rsync -avH --delete root@origsrv.domain.tld:/var/spool/cyrus/ /var/spool/cyrus/rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-hsm/ /var/spool/bm-hsm/rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-elasticsearch/ /var/spool/bm-elasticsearch/rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-docs/ /var/spool/bm-docs/rsync -avH --delete root@origsrv.domain.tld:/var/spool/bm-filehosting/ /var/spool/bm-filehosting/
- From the target server, restart the PostgreSQL of the original server:
ssh root@origsrv.domain.tld "systemctl start postgresql.service"
- From the target server, perform a database dump of the original server:
ssh root@origsrv.domain.tld "PGPASSWORD=bj pg_dump --format=c --username=bj --host localhost bj" > /tmp/dump-bj.sqlssh root@origsrv.domain.tld "PGPASSWORD=bj pg_dump --format=c --username=bj --host localhost bj-data" > /tmp/dump-bj-data.sqlssh root@origsrv.domain.tld "PGPASSWORD=bj pg_dump --format=c --username=bj --host localhost keycloak" > /tmp/dump-keycloak.sql
- From the target server, copy the files from the original server:
rsync -av -r root@origsrv.domain.tld:/etc/bm/\* /etc/bmrsync -av root@origsrv.domain.tld:/etc/nginx/sw.htpasswd /etc/nginx/sw.htpasswdrsync -av root@origsrv.domain.tld:/etc/ssl/certs/bm_cert*.pem /etc/ssl/certsrsync -av -r root@origsrv.domain.tld:/var/lib/bm-ca/\* /var/lib/bm-carsync -av root@origsrv.domain.tld:/usr/share/bm-elasticsearch/config/elasticsearch.yml /usr/share/bm-elasticsearch/config/elasticsearch.ymlrsync -av root@origsrv.domain.tld:/etc/postfix/main.cf /etc/postfix/main.cfrsync -av root@origsrv.domain.tld:/etc/postfix/master.cf /etc/postfix/master.cfrsync -av root@origsrv.domain.tld:/etc/postfix/master_relay_transport-flat /etc/postfix/master_relay_transport-flatrsync -av root@origsrv.domain.tld:/etc/postfix/master_relay_transport.db /etc/postfix/master_relay_transport.dbrsync -av root@origsrv.domain.tld:/etc/postfix/transport-flat /etc/postfix/transport-flatrsync -av root@origsrv.domain.tld:/etc/postfix/transport.db /etc/postfix/transport.dbrsync -av root@origsrv.domain.tld:/etc/postfix/virtual_alias-flat /etc/postfix/virtual_alias-flatrsync -av root@origsrv.domain.tld:/etc/postfix/virtual_alias.db /etc/postfix/virtual_alias.dbrsync -av root@origsrv.domain.tld:/etc/postfix/virtual_domains-flat /etc/postfix/virtual_domains-flatrsync -av root@origsrv.domain.tld:/etc/postfix/virtual_domains.db /etc/postfix/virtual_domains.dbrsync -av root@origsrv.domain.tld:/etc/postfix/virtual_mailbox-flat /etc/postfix/virtual_mailbox-flatrsync -av root@origsrv.domain.tld:/etc/postfix/virtual_mailbox.db /etc/postfix/virtual_mailbox.db
- From the target server, restart PostgreSQL:
systemctl start postgresql.service
- Re-mount the database on the target server:
chown postgres:postgres /tmp/dump*su - postgresdropdb bjdropdb bj-datadropdb keycloakcreatedb bjcreatedb bj-datacreatedb keycloakpg_restore -d bj /tmp/dump-bj.sqlpg_restore -d bj-data /tmp/dump-bj-data.sqlpg_restore -d keycloak /tmp/dump-keycloak.sqlexit
💡 Database password
In the event that the database password has not been saved (see Prerequisites, or for any other reason, it is possible at this stage to update the database password on the target server so that it is identical to that on the source server:su - postgrespsql -d bjALTER ROLE bj WITH PASSWORD '<mot_de_passe>';\qexitThen restart BlueMind:
bmctl restart - Start the automatic reconfiguration of Keycloak on the target server:
bm-cli auth reconfigure
Switching servers
Procedure:
- Stop the original server
- Reconfigure the target server's
bm.inifile to assign the origin server's IP address (see Changing BlueMind server IP address) - Restart the target server and connect to the network instead of the original server so that it can be reached instead of the original server
System reconfiguration
Manually
- Reconfiguring the firewall:
sed -i "s/${old_ip}/${new_ip}/g" /etc/init.d/bm-iptablessystemctl restart bm-iptables.service
- Reconfiguring postfix:
sed -i "s/${old_ip}/${new_ip}/g" /etc/postfix/main.cf /etc/postfix/transport-flatpostmap /etc/postfix/transport-flatmv /etc/postfix/transport-flat.db /etc/postfix/transport.db
- Reconfigure the bm-tick supervision tool:
kapacitor list tasks | awk '{print $1}' | grep -v ID | xargs -I {} kapacitor delete tasks {}bm-cli tick reconfigure
Via AdminConsole
Log into the BlueMind Administration console as admin0@global.virt and:
- Go to Security > Manage Firewall and immediately click on the "Save" button to force the regeneration of BlueMind firewall rules
- Go to System management > Manage messaging system, click on the "Run" button to re-generate the Postfix mail routing tables
- Go to System Management > System Configuration and replace the old IP address in the "My Networks" field by the new address or the address range for which you want the relay open and click "Save"
- Reconfigure the bm-tick supervision tool:
kapacitor list tasks | awk '{print $1}' | grep -v ID | xargs -I {} kapacitor delete tasks {}bm-cli tick reconfigure