Docker container uses cron and psql to do a database backup and then write the backup to object storage using the gcloud cli.
Storage -> Storage Object Creator role.json key file and save itYou can now either:
FROM binocarlos/gcloud-psql-cronYou end up with a file that contains the key.
To configure the container:
$ docker run
-e SERVICE_ACCOUNT_EMAIL=... \
-e SERVICE_ACCOUNT_KEY_FILE=/service-account-key.json \
-v ./mykey.json:/service-account-key.json \
binocarlos/gcloud-psql-cron
vars:
SERVICE_ACCOUNT_EMAIL - email associated with the service accountSERVICE_ACCOUNT_KEY_FILE - path to the file containing the private key for the service accountSERVICE_ACCOUNT_PROJECT - gcloud projectSERVICE_ACCOUNT_STORAGE_BUCKET - the storage bucket to save the backupsPOSTGRES_SERVICE_HOST - hostname for the postgres databasePOSTGRES_SERVICE_USER - postgres userPOSTGRES_SERVICE_PASSWORD - postgres passwordPOSTGRES_SERVICE_DATABASE - postgres databaseYou can control when the backup happens by adding a custom cronfile to /cron/crontab that points to the /app/backup.sh script.
Here is the default crontab that runs every hour:
0 * * * * /app/backup.sh
MIT
Content type
Image
Digest
Size
753.7 MB
Last updated
over 7 years ago
docker pull aanaydenko/gcloudpsql