Postgres backup to GCS saving empty file
sifsoft
HOBBYOP

2 years ago

I set up 'Postgres backup to GCS' template service (https://railway.app/template/tqxaEg). It creates a dump file and successfully sends it to my Google Cloud account. But the file is empty. No schema no data.
This is the log sequence after service execution:

  • Backup cron scheduled…

  • Initiating DB backup…

  • Dumping DB to file…

  • DB dumped to file…

  • Uploading backup to GCS…

  • Backup uploaded to GCS…

  • Deleting file…

  • DB backup complete…

Any idea why the generated dump file is empty?
Thank you

Solved

2 Replies

2 years ago

On Line #15 of the Dockerfile alpine 3.14 is used as the final image, on line #22 of the same Dockerfile postgresql-client is being installed, according to the alpine package search tool this will install version 13x of the package, version 13 of this package (of which includes the tool used to dump the database) would not support the Postgres version 15 or 16 database you are running on Railway. The reason why you end up with an empty backup file is that the backup process does not handle errors correctly (there would be an error about the version mismatch, but that's essentially suppressed) and lets a blank backup file through without erroring out.

To fix the issue of postgresql-client version 13x being installed, simply replace the Dockerfile in your repo with this updated Dockerfile and you should be good to go!


Status changed to Solved Railway about 2 years ago


sifsoft
HOBBYOP

2 years ago

Hi. The new Dockerfile worked perfectly, thank you !!


Loading...