Skip to content

Conversation

@Fijxu
Copy link
Member

@Fijxu Fijxu commented Oct 18, 2025

WIP guide for when iv-org/invidious#4746 gets merged

@unixfox
Copy link
Member

unixfox commented Oct 18, 2025

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/

@Fijxu
Copy link
Member Author

Fijxu commented Oct 18, 2025

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

@unixfox
Copy link
Member

unixfox commented Oct 18, 2025

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?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants