Guest User

Untitled

a guest
Jul 20th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. require 'capistrano/ext/multistage'
  2.  
  3. set :application, "hyperactive"
  4. set :repository, "git://git.escapegoat.org/hyperactive.git"
  5. set(:rails_env) { "#{stage}" }
  6. set :keep_releases, 2 # number of deployed releases to keep
  7. set :scm, :git # defaults to :subversion
  8. set :scm_verbose, true
  9. set :use_sudo, true
  10. set :user, "hyper"
  11.  
  12. namespace :deploy do
  13.  
  14. # This is my experimental solution to the problem of restarting
  15. # backgroundrb during deployment.
  16. #
  17. namespace :backgroundrb do
  18. desc "Start backgroundrb for video encoding"
  19. task :start do
  20. run "cd #{deploy_to}current; rake backgroundrb:start RAILS_ENV=#{stage}"
  21. end
  22.  
  23. desc "Stop backgroundrb for video encoding"
  24. task :stop do
  25. run "cd #{deploy_to}current; rake backgroundrb:stop RAILS_ENV=#{stage}"
  26. end
  27.  
  28. desc "Restart backgroundrb for video encoding"
  29. task :restart do
  30. run "cd #{deploy_to}current; rake backgroundrb:restart RAILS_ENV=#{stage}"
  31. end
  32. end # end of backgroundrb namespace
  33.  
  34.  
  35. desc "Restarting mod_rails with restart.txt"
  36. task :restart, :roles => :app, :except => { :no_release => true } do
  37. run "touch #{current_path}/tmp/restart.txt"
  38. end
  39.  
  40. [:start, :stop].each do |t|
  41. desc "#{t} task is a no-op with mod_rails"
  42. task t, :roles => :app do ; end
  43. end
  44.  
  45. # desc "An after-update task to copy configurations into place."
  46. task :after_update_code, :roles => :app do
  47. db_config = "#{shared_path}/database.yml.production"
  48. run "cp #{db_config} #{release_path}/config/database.yml"
  49. mods_config = "#{shared_path}/mods_enabled.list"
  50. run "cp #{mods_config} #{release_path}/config/mods_enabled.list"
  51. dk_initializer = "#{current_path}/mods/denmark/config/initializers/dk_initializer.rb"
  52. run "cp #{dk_initializer} #{current_path}/config/initializers/dk_initializer.rb"
  53. end
  54.  
  55. desc "A task demonstrating the use of transactions."
  56. task :long_deploy do
  57. backgroundrb.stop
  58. transaction do
  59. # chown_current_to_deployment_user
  60. update_code
  61. deploy.web:disable
  62. symlink
  63. migrate
  64. end
  65. restart
  66. backgroundrb.start
  67. deploy.web:enable
  68. cleanup
  69. # chown_to_www_data
  70. end
  71.  
  72. # desc "Change group to deployment user so perms on the server actually work"
  73. # task :chown_current_to_deployment_user, :roles => [ :app, :db, :web ] do
  74. # sudo "chown -R #{user}:#{user} #{current_path}/*"
  75. # end
  76.  
  77. # desc "Change group to www-data"
  78. # task :chown_to_www_data, :roles => [ :app, :db, :web ] do
  79. # sudo "chown -R www-data:www-data #{deploy_to}/releases/"
  80. # sudo "chown -R www-data:www-data #{current_path}"
  81. # end
  82.  
  83. end
Add Comment
Please, Sign In to add comment