How to make recovery
This document explains how to start recover from a backup.
Credentials
The backup credentials are saved in the gitlab pipeline variables, together with the used bucket. The credentials ARE NOT EVER put in environments or somewhere else in a container. You should keep and saveguard these credentials.
Backup structures
To restore, you can take the script contrib/jelastic-manifests/scripts/restoreBackup.yml as reference to understand how restic works:
RESTIC_REPOSITORY=s3://https:// ... /envname-nodelayer
restic snaphots # will list the backup for the nodelayer
# restore the $SNAPSHOT_ID in the dir ./mydir, can inspect it later.
restic restore $SNAPSHOT_ID --target ./mydir
To restore a database, you should remove the database (here decidim) and dump it again:
psql -U $POSTGRES_USER -d postgres -c "DROP DATABASE IF EXISTS \"decidim\";";
psql -U $POSTGRES_USER -d postgres -c "CREATE DATABASE \"decidim\";";
restic dump $SNAPSHOT_ID /root/dump/decidim.sql | psql -d decidim -U $POSTGRES_USER;
When saving databases, the root files will always be the /root/dump/ directory.
Commons mistakes
- Before restoring the directories
db/migrateorstorage, you need to remove olds files, or will have double migrations - You select the wrong snapshot, please be sure to check the date
- You make a bad error, please consider always run a backup process, BEFORE attempting a restore.