Restoring Data from Backups
Whilst the ansible process installs a fully functional server, the server does not contain any data. To add data to the server we have the following options:
- Create a new Hash Chapter by keying in all data to the backend (a process ignored within this documentation)
- Restore data from existing backups, e.g., after a server crash/move etc. (see below).
- Initial load of data during migration from a legacy website (see here)
In case up-to-date data exists already, the backups can be used to restore the website using them.
DANGER
Restoring backups only works if the same version of the Strapi backend is used on all servers involved. The server to be restored must be on the same backend repository version, then the server backup. This is particularly important for copy-downs
Restore Webserver
Restore Strapi backup:
~/scripts/strapi/restore_strapi.shRestore mysql database:
~/scripts/strapi/restore_mysql.shWhen restoring the database the API token will be overwritten in the Strapi backend with the token of the database you copied from. Make sure to recreate the token and/or adjust the .env files of your target environment.
Restore Piwigo Server
As operations are a bit more delicate here, we deliberately did not include a restore script and a number of steps can/must be executed manually.
Stop the Piwigo docker container
Extract the Piwigo database backup to ~/docker/mysql/backups:
tar -xzf /home/ubuntu/cloud/google/Backups/piwigo_db_backup.tar.gz -C /home/ubuntu/docker/mysql/backups- Restore db dump:
cat ~/docker/mysql/backups/mysql_backup.sql | docker exec -i mysql-db mysql -u root -p<your-password-here>- Remove the existing content in
~/docker/piwigo/config(exists even after fresh install).
sudo rm -r ~/docker/piwigo/config/- Restore the Piwigo backup config:
sudo tar -xzf /home/ubuntu/cloud/google/Backups/piwigo_backup.tar.gz -C /home/ubuntu/docker/piwigo/config- (Re-)Create the
config/www/_datadirectory:
mkdir /home/ubuntu/docker/piwigo/config/www/_data- Restore historic images before website migration: Copy the image archive (2016-2025) file to
~/docker/piwigo/images/galleryand unpack - Restore images after website migration using
rclone
/usr/bin/rclone copy klhhh-google:/Backups/images /home/ubuntu/docker/piwigo/images/uploadRemove the mysql_backup_file
sudo rm -r /home/ubuntu/docker/mysql/backups/mysql_backup.sqlRestart the Piwigo docker container and synchronize the historic images using the Piwigo backend functionality
docker compose -f /home/ubuntu/docker/piwigo/docker-compose.yml up -d