Automate Postgres database backups in Dokku with BackBlaze Object Storage
(Last updated on )
Let’s see how we can backup databases running on Dokku, an self hosted heroku platform with help of BackBlaze Object Storage, an cost effective AWS S3 Alternative.
Make sure you have an account with BackBlaze and create an emtpty bucket to follow the tutorial:
Dokku Postgres Backup Commands
Syntax:
dokku postgres:backup-auth <service> <aws-access-key-id> <aws-secret-access-key> <aws-default-region> <aws-signature-version> <endpoint-url>
Example
Using BackBlaze Object Storage which uses S3 version v4
and region us-east-005
by default:
dokku postgres:backup-auth demo-dev-db 0053d3e6c315aa70000000002 K005vbJpEMmgEsQ3QKCgQeKe19rqLMI us-east-005 v4 https://s3.us-east-005.backblazeb2.com
Test the Connection
demo-db-backups
is the bucket name found in BackBlaze Object Storage:
dokku postgres:backup demo-dev-db demo-db-backups
After running the above command, you can find the backup uploaded inside the bucket.
Schedule the backups
ktl-db-backups
is the bucket name found in BackBlaze Object Storage:
dokku postgres:backup-schedule demo-dev-db "0 3 * * *" demo-db-backups
Crontab expression, eg. 0 3 * * *
for each day at 3am
.
Some More Commands
dokku postgres:backup-deauth demo-dev-db
dokku postgres:backup-unschedule demo-dev-db