Guest User

Untitled

a guest
Feb 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. set :stages, %w(staging production)
  2. set :default_stage, "staging"
  3. require 'capistrano/ext/multistage'
  4.  
  5. default_run_options[:pty] = true
  6.  
  7. ssh_options[:forward_agent] = true
  8. set :keep_releases, 10
  9.  
  10. set :application, "extranet"
  11. set :user, "deploy"
  12.  
  13. set :rails_env, "production"
  14.  
  15. set :rake, "/var/lib/gems/1.8/bin/rake"
  16. set :use_sudo, false
  17.  
  18. # Target directory for the application on the web and app servers.
  19. set :deploy_to, "/var/apps/#{application}"
  20. set :repository, "git@github.com:obtiva/els_#{application}.git"
  21. set :scm, :git
  22. set :branch, "master"
  23. set :git_enable_submodules, true
  24. set :git_shallow_clone, true
  25.  
  26. task :after_after_update_code, :roles => :app do
  27. desc "Set up link to shared cache directory"
  28. run "ln -s #{shared_path}/cache #{release_path}/cache"
  29.  
  30. desc "Set up link to shared upload directory"
  31. run "ln -s #{shared_path}/uploads #{release_path}/tmp/uploads"
  32.  
  33. desc "Set up link to product images directory"
  34. run "ln -s #{shared_path}/product_images #{release_path}/public/images/products"
  35. end
  36.  
  37. task :restart_backgroundrb, :roles => :app do
  38. desc "Restart BackgrounDRb server. Please be careful not to kill any existing Workers!!!"
  39. run "cd #{current_path} && ./script/backgroundrb stop && ./script/backgroundrb start"
  40. end
  41.  
  42. task :tail_production_logs, :roles => :app do
  43. desc "tail production log files"
  44. run "tail -f #{current_path}/log/production.log" do |channel, stream, data|
  45. # puts # for an extra line break before the host name
  46. puts "#{channel[:host]}_production: #{data}"
  47. break if stream == :err
  48. end
  49. end
  50.  
  51. task :tail_backgroundrb_logs, :roles => :app do
  52. run "tail -f #{current_path}/log/backgroundrb.log" do |channel, stream, data|
  53. # puts # for an extra line break before the host name
  54. puts "#{channel[:host]}_backgroundrb: #{data}"
  55. break if stream == :err
  56. end
  57. end
  58.  
  59. namespace :passenger do
  60. desc "Restart Application"
  61. task :restart do
  62. run "touch #{current_path}/tmp/restart.txt"
  63. end
  64. end
  65.  
  66. after :deploy, "passenger:restart"
Add Comment
Please, Sign In to add comment