Some nice rake tasks for Heroku’s pgbackups¶ ↑
Allows you to do
$ rake pgbackup:seed # capture pgbackup from production and load into development $ rake pgbackup:to_staging # capture pgbackup from production and load into staging
Installation¶ ↑
-
Add pgbackup-tasks to gemfile
gem 'pgbackup-tasks'
-
Bundle install
$ bundle
-
Make sure you’re using postgres for development.
# config/database.yml development: adapter: postgresql database: myapp_development ...
-
Make your heroku app’s remote names production and staging (as recommended in this heroku help article)
# git/config [remote "production"] url = git@heroku.com:myapp.git [remote "staging"] url = git@heroku.com:myapp-staging.git
-
Make sure you have the pgbackup add-on installed for your heroku apps.
$ heroku addons:add pgbackups --remote production $ heroku addons:add pgbackups --remote staging
-
Go for it!
$ bundle exec rake pgbackup:seed
To Do¶ ↑
- add rails 2 support - check to see that production and staging remotes are set (with nice warning) - nice output (downloading, saving, restoring) - hide "private" rake tasks - silence pg_restore output - figure out the best place to store backups