Sign inSign up

unit9/postgres-dumper

By unit9

•Updated over 9 years ago

Run periodic SQL dumps from postgres and (optionally) upload them to GCS

Image
0

4.1K

unit9/postgres-dumper repository overview

⁠PostgreSQL DB dumper

This image runs a periodic dump of your PostgreSQL database (using the pg_dumpall utility), and (optionally) uploads the dumps to GCS⁠. It's based on unit9/cron and follows the daily schedule (dumps at 6:25 AM).

It's using the 9.6 version of Postgres tools, as found in Debian Jessie backports, which should support every version of the server, all the way back to 7.0⁠ or so.

Backups are stored in /var/backups, and are automatically compressed with gzip.

if GS_PATH is not empty, the GCS upload job will start after the backup job has finished, and will remove each file after successful upload.

If you're not using the included GCS integration, you may want to mount a persistent volume on /var/backups and/or handle offsite backups some other way.

⁠Variables

Defaults are as follows:

  • PGUSER: postgres
  • PGPASSWORD: postgres
  • PGHOST: postgres
  • PGPORT: 5432
  • BOTO_PATH⁠: empty
  • GS_PATH: empty
  • GOOGLE_APPLICATION_CREDENTIALS: empty

Everything PG* behaves exactly as described in Postgres docs⁠.

If you want to use the GCS integration, you will have to:

  1. Provide the credentials

  2. Set GS_PATH, e.g. gs://my-test-bucket/backups/

⁠GCS credentials

You can do one of the following:

  • (Only when running on GCE) Use the default service account;

  • Put a JSON file with credentials somewhere (e.g. /var/run/secrets/gce/secret.json), and set GOOGLE_APPLICATION_CREDENTIALS to point to it;

  • Mount /etc/boto.cfg (or set BOTO_PATH⁠)

Tag summary

Content type

Image

Digest

Size

99.7 MB

Last updated

over 9 years ago

docker pull unit9/postgres-dumper