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

Untitled

By: a guest on Jul 24th, 2012  |  syntax: None  |  size: 2.05 KB  |  hits: 8  |  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 :ident, "cluster-io"
  2. set :user, "ec2-user"
  3. set :application, "#{ident}"
  4. set :repository, "git://gist.github.com/1902783.git"
  5. set :scm, :git
  6. set :branch, "master"
  7. set :scm_verbose, true
  8. set :deploy_to, "/home/#{user}/app/#{application}"
  9. set :deploy_via, :copy
  10. set :git_shallow_clone, 1
  11. set :workers, 4
  12. set :node_env, 'production'
  13.  
  14. # benchmarker
  15. role :web, "ec2-46-51-229-142.ap-northeast-1.compute.amazonaws.com"
  16. role :web, "ec2-175-41-203-216.ap-northeast-1.compute.amazonaws.com"
  17.  
  18. role :web, "ec2-176-34-0-153.ap-northeast-1.compute.amazonaws.com"
  19. role :app, "ec2-176-34-0-153.ap-northeast-1.compute.amazonaws.com"
  20. role :web, "ec2-176-34-32-184.ap-northeast-1.compute.amazonaws.com"
  21. role :app, "ec2-176-34-32-184.ap-northeast-1.compute.amazonaws.com"
  22. role :web, "ec2-175-41-214-57.ap-northeast-1.compute.amazonaws.com"
  23. role :app, "ec2-175-41-214-57.ap-northeast-1.compute.amazonaws.com"
  24. role :web, "ec2-46-51-229-149.ap-northeast-1.compute.amazonaws.com"
  25. role :app, "ec2-46-51-229-149.ap-northeast-1.compute.amazonaws.com"
  26.  
  27. namespace :deploy do
  28.   task :start, :roles => :app do
  29.     run "NODE_ENV=#{node_env} WORKERS=#{workers} forever start #{current_path}/cluster.js"
  30.   end
  31.   task :stop, :roles => :app do
  32.     run "forever stop #{current_path}/cluster.js"
  33.   end
  34.   task :restart, :roles => :app, :except => { :no_release => true } do
  35.     run "NODE_ENV=#{node_env} WORKERS=#{workers} forever restart #{current_path}/cluster.js"
  36.   end
  37. end
  38.  
  39. after "deploy:create_symlink", :roles => :app do
  40.   run "ln -svf #{shared_path}/node_modules #{current_path}/node_modules"
  41.   run "cd #{current_path} && npm install --mongodb:native --production"
  42. end
  43.  
  44. namespace :prepare do
  45.   task :dir do
  46.     run "mkdir -p ~/app/#{application}/releases"
  47.     run "mkdir -p ~/app/#{application}/shared"
  48.     run "mkdir -p ~/app/#{application}/shared/node_modules"
  49.   end
  50.  
  51.   task :node do
  52.     run "#{try_sudo} yum install git openssl-devel"
  53.     run "#{try_sudo} yum groupinstall \"Development Tools\""
  54.     run "git clone https://github.com/isaacs/nave.git ~/.nave"
  55.     run "#{try_sudo} ~/.nave/nave.sh usemain 0.6.11"
  56.   end
  57. end