Skip to content

Instantly share code, notes, and snippets.

@maxmmurphy
Created April 23, 2012 20:18
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 maxmmurphy/2473545 to your computer and use it in GitHub Desktop.
Save maxmmurphy/2473545 to your computer and use it in GitHub Desktop.
unicorn, rvm and capistrano
require "rvm/capistrano" # Load RVM's capistrano plugin.
require "bundler/capistrano"
set :server, :unicorn
set :unicorn_remote_config, "#{shared_path}/config/unicorn.rb"
set :unicorn_pid, "#{shared_path}/pids/unicorn.pid"
set :rvm_bin_path, "/usr/local/rvm/bin"
set :rvm_type, :system
namespace :deploy do
task :start do
run "cd #{current_path} && bundle exec unicorn -c #{unicorn_remote_config} -E #{rails_env} -D"
end
task :stop do
run "kill -QUIT `cat #{unicorn_pid}`"
end
task :restart do
File.exists?(unicorn_pid) ? run("kill -USR2 `cat #{unicorn_pid}`") : start
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment