docker-pleroma/UPDATE-DB.md

30 lines
915 B
Markdown
Raw Normal View History

2023-08-13 05:50:00 +00:00
# HOW TO UPDATE POSTGRES DATABASE
If you want to upgrade your database version (say from postgres 14 to 15)
1. Create a backup of your instance! Or at least a copy of the postgres folder!
2. Dump your database with the following command:
`docker exec -u pleroma pleroma_db pg_dump -Fc pleroma > db.dump`
3. Change the [image tag](https://hub.docker.com/_/postgres/) for your db under `docker-compose.yml`
4. Delete your existing postgres folder with `rm -rvf postgres`
5. Bring up only the database container with
`docker compose up db -d`
6. Restore your database backup into the new database with
`docker exec -i -u pleroma pleroma_db pg_restore -C -d postgres < db.dump`
7. Launch pleroma_web with the following command and watch for errors
`docker compose up web -d`
`docker compose logs web db -f`
Should there be any errors... well that's what backups are for! Restore from the backup you made.