rainforestapp/forkbak

Name: forkbak

Owner: Rainforest QA

Description: null

Created: 2016-06-23 23:12:57.0

Updated: 2016-06-23 23:12:58.0

Pushed: 2015-10-29 00:05:28.0

Homepage: null

Size: 269

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Forkbak

Creates backups of a recent fork of your primary Heroku Postgres database.

WARNING

  1. This script creates forks of your database to take a backup and then destroys it. This is a regular fork, and as such it will incur costs on your heroku account.
  2. Your Heroku Postgres database is protected by Continuous Protection which allows you to use Rollback to go to a prior database state, protecting against accidental data loss. Therefore this approach is not actually necessary for data protection purposes.
Usage

Assuming the app you want to take backups from is called myapp, this will take backups from a fork of DATABASE_URL on myapp

rt APP=myapp
clone git@github.com:hgmnz/forkbak.git
orkbak
ku create $APP-backups
ku addons:add pgbackups --app $APP-backups
ku addons:add scheduler --app $APP-backups
ku config:set APP=$APP-backups \
RK_FROM_APP=$APP \
ROKU_API_KEY=$(heroku auth:token) \
app $APP-backups
push heroku master

Finally, set up a scheduled job to kick off the process every night:

ku addons:open scheduler --app $APP-backups

Use the following values:

Settings | Value ——— | ———————- Task | bundle exec bin/run Dyno size | 1X Frequency | Daily

Note: It is best to create a special user account for this process, and use it's API key in the HEROKU_API_KEY config var.

Recommended: Add a logging addon to $APP.

Running manually
ku run bundle exec bin/run --app $APP-backups
License

forkbak is copyright (c) Harold Giménez and is released under the terms of the MIT License found in the LICENSE file.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.