Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
deploy use unicorn and nginx
set :application, "hermes"
set :repository, "git@your_repository:hermes.git"
set :user, 'root'
set :use_sudo, false
set :deploy_via, :remote_cache
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
role :web, "xxx.com" # Your HTTP server, Apache/etc
role :app, "xxx.com" # This may be the same as your `Web` server
role :db, "xxx.com", :primary => true # This is where Rails migrations will run
#role :db, "your slave db-server here"
set :deploy_to, "/path/to/app/#{application}"
# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts
# If you are using Passenger mod_rails uncomment this:
# namespace :deploy do
# task :start do ; end
# task :stop do ; end
# task :restart, :roles => :app, :except => { :no_release => true } do
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
# end
# end
before "deploy", "deploy:bundle_gems"
before "deploy:restart", "deploy:bundle_gems"
#after "deploy:bundle_gems", "deploy:restart"
#after "deploy:bundle_gems", "deploy:restart"
set :unicorn_pid, "#{deploy_to}/shared/pids/unicorn.pid"
set :bundle, "/var/lib/gems/1.9.1/bin//bundle"
set :unicorn_rails, "/var/lib/gems/1.9.1/bin//unicorn_rails"
namespace :deploy do
task :bundle_gems do
run "cd #{deploy_to}/current && #{bundle} install --path vendor/gems"
end
task :start, :roles => :app, :except => { :no_release => true} do
run "#{unicorn_rails} -c #{deploy_to}/current/config/unicorn.rb -D -E production"
end
task :stop, :roles => :app, :except => { :no_release => true} do
run "kill `cat #{unicorn_pid}`"
end
task :reload, :roles => :app, :except => { :no_release => true } do
run "kill -s USR2 `cat #{unicorn_pid}`"
end
task :restart, :roles => :app, :except => { :no_release => true } do
stop
start
end
end
after "migration:reload", "deploy:restart"
namespace :migration do
task :reload, :roles => :app, :except => { :no_release => true } do
run "cd #{deploy_to}/current && rake db:drop:all && rake db:migrate RAILS_ENV='production' && rake db:seed RAILS_ENV='production'"
end
end
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.