Skip to content

Instantly share code, notes, and snippets.

@schnittchen
Created November 5, 2012 10:02
Show Gist options
  • Save schnittchen/4016423 to your computer and use it in GitHub Desktop.
Save schnittchen/4016423 to your computer and use it in GitHub Desktop.
Using backup gem in rails project with separate Gemfile
Note: the full file names are config/backup/Gemfile and config/deploy.rb, which gist.github.com can't handle ;-)
Of course, you will need a backup config file, preferrably in config/backup/config.rb, and you need to trigger the backup from cron (check out the whenever gem if you want that behaviour bundled with your rails app).
In both files, you need to take the locations of stuff (rails root, backup config file) into consideration.
source 'http://rubygems.org'
# your exact requirements depend on the way you use backup and the version of the backup gem.
# Be sure to have a look at https://github.com/meskyanichi/backup/blob/master/lib/backup/dependency.rb
# at the relevant version!
gem 'backup', '3.0.24'
gem 'fog', '~> 1.1.0'
gem 'mail', '~> 2.4.0'
...
after "deploy:update_code", "deploy:bundle_for_backup"
namespace :deploy do
task(:bundle_for_backup) do
run "cd #{release_path}/config/backup && bundle install --quiet --deployment"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment