A simple rake task for backing up a Rails 3 application’s database using the Backup gem.
Add the gem to your Gemfile.
gem 'backup-task'
Create a backup configuration file in config/backup.rb, with a trigger called db_backup. See github.com/meskyanichi/backup/wiki/Getting-Started for details. Be sure to move the resulting file to config/backup.rb within your Rails app and to name your trigger ‘db_backup’.
Once you’ve done a ‘bundle install’ you should be able to run the backup task
rake db:backup
This will back up your database according to the configuration in config/backup.rb. It will use the tmp, log, and db directories from your Rails app to avoid conflicting with any other backups happening on the same system.
Bug reports, pull requests, etc are welcome at github.com/edebill/backup-task or you can email the author at [email protected].
Copyright © 2011 Erik DeBill. See LICENSE.txt for further details.