Sign inSign up

howgood/backup-db

By howgood

•Updated almost 7 years ago

Backup a postgresql database, encrypt it with gpg, and upload it to AWS S3

Image
0

4.5K

howgood/backup-db repository overview

⁠Backup Database Container

This contains the scripts for backing up and restoring a Postgres database using gpg to encrypt it, and AWS S3 for storage.

⁠Usage

To create a database backup, supply the required environment variables and execute the docker image.

docker run --rm -it \
           -e PGHOST=localhost \
           -e PGPORT=5432 \
           -e PGUSER=postgres \
           -e PGPASSWORD=s3cr3t_p4ssw0rd \
           -e S3_BUCKET=backups.example.com \
           -e GPG_PASSPHRASE=p4ssw0rd \
           howgood/backup-db:latest

To download and decrypt a database backup, supply the required environment variables again, and execute the docker image with the restore script as the command.

docker run --rm -it \
           -e PGHOST=localhost \
           -e PGPORT=5432 \
           -e PGUSER=postgres \
           -e PGPASSWORD=s3cr3t_p4ssw0rd \
           -e S3_BUCKET=backups.example.com \
           -e GPG_PASSPHRASE=p4ssw0rd \
           -v "$(pwd):/backup/" \
           howgood/backup-db:latest \
           /usr/local/bin/download-backup.sh

Tag summary

Content type

Image

Digest

Size

37.5 MB

Last updated

almost 7 years ago

docker pull howgood/backup-db