Sign inSign up

kavini/cron-pg-backup

By kavini

•Updated 5 months ago

Container based on Supercronic for PostgreSQL database backup to Backblaze B2

Image
Security
Developer tools
Databases & storage
0

180

kavini/cron-pg-backup repository overview

⁠cron-pg-backup

A minimal Docker image that runs scheduled PostgreSQL backups and uploads them to Backblaze B2 cloud storage.

On startup it writes a cron file based on CRON_SCHEDULE and launches supercronic⁠. At each scheduled run it dumps every database listed in DB_LIST using pg_dump, compresses the output with gzip, and uploads each file to B2 via rclone⁠ under a <db>/<YYYY>/<MM>/<DD>/ path.

⁠Required Environment Variables

VariableDescription
CRON_SCHEDULECron expression for backup schedule. Container exits on startup if missing.
PGHOSTPostgreSQL hostname
PGPORTPostgreSQL port (typically 5432)
PGUSERPostgreSQL user
PGPASSWORDPostgreSQL password
DB_LISTSpace-separated list of databases to back up (e.g. "db1 db2 db3")
B2_ACCOUNT_IDBackblaze B2 key ID
B2_ACCOUNT_KEYBackblaze B2 application key
B2_BUCKETDestination B2 bucket name
B2_REGIONB2 region (use auto for the default S3-compatible endpoint)

Example:

environment:
  CRON_SCHEDULE: "0 2 * * *"  # every day at 02:00
  PGHOST: postgres
  PGPORT: 5432
  PGUSER: backup_user
  PGPASSWORD: secret
  DB_LIST: "db1 db2 db3"
  B2_ACCOUNT_ID: your_key_id
  B2_ACCOUNT_KEY: your_app_key
  B2_BUCKET: my-backup-bucket
  B2_REGION: auto

Tag summary

Content type

Image

Digest

sha256:46d01bdf0…

Size

39.9 MB

Last updated

5 months ago

docker pull kavini/cron-pg-backup:0.0.3