Backup and Restore
Introduction
This document describes a simple way to back up and restore a PILOS installation. Make sure to use the same version of PILOS for backup and restore.
Backup
-
Start Maintenance Mode
docker compose exec app pilos-cli down
-
Stop Horizon and Cron
docker compose stop cron horizon
-
Backup the Database
You will need to replace
user
andtest
with the database user and database name in yourdocker-compose.yml
file. When you run the command, you will be prompted for the password for the database user you specified indocker-compose.yml
.docker compose exec db mariadb-dump -u user -p test > db_backup.sql
-
Backup the Files
tar -czf file_backup.tar.gz storage/ app/
-
Start Horizon and Cron
docker compose start cron horizon
-
End Maintenance Mode
docker compose exec app pilos-cli up
Restore
- Start Maintenance Mode
docker compose exec app pilos-cli down
- Stop Horizon and Cron
docker compose stop cron horizon
- Copy the Database to the Container
docker cp db_backup.sql app:/var/www/htm/db_backup.sql
- Restore the Database
docker compose exec app pilos-cli db:import db_backup.sql
- Delete Database Backup File
docker compose exec app rm db_backup.sql
- Restore the Files
tar -xzf file_backup.tar.gz
- Start Horizon and Cron
docker compose start cron horizon
- End Maintenance Mode
docker compose exec app pilos-cli up