Docker: impossible to restore DB dump created from make dumpdb
I'm reinstalling Pontoon on Docker, and tried to move around the database from my previous install with make dumpdb.
When using make loaddb, I get an error
pg_restore: error: input file does not appear to be a valid archive
The dump is created using pg_dumpall via make dumpdb. Looks like pg_restore cannot be used to restore that, and instead you need psql? This worked for me, but I wonder who's using make loaddb at this point, and for which format.
diff --git a/Makefile b/Makefile
index 74d63b3cb..e1729a4d0 100644
--- a/Makefile
+++ b/Makefile
@@ -150,7 +150,7 @@ loaddb:
# Note: docker-compose doesn't support the `-i` (--interactive) argument
# that we need to send the dump file through STDIN. We thus are forced to
# use docker here instead.
- "${DOCKER}" exec -i `"${DC}" ps -q postgresql` pg_restore -U pontoon -d pontoon -O < "${DB_DUMP_FILE}"
+ "${DOCKER}" exec -i `"${DC}" ps -q postgresql` psql -U pontoon < "${DB_DUMP_FILE}"
sync-projects:
"${DC}" run --rm server .//manage.py sync_projects $(opts)
I use loaddb / dumpdb regularly and I can confirm this used to work and doesn't work anymore.
The alternative solution might be to replace pg_dumpall with pg_dump and then loaddb with pg_restore should JustWork™.
Do you use make loaddb to load dumps from prod?
The alternative solution might be to replace
pg_dumpallwithpg_dumpand thenloaddbwithpg_restoreshould JustWork™.
Not sure it would.
According to my search, pg_dumb and pg_dumpall need to be restored through psql.
https://serverfault.com/questions/260607/pg-dump-and-pg-restore-input-file-does-not-appear-to-be-a-valid-archive
Alternatively, you need pg_dump -Fc, but I don't think that's available for pg_dumpall (only supports plain SQL).
At that point, probably easier to fix the restore part if you want to dump all tables.
Hey here,
happy to help if the issue is open to contributions.
happy to help if the issue is open to contributions.
Assigned :)