Skip to content

Aamirpal/db-back-s3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heroku Buildpack: heroku-db-backup-s3

Capture DB backup & copy to s3 bucket.

Installation

Add buildpack to your Heroku app

heroku buildpacks:add https://github.com/aamirpal/db-back-s3 --app <your_app>

Buildpacks are scripts that are run when your app is deployed.

Configure environment variables

heroku config:add AWS_ACCESS_KEY_ID=XXX --app <your_app>
heroku config:add AWS_SECRET_ACCESS_KEY=YYY --app <your_app>
heroku config:add AWS_DEFAULT_REGION=region --app <your_app> (region example eu-west-1)
heroku config:add S3_BUCKET_PATH=bucket_name --app <your_app>

Go to settings page of your Heroku application and add Config Var DBURL_FOR_BACKUP with the same value as var DATABASE_URL. This is our DB connection string.

Scheduler

Add addon scheduler to your app.

heroku addons:create scheduler --app <your_app>

Create scheduler.

heroku addons:open scheduler --app <your_app>

Now in browser Add new Job.

Add different as mentioned below:

For DB backup bash /app/vendor/backup.sh -db <somedbname> and configure FREQUENCY. Paramenter db is used for naming convention when we create backups. We don't use it for dumping database with the same name.

For DNS backup bash /app/vendor/dns-backup.sh domainname Paramenter domainname is used for domain eg google.com, and do not include http:// or https:// as prefix from domainname value.

For ENV backup bash /app/vendor/env-backup.sh

About

backup postgres on aws S3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%