Skip to content

Backup and restore

Andreas Backström edited this page Jan 2, 2025 · 1 revision

Backup database

sudo docker exec -t CONTAINER_ID pg_dumpall -c -U POSTGRES_USER > dump_`date +%Y-%m-%d"_"%H_%M_%S`.sql

Restore

Note

The databse needs to be empty in order to be able to restore from backup. Stop all containers and delete the volume from the postgres service. Afterwords, only start up the postgres database. E.g docker compose up booklogr-db -d

cat dump_2025-01-02_16_06_47.sql | sudo docker exec -i CONTAINER_ID psql -U POSTGRES_USER -d booklogr

Lastly, start all other containers, docker compose up -d

Clone this wiki locally