Created
May 6, 2021 14:52
-
-
Save mrsarm/367b9f38189caba5dc54b9d4eb427d57 to your computer and use it in GitHub Desktop.
restore-backup.sh: Restore Postgres backups from Docker volume
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
DB="pg-latest_data" | |
DB_BCK="pg-latest_data-backup-$(date --iso-8601)" | |
#DB_BCK="pg-latest_data-backup-SNAPSHOT" | |
echo "Restoring backup of '$DB' database with backup '$DB_BCK' ..." | |
echo | |
docker-compose down | |
docker volume rm $DB | |
docker-volume-cp $DB_BCK $DB | |
echo | |
echo "... Restoring backup done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docker-volume-cp
: https://gist.github.com/mrsarm/6713bfd973c2338ddada12e53487886f