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
namespace :deploy do | |
task :start, :roles => :web, :except => { :no_release => true } do | |
run "cd #{current_path} && rvmsudo #{unicorn_binary} -c #{unicorn_config} -E #{env} -D" | |
end | |
task :stop, :roles => :web, :except => { :no_release => true } do | |
run "ps aux | grep unicorn | grep master | grep -v grep | awk {'print $2'} | xargs -r sudo kill -s QUIT" | |
#run "rvmsudo kill -s QUIT `cat #{unicorn_pid}`" | |
end |
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
upstream app_server { | |
server unix:/tmp/unicorn.sock fail_timeout=0; | |
} | |
server { | |
root /srv/deploy/current/public; | |
try_files $uri/index.html $uri.html $uri @app; | |
location @app { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; |
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
# run unicorn with unicorn -c Rails.root/current/config/unicorn.rb -E production -D | |
rails_env = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'production' | |
# 12 workers and 1 master | |
worker_processes (rails_env == 'production' ? 12 : 4) | |
# Load rails+github.git into the master before forking workers | |
# for super-fast worker spawn times | |
preload_app true |