Guest User

Untitled

a guest
Jan 22nd, 2018
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. $:.unshift(File.expand_path('./lib', ENV['rvm_path']))
  2. require "rvm/capistrano"
  3.  
  4. # REPLACE this below with your ruby version/gemset version: YOUR_RUBY_VERSION@YOUR_GEM_SET
  5. set :rvm_ruby_string, 'ruby-1.9.2-p136@example_gemset'
  6.  
  7. set :use_sudo, false
  8. set :stages, %w(production staging)
  9. set :default_stage, "staging"
  10. require 'capistrano/ext/multistage'
  11.  
  12. # REPLACE this below with your git repo
  13. set :repository, "git@github.com:example/example.git"
  14. set :scm, :git
  15. set :branch, "master"
  16. set :deploy_via, :remote_cache
  17.  
  18. # REPLACE the below with your deploy server credentials/server domain name (or ip)
  19. set :user, 'exampleuser'
  20. server "example.com", :app, :web, :db, :primary => true
  21.  
  22. after "deploy:update_code",
  23. "deploy:update_shared_symlinks"
  24.  
  25. set :bundle_flags, '--deployment'
  26. require "bundler/capistrano"
  27.  
  28. after "bundle:install",
  29. "deploy:migrate"
  30.  
  31. after "deploy",
  32. "deploy:cleanup"
  33.  
  34. namespace :deploy do
  35. task :start do ; end
  36. task :stop do ; end
  37.  
  38. # This task with bounce the standalone passenger server (running the embedded nginx server).
  39. # The rails_env and passenger_port are specified in the deploy environment files, ex: "config/deploy/staging.rb"
  40. desc "Restart Passenger server"
  41. task :restart, :roles => :app, :except => { :no_release => true } do
  42. run <<-CMD
  43. if [[ -f #{release_path}/tmp/pids/passenger.#{passenger_port}.pid ]];
  44. then
  45. cd #{deploy_to}/current && passenger stop -p #{passenger_port} --pid-file #{release_path}/tmp/pids/passenger.#{passenger_port}.pid;
  46. fi
  47. CMD
  48. # restart passenger standalone on the specified port/environment and as a daemon
  49. run "cd #{deploy_to}/current && #{try_sudo} passenger start -e #{rails_env} -p #{passenger_port} -d"
  50. end
  51.  
  52. desc "Update shared symbolic links"
  53. task :update_shared_symlinks do
  54. shared_files = ["config/database.yml"]
  55. shared_files.each do |path|
  56. run "rm -rf #{File.join(release_path, path)}"
  57. run "ln -s #{File.join(deploy_to, "shared", path)} #{File.join(release_path, path)}"
  58. end
  59. end
  60. end
Add Comment
Please, Sign In to add comment