Migrate a Cyberwatch instance to another server

This documentation explains how to migrate a Cyberwatch instance from a server to another without losing data.

Before applying this procedure, we recommend you to contact our support through our e-mail at support@cyberwatch.fr in order to give you some directions.

First, make sure the instance to be migrated is currently in the latest Cyberwatch software version and in the latest version of the orchestrator base.

If needed, update the software and the orchestrator base using the official documentation.

For the remaining of this documentation, the server on which is currently installed the Cyberwatch instance will be referred to as “the former server”. The target server on which the data transfer will take place will be named “the new server”.

Commands and actions to execute on the former server

Generate a SQL dump of the database

The procedure below follows our official documentation on generating a SQL dump.

Generate the database backup:

sudo cyberwatch backup save

The command should return that a file following this format has been created /var/lib/cyberwatch/backups/cyberwatch_AAMMDD_HHMMSS.sql.gz.

Verify that the file is present and not corrupted.

Transfer the SQL dump file to the new server, using a method of your choice.

Commands and actions to execute on the new server

Install Cyberwatch

Install Docker and Cyberwatch following the standard procedure.

If you original installation does not follow the standard procedure, please adapt the installation of Docker and Cyberwatch to your requirements.

Stop before step 4. of the documentation, DO NOT run the cyberwatch configure command yet.

Delete all files present in the newly created directory /etc/cyberwatch:

sudo rm /etc/cyberwatch/*

This will prepare the server for the upcoming configuration files copy coming from the former server.

Check the orchestrator base version

Run the sudo cyberwatch version command and check that the orchestrator base version installed on the new server matches the version of the former server.

Copy the configuration files from the former server to the new server

The goal is to transfer all files present in the /etc/cyberwatch directory of the former server to the same directory on the new server.

Again, use a method of your choice, here is an example using the rsync command which allows to keep symbolic links (adapt to your environment):

cd /etc/cyberwatch
sudo rsync -Wav -e "ssh -i key.pem" /etc/cyberwatch user@[NEW_SERVER]:/etc/cyberwatch

The new server should now have all files from the former server in its /etc/cyberwatch directory.

Launch Cyberwatch on the new server

Run the configuration command, make sure to keep the options specific to your installation that were present on the former server (such as --offline for example).

sudo cyberwatch configure --option1 --option2

Answer “no” to both prompt of configuration changes.

Once the command is over, the Cyberwatch interface should now be available and be offering a sign-up page.

Import the database dump

Restore the database dump transferred earlier on the new server:

sudo cyberwatch backup restore /var/lib/cyberwatch/backups/cyberwatch_AAMMDD_HHMMSS.sql.gz

The command should return that the database has been successfully restored.

The Cyberwatch interface hosted on the new server should now be available and identical to the one hosted on the former server.