Sign inSign up

cycloid/postgres-dump

By cycloid

Updated 3 months ago

Backup and restore your postgres database's to using awscli

Image
0

100K+

cycloid/postgres-dump repository overview

postgres-dump

Based on https://github.com/cycloidio/cycloid-images/tree/master/mysql-dump

container to backup and restore your PostgreSQL database's from/to AWS or Scaleway. Could be use with docker or in K8s.

Container startup explained

  • This container use a built-in cron to make backups if started through the default entrypoint
  • Postgres will dump the database to this container and compress it using gzip
  • Using the aws CLI the file can be uploaded to AWS S3 Storage
  • Using rclone the file can be uploaded to SCW Object Storage
  • To restore a db just enter the container and run the 'restore' script with the path of the dump you want to restore:
./restore path/inside-bucket/example.sql.gz
  • To run a manual backup just enter the container and run:
./backup

Configure

Env var nameDescription
PGHOSTHost where PostgreSQL is running. default localhost. For example with k8s $(POSTGRES_SERVICE_HOST)
PGPORTPort to connect to PostgreSQL. default 5432. For example with k8s $(POSTGRES_SERVICE_PORT)
PGUSERThe username to connect with PostgreSQL
PGPASSWORDThe password to connect with PostgreSQL
PGDATABASEDatabase used
FILENAMEName to file in bucket storage. Default name backup_%Y-%m-%d_%H-%M-%S output example backup_2015-08-03_17-58-22
BACKUP_DIRInternal pod directory to use when creating the backup, this directory can be mouted via a volume if necessary
BACKUP_TIMETime use crontab format to run a dump. default 0 5 * * * (5 am)
AWS_ACCESS_KEY_IDAWS access key ID (used to access to the S3 bucket)
AWS_SECRET_ACCESS_KEYAWS secret access key
AWS_S3_BUCKETAWS S3 bucket to store the PostgreSQL dumps
AWS_DEFAULT_REGIONAWS region of the S3 bucket
SCW_ACCESS_KEYSCW access key (used to access to the Scaleway Object Storage bucket)
SCW_SECRET_KEYSCW secret key
SCW_DEFAULT_ORGANIZATION_IDSCW default organization ID
SCW_DEFAULT_REGIONSCW region of the Object Storage bucket

Build

sudo docker build -t cycloid/postgres-dump .
sudo docker push cycloid/postgres-dump

Tag summary

Content type

Image

Digest

sha256:044b36cb4

Size

270.9 MB

Last updated

11 months ago

docker pull cycloid/postgres-dump