Guest User

Untitled

a guest
Mar 17th, 2018
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. load 'deploy'
  2.  
  3. set :application, "analytics"
  4. set :repository, "gitosis@192.168.0.63:analytics.git"
  5. set :deploy_via, :remote_cache
  6. set :deploy_to, "/u/apps/#{application}"
  7. set :scm, :git
  8. set :user, "app"
  9. set :use_sudo, false
  10.  
  11. set :node_port, 7777
  12. set :node_pid, "#{shared_path}/pids/node-#{node_port}.pid"
  13. set :node_log, "#{shared_path}/log/node-#{node_port}.log"
  14. set :node_socket, "#{shared_path}/sockets/node"
  15. set :node_session, "#{shared_path}"
  16.  
  17. server "sleepy", :web, :app
  18.  
  19. after "deploy:setup", "app:setup_sockets"
  20.  
  21. namespace :app do
  22. task :setup_sockets, :roles => [:app] do
  23. run "mkdir #{shared_path}/sockets"
  24. end
  25.  
  26. task :attach do
  27. run "dtach -a #{node_socket}"
  28. end
  29. end
  30.  
  31. namespace :deploy do
  32. task :start do
  33. node_cmd = "node #{current_path}/app.js --port #{node_port} --pid #{node_pid} > #{node_log}"
  34. run "cd #{current_path} && dtach -n #{node_socket} #{node_cmd}"
  35. end
  36.  
  37. task :stop do
  38. run "kill `cat #{node_pid}` && rm #{node_pid}"
  39. end
  40. end
Add Comment
Please, Sign In to add comment