Advertisement
Guest User

Untitled

a guest
Nov 16th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.38 KB | None | 0 0
  1. require 'capistrano/all'
  2. lock '3.4.0'
  3.  
  4. set :application, 'project'
  5. set :repo_url, 'git@github.com:Company/project.git'
  6. set :deploy_to, "/var/www/#{fetch(:application)}"
  7. set :scm, :git
  8. set :format, :pretty
  9. set :log_level, :info
  10. set :pty, false
  11. set :linked_files, %w{some files}
  12. set :keep_releases, 5
  13. set :user, "project_user"
  14. set :use_sudo, true
  15. set :stages, %w(production staging)
  16. set :default_stage, 'staging'
  17.  
  18. require 'capistrano/setup'
  19. require 'capistrano/deploy'
  20. require 'capistrano/bundler'
  21. require 'capistrano/rails/assets'
  22. require 'capistrano/rails/migrations'
  23. require 'capistrano/sidekiq'
  24.  
  25. Dir.glob('capistrano/tasks/*.rake').each { |r| import r }
  26.  
  27. namespace :deploy do
  28.  
  29.   desc 'Generate sidekiq assets'
  30.   task :publishing do
  31.     on roles(:app), in: :sequence, wait: 5 do
  32.       sidekiq_asset_path = capture("cd #{current_path} && bundle show sidekiq").split("\n")[0] + "/web/assets/."
  33.       execute "cp -R \"#{sidekiq_asset_path}\" \"#{current_path}/public/sidekiq\""
  34.     end
  35.   end
  36.  
  37.   desc 'Restart application'
  38.   task :finishing do
  39.     on roles(:app), :in => :sequence, :wait => 5 do
  40.       execute "sudo systemctl reload #{fetch(:application)}"
  41.       execute "sudo systemctl restart #{fetch(:application)}_sidekiq"
  42.       execute "sudo nginx -s reload"
  43.     end
  44.   end
  45.  
  46. end
  47.  
  48. #Capistrano::Application.invoke("production")
  49. Capistrano::Application.invoke("deploy")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement