kartoza / docker-pg-backup

A cron job that will back up databases running in a docker postgres container
GNU General Public License v2.0
452 stars 103 forks source link

pgenv.sh missing #81

Closed DaanVanVugt closed 1 year ago

DaanVanVugt commented 1 year ago

Used in for example https://github.com/kartoza/docker-pg-backup/blob/master/scripts/restore.sh#L6

NyakudyaA commented 1 year ago

How are you running the script, It's created using the start.sh

andreimirt commented 9 months ago

@NyakudyaA First. Thanks. Second, most likely he tried to run it the same way I tried to do it. I created a second container only for restoring, because I'm using a synology nas and I'd rather not ssh into it and run docker commands. In this second container I initially overrode the entrypoint to /backup-scripts/restore.sh, so the pgenv.sh wasn't created.

The solution (thanks to your comment) is to override the entrypoint and leave it to just /bin/bash and then as command I used -c /backup-scripts/start.sh && /backup-scripts/restore.sh In this restore container, I'm using the exact same variables as in the backup container, but I also make use of the RUN_ONCE variable, and also of DUMPPREFIX to distinguish between regular backups and the "just before restoration" backups which are probably bad in some ways, hence the need of restoration, but they may still hold data that doesn't exist in the backup. Everything seems to work just fine with a postgis container that is not the kartoza one.

PS: it felt a bit awkward that RUN_ONCE expects false/true, but WITH_POSTGIS expects 0/1. I personally would have prefered consistency, but regardless, in my opinion, the other way around would have made more sense.