Backups
Create a backup
Section titled “Create a backup”There are two components that need to be backed up:
To get started enter the directory where your docker-compose.yml file is stored:
cd ~/crossonic-serverAnd make sure that the db container is running (the crossonic-server can run aswell):
sudo docker compose up -d dbDatabase backup
Section titled “Database backup”To backup the database create a database dump:
sudo docker compose exec db pg_dumpall --clean --if-exists --username=crossonic | gzip > db_backup.sql.gzThe database backup will be available at ./db_backup.sql.gz.
Data directory backup
Section titled “Data directory backup”To backup the data directory, simply create a .tar.gz archive of the directory:
sudo tar -czf data_backup.tar.gz ./dataYour backup will be available at ./data_backup.tar.gz
Restore a backup
Section titled “Restore a backup”To restore a backup first follow the installation guide but do not create any users and make sure you specify the same encryption key in your config that was used when the backup was created.
Next enter the directory of your docker-compose.yml file and make sure that your db_backup.sql.gz and data_backup.tar.gz files are available
in the same directory.
To restore the backup execute these commands:
sudo docker compose downsudo rm -rf ./postgres ./datasudo docker compose pullsudo docker compose up -d dbsleep 10gunzip --stdout ./db_backup.sql.gz | sudo docker compose exec -iT db psql --dbname=postgres --username=crossonicsudo tar -xzf ./data_backup.tar.gzsudo docker compose up -d