Docker Postgres backup to Amazon S3 via cron
This image dumps your postgres databases very hour,
compresses the dump using bz2 and uploads it to an
amazon S3 bucket. Backups older than 30 days are
Configure the backup source and s3 target with these environment
fitty-postgres-backup: image: 'jannis/postgres-s3-backup-via-cron' environment: - AWS_ACCESS_KEY_ID=<access key> - AWS_BUCKET_NAME=<your s3 bucket name> - AWS_REGION=<the region your bucket is in> - AWS_SECRET_ACCESS_KEY=< secret access key> - BACKUP_NAME=<this will be the directory containing your backups on s3> - PGHOST=<see the link section below> - PGUSER=<username> - PGPASSWORD=<password> - PGPORT=<this is usually 5432> links: - 'your-postgres-master-container:master'
links section is optional, of course, just make sure you update the
PGHOST environment variable accordingly.
This image does backups every hour and just keeps everything of the past 30
days. It would be much better if this was configurable, if it would keep
1 backup per day for the past 30-60 days, and so on.
Also, it just dumps all the databases. Perhaps you just want some. That would
also be a nice thing to implement, that it can be configured which databases
should be backed up.
Just fork this repo, implement
your changes and issue a PR. Don't be afraid if you're not sure how to do
things. Just send that PR over (or a message) and we'll figure it out together. 🤓
Adapted from here, here and [here](https://www.ekito.fr/people/run-a-cron-job-with-docker/].