This is an example of doing a quick and dirty restore of a database. Typically happens after doing something stupid, like running UPDATE without a WHERE (oops).
In this case, we restore database iix-notes (which by pure coincidence is the same name as this site) from a daily backup. The database is hosted on a postgresql docker container, but it should work the same regardless.
- Fetch a backup and copy it to the docker container
cd $HOME
gpg -o iix-notes.daily.psql.gz -d /media/backup/hot/iix-notes.daily.psql.gz.gpg
gunzip iix-notes.daily.psql.gz
sudo docker cp iix-notes.daily.psql iixnotescompose_database_1:/tmp
rm iix-notes.daily.psql
- Logon to the container, drop the old database, and load it from the backup
sudo docker exec -it iixnotescompose_database_1 bash
dropdb -U postgres iix-notes
psql -U postgres -f /tmp/iix-notes.sql