Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

deploy.rb

View gist:2860967
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
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
Something went wrong with that request. Please try again.