mirror of
https://github.com/garraflavatra/docker-volume-s3-backup.git
synced 2025-05-17 21:24:39 +00:00
1.7 KiB
1.7 KiB
Overview
This project provides Docker containers to backup/restore a PostgreSQL database to/from AWS S3 (or a compatible service like DigitalOcean Spaces). Both one-off and periodic/scheduled backups are supported.
Credit where due
This repository is a fork and re-structuring of schickling's postgres-backup-s3 and postgres-restore-s3.
Fork goals:
- dedicated repository
- automated builds
- support multiple PostgreSQL versions
- support encrypted (password-protected) backups
- merge backup and restore images?
Usage
Backup
postgres:
image: postgres
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
pgbackups3:
image: eeshugerman/postgres-backup-s3
environment:
SCHEDULE: '@daily'
S3_REGION: region
S3_ACCESS_KEY_ID: key
S3_SECRET_ACCESS_KEY: secret
S3_BUCKET: my-bucket
S3_PREFIX: backup
POSTGRES_DATABASE: dbname
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_EXTRA_OPTS: '--schema=public --blobs'
Notes
Periodic backups
The SCHEDULE
variable is determines backup frequency. It is optional -- without it, the backup will run once at start up. More information about the scheduling can be found here.
Docker
Docker Compose is by no means required, you can use plain ol' Docker too -- just set the required env vars with the -e
flag.
Restore
With the container running,
docker exec <container name> sh restore.sh