PageRenderTime 29ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/config/deploy.rb

https://bitbucket.org/thyforhtian/services_manager
Ruby | 67 lines | 34 code | 15 blank | 18 comment | 0 complexity | 023cb7ac5b8b941e24074b0436de6c24 MD5 | raw file
  1. require "bundler/capistrano"
  2. require "capistrano_database"
  3. set :application, "railstest"
  4. set :repository, "file://."
  5. # set :repository, "git@bitbucket.org:thyforhtian/backbone-sinatra-test.git"
  6. set :deploy_to, "/usr/share/nginx/html/#{application}"
  7. # set :deploy_via, :remote_cache
  8. set :deploy_via, :copy
  9. set :user, "deployer"
  10. set :group, "nginx"
  11. set :use_sudo, false
  12. set :environment, :production
  13. set :default_environment, { 'PATH' => "/home/deployer/.rbenv/shims:/home/deployer/.rbenv/bin:$PATH" }
  14. set :bundle_flags, "--deployment --quiet --binstubs --shebang ruby-local-exec"
  15. # set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
  16. # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
  17. role :web, "luchowski.net" # Your HTTP server, Apache/etc
  18. role :app, "luchowski.net" # This may be the same as your `Web` server
  19. role :db, "luchowski.net", :primary => true # This is where Rails migrations will run
  20. # if you want to clean up old releases on each deploy uncomment this:
  21. # after "deploy:restart", "deploy:cleanup"
  22. # if you're still using the script/reaper helper you will need
  23. # these http://github.com/rails/irs_process_scripts
  24. # If you are using Passenger mod_rails uncomment this:
  25. # namespace :deploy do
  26. # task :start do ; end
  27. # task :stop do ; end
  28. # task :restart, :roles => :app, :except => { :no_release => true } do
  29. # run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  30. # end
  31. # end
  32. def surun(command)
  33. default_run_options[:pty] = true
  34. password = fetch(:root_password, Capistrano::CLI.password_prompt("root password: "))
  35. run("su root -c #{command}") do |channel, stream, output|
  36. channel.send_data("#{password}\n")
  37. end
  38. end
  39. # namespace :deploy do
  40. # end
  41. namespace :bluepill do
  42. task :start do
  43. surun "'bluepill load /usr/share/nginx/html/#{application}/current/config/#{application}.pill'"
  44. end
  45. task :restart do
  46. surun "'bluepill #{application} restart'"
  47. end
  48. task :stop do
  49. surun "'bluepill #{application} stop'"
  50. end
  51. end
  52. after "deploy:update", "bluepill:restart"