Skip to content

Postgres backup container for kubernetes and docker with custom s3 endpoint ability (e.g. minio, ceph)

Notifications You must be signed in to change notification settings

BackupTools/postgres-backup-s3

Repository files navigation

Postgres S3 docker/kubernetes backup

Build status Pulls

Docker image to backup Postgres database(s) to S3 using pg_dump and compress using pigz(default), xz, bzip2, lrzip, brotli, zstd.

Advantages/features

  • 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

Configuration

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
COMPRESS_LEVEL=7 # Compression level of desired compression program

Or see docker-compose.yml file to run this container with Docker.

Cron backup with kubernetes

See kubernetes-cronjob.yml file.

Authors & contributors

Changelog

[2025-11-01] Updated base docker image. Changed way of installing Minio mc command line tool.

About

Postgres backup container for kubernetes and docker with custom s3 endpoint ability (e.g. minio, ceph)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •