Add 'database backup'

j 2023-07-07 11:49:29 +00:00
parent b8549c9467
commit bd74a923c9

23
database-backup.md Normal file

@ -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
```