Add database backup and migration guide
WIP guide for when https://github.com/iv-org/invidious/pull/4746 gets merged
Thanks. But for Docker, why not do a pg_dump too? Could be used for postgresql upgrades too.
A dump will always be smaller than a backup of the entire postgresql pgdata. https://www.reddit.com/r/PostgreSQL/comments/80yzt1/pg_database_size_is_much_much_bigger_than_pg_dump/
Thanks. But for Docker, why not do a pg_dump too? Could be used for postgresql upgrades too.
I did Docker Volume cloning just because is simpler to do. Is also possible to use pg_dump but inside the invidious-db service and the backup will be stored in the postgresdata volume instead of outside the postgresdata volume.
At first I was thinking about exposing the port of invidious-db to the host so the administrator of the instance could do pg_dump while connecting to the invidious-db database but that would require installing the package postgresql-libs to have the pg_dump binary available in the host, so in that way, the backup data would reside outside the postgresdata volume.
What do you think it would be best? Exposing the port and using pg_dump or running pg_dump inside the invidious-db service with the dump being held inside the postgresdata volume?
A dump will always be smaller than a backup of the entire postgresql pgdata. https://www.reddit.com/r/PostgreSQL/comments/80yzt1/pg_database_size_is_much_much_bigger_than_pg_dump/
You are right. I got confused when watching at the file size difference between the dump and the reported size of the database when testing pg_dump
What do you think it would be best? Exposing the port and using
pg_dumpor runningpg_dumpinside theinvidious-dbservice with the dump being held inside thepostgresdatavolume?
You can do that:
docker compose exec -i -u postgres invidious-db pg_dump -U kemal invidious > dump.sql
And then that for restore:
docker compose cp dump.sql invidious-db:/tmp/dump.sql
docker compose exec -u postgres invidious-db psql -U kemal -d invidious -c 'DROP SCHEMA public CASCADE; CREATE SCHEMA public;'
docker compose exec -u postgres invidious-db psql -U kemal -d invidious -f /tmp/dump.sql
Though might require compressing with tar and empty all cache beforehand in order to reduce the size of the dump.
Would you be fine with having two separate docs for Docker installations and manual installations? Having both in the same .md file makes it look cluttered
Yes good idea:)!