Heroku database -> Amazon S3 backup via rake task
With Heroku’s basic database plan, it’s easy to run heroku pgbackups:capture
every once in awhile and save a pg_dump backup of your database - but it’s not as easy as it should be to set up automatic backups of your application’s shared database. By combining Heroku’s nifty Cron Add-On (runs a Rake task via rake cron
daily for free) with its existing PG Backups support, you can pretty easily get the platform to help you back up your application.
This assumes you have some amazon_s3.yml file in your config with your AWS credentials and your Heroku credentials set in your environment variables.
This currently works under Rails 3.06 and Heroku gem version 2.1.3.
While trying to get this all to work, I borrowed generously from http://librarymixer.posterous.com/40960547 (seemed to work under the Heroku gem version 1.19.1) and http://metaskills.net/2011/01/03/automating-heroku-pg-backups/, with lots of tweaking necessary to account for gem updates.
Let me know what you think on Twitter.