Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 1.00 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. set :domain, "goyman.com"
  2. set :application, "goyman.com"
  3. set :deploy_to, "/web/sites/#{domain}"
  4.  
  5. set :user, "web"
  6. set :use_sudo, false
  7.  
  8. set :scm, :git
  9. set :repository,  "git@github.com:goyman/Goyman.com.git"
  10. set :branch, 'master'
  11. set :git_shallow_clone, 1
  12.  
  13. role :web, domain
  14. role :app, domain
  15. role :db,  domain, :primary => true
  16.  
  17. pid_path = "#{deploy_to}/shared/unicorn.pid"
  18. socket_path = "#{deploy_to}/shared/unicorn.sock"
  19.  
  20. start_cmd = %|source "/web/.rvm/scripts/rvm" && rvm use 1.9.2 &&  socket_path=#{socket_path} pid_path=#{pid_path} unicorn  -c config/unicorn.rb -D -E production|
  21. stop_cmd = "kill -TERM `cat #{pid_path}`"
  22.  
  23. namespace :deploy do
  24.   task :finalize_update do
  25.     run "mkdir -p #{deploy_to}/shared"
  26.   end
  27.  
  28.   task :restart do
  29.     run "cd #{current_path}; [ -f #{pid_path} ] && kill -TERM `cat #{pid_path}` ; #{start_cmd}"
  30.   end
  31.  
  32.   desc "Start unicorn server"
  33.   task :start do
  34.     run "cd #{current_path} && #{start_cmd}"
  35.   end
  36.  
  37.   desc "Stop unicorn server"
  38.   task :stop do
  39.     run stop_cmd
  40.   end
  41.  
  42. end