Skip to content

Instantly share code, notes, and snippets.

@yuvalkarmi
Created June 3, 2012 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuvalkarmi/2860967 to your computer and use it in GitHub Desktop.
Save yuvalkarmi/2860967 to your computer and use it in GitHub Desktop.
deploy.rb
set :application, "myapp.com"
role :app, application
role :web, application
role :db, application, :primary => true
set :user, "myuser"
set :deploy_to, "/home/#{user}/#{application}"
set :use_sudo, false
set :scm, "git"
set :repository, "mygitrepository.git"
set :branch, "master"
set :git_shallow_clone, 1
set :scm_verbose, true
set :rvm_ruby_string, '1.9.3'
set :rvm_type, :user
default_run_options[:pty] = true
namespace :deploy do
desc "Tell Passenger to restart the app."
task :restart do
run "touch #{current_path}/tmp/restart.txt"
end
desc "Symlink shared configs and folders on each release."
task :symlink_shared do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
run "ln -nfs #{shared_path}/system #{release_path}/public/system"
run "ln -nfs #{release_path} #{current_path}"
end
desc "Migrate DB"
task :migrate_db do
run "cd #{current_path} && bundle exec rake db:migrate RAILS_ENV=production"
run "touch #{current_path}/tmp/restart.txt"
end
desc "Bundle gems"
task :bundle_install do
run "cd #{current_path} && bundle install"
run "touch #{current_path}/tmp/restart.txt"
end
desc "Update gems"
task :bundle_update do
run "cd #{current_path} && bundle update"
run "touch #{current_path}/tmp/restart.txt"
end
end
after 'deploy:update_code', 'deploy:symlink_shared', 'deploy:migrate_db', 'deploy:bundle_install'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment