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

bettermarks/content-pipeline-backup

 
 

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

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

Cron backup with kubernetes

See kubernetes-cronjob.yml file.

Authors & contributors

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

Languages

  • Shell 79.6%
  • Dockerfile 20.4%