Docker image to backup Postgres database(s) to S3 using pg_dump and compress using pigz(default), xz, bzip2, lrzip, brotli, zstd.
- Supports custom S3 endpoints (e.g. minio)
- Uses piping instead of tmp file
- Compression is done with pigz (parallel gzip)
- Creates bucket if it's not created
- Can be run in Kubernetes or Docker
- Backups all databases into separate files, unless specified in the PG_URI
- PGP encryption
- Available
COMPRESS=
methods: pigz, xz, bzip2, lrzip, brotli, zstd - Ping database before backup
- TODO: Add other dbs (e.g. postgres, mysql)
- TODO: Separate definition of HOST, PORT, USERNAME, PASSWORD environment variables as an alternative to PG_URI
S3_BUCK=postgres1-backups
S3_NAME=folder-name/backup-name-prefix
S3_URI=https://s3-key:[email protected]
PG_URI=postgres://mongo-host:5432/db-name
GPG_KEYSERVER=keyserver.ubuntu.com # your hpks keyserver
GPG_KEYID=<key_id> # recipient key, backup will be encrypted if added
COMPRESS=pigz # Available: pigz, xz, bzip2, lrzip, brotli, zstd
Or see docker-compose.yml
file to run this container with Docker.
See kubernetes-cronjob.yml
file.