diff --git a/database-backup.md b/database-backup.md new file mode 100644 index 0000000..fe8593f --- /dev/null +++ b/database-backup.md @@ -0,0 +1,23 @@ +## Pan.do/ra backup database + +as pandora user: + +``` +mkdir -p /srv/pandora/database +pg_dump pandora | gzip > /srv/pandora/database/pandora-`date -I`.psql.gz +``` + + +Restore database from backup: + +If needed create postgres db: +``` +sudo -u postgres createdb -T template0 --locale=C --encoding=UTF8 -O pandora pandora +echo "CREATE EXTENSION pg_trgm;" | sudo -u postgres psql pandora +``` + +load db from backup as pandora user + +``` +zcat /srv/pandora/database/pandora-2023-06-07.psql.gz | pandoractl manage dbshell +``` \ No newline at end of file