Skip to content

Instantly share code, notes, and snippets.

@rrrodrigo
Created November 18, 2009 10:29
Show Gist options
  • Save rrrodrigo/237732 to your computer and use it in GitHub Desktop.
Save rrrodrigo/237732 to your computer and use it in GitHub Desktop.
Capfile used for a unicorn-based deployment of a Rails app
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
namespace :deploy do
desc "Restart the master unicorn process"
task :restart do
run "kill -USR2 `cat #{deploy_to}/shared/pids/unicorn.pid`"
end
desc "Start unicorn server"
task :start do
run "cd #{deploy_to}/current && unicorn_rails -c config/unicorn.config -E production -D"
end
desc "Stop unicorn server"
task :stop do
run "kill -TERM `cat #{deploy_to}/shared/pids/unicorn.pid`"
end
desc "Link in the config *.yml files"
task :after_update_code do
run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/"
run "ln -nfs #{deploy_to}/#{shared_dir}/config/unicorn.config #{release_path}/config/"
run "ln -nfs #{deploy_to}/#{shared_dir}/config/config.local.yml #{release_path}/config/"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment