Created
February 16, 2012 15:58
-
-
Save aledalgrande/1845935 to your computer and use it in GitHub Desktop.
Capistrano configuration for RVM, bundler, Sinatra and Unicorn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/capistrano" | |
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) | |
require "rvm/capistrano" | |
set :rvm_ruby_string, '1.9.2@sinatroxy' | |
set :rvm_type, :system | |
set :bundle_flags, "--deployment" | |
set :application, "sinatroxy" | |
set :repository, "xxx@yyy:sinatroxy" | |
set :rack_env, :production | |
set :scm, :git | |
default_run_options[:pty] = true | |
set :user, "deployer" | |
set :group, "deployer" | |
set :use_sudo, false | |
role :web, "pod-delivery" | |
role :app, "pod-delivery" | |
role :db, "pod-delivery", :primary => true | |
set :deploy_to, "/var/www/#{application}/" | |
# set :deploy_via, :remote_cache | |
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
# before "deploy", "deploy:install_bundler" | |
namespace :deploy do | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} ; bundle exec unicorn -c #{current_path}/config/unicorn.rb -D -E #{rack_env};" | |
end | |
task :stop, :roles => :app, :except => { :no_release => true } do | |
run "#{try_sudo} kill `cat #{unicorn_pid}`" | |
end | |
task :graceful_stop, :roles => :app, :except => { :no_release => true } do | |
run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`" | |
end | |
task :reload, :roles => :app, :except => { :no_release => true } do | |
run "#{try_sudo} kill -s USR2 `cat #{unicorn_pid}`" | |
end | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
stop | |
start | |
end | |
task :install_bundler do | |
run "cd #{current_path} ; gem install bundler" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment