Poor Man’s Heroku Backups

Here’s a quick and dirty way to back up all of your Heroku-powered databases using their Taps gem with one easy command. It works well enough for my simple needs, but any improvements you’ve got would be most welcome!

Just add the following to your ~/.bash_profile, and you’re good to go:

http://flowcoder.com/59

Update: I’ve posted a technique for enabling automatic nightly PostgreSQL database backups from Heroku to Amazon S3 that may be of interest as well.

Published by

Trevor Turk

A chess-playing machine of the late 18th century, promoted as an automaton but later proved a hoax.

8 thoughts on “Poor Man’s Heroku Backups”

  1. Yeah, that could be easier, but I couldn't figure out how to automate the destroying of that single bundle to make room for the new one. If this isn't a problem anymore, or you have a solution, please let me know!

  2. bundle=backup

    app=myapp

    heroku bundles:capture $bundle –app $app

    sleep 15 # the capture takes a few seconds…

    heroku bundles:download $bundle –app $app

    heroku bundles:destroy $bundle –app $app

  3. Thanks for the helpful advices. It seems capturing a bundle is a more preferred way for backups. But I have a question: how to restore the raw dump file 'pgdump.sql', which is included in the downloaded bundle, to the database on Heroku?

  4. Thanks! Yeah, I found that one recently, as well. I think I like his method better, actually. I adapted my plugin from a rake task, so it's still shelling out to the heroku gem. I'm just using the bundle capture functionality rather than pg_dump direct from the dyno.

Comments are closed.