Giter Site home page Giter Site logo

forkbak's Introduction

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

export APP=myapp
git clone [email protected]:hgmnz/forkbak.git
cd forkbak
heroku create $APP-backups
heroku addons:add pgbackups --app $APP-backups
heroku addons:add scheduler --app $APP-backups
heroku config:set APP=$APP-backups \
  FORK_FROM_APP=$APP \
  HEROKU_API_KEY=$(heroku auth:token) \
  --app $APP-backups
git push heroku master

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

heroku 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

heroku 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.

forkbak's People

Contributors

hgmnz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

forkbak's Issues

up for a quick help?

Hey there!

This thing is pretty slick.. I'm trying to get a pipeline setup to get my backups into my own S3 though.

Trying to figure out how to get the actual download URL with the access key..

I noticed around here:

https://github.com/hgmnz/forkbak/blob/master/bin/forkbak#L111

This response object has a few nice tidbits, but how can I get a download url with the S3 access key stuff built in? Seems all these api endpoints aren't documented (yet?) ?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.