Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'capistrano/all'
- lock '3.4.0'
- set :application, 'project'
- set :repo_url, 'git@github.com:Company/project.git'
- set :deploy_to, "/var/www/#{fetch(:application)}"
- set :scm, :git
- set :format, :pretty
- set :log_level, :info
- set :pty, false
- set :linked_files, %w{some files}
- set :keep_releases, 5
- set :user, "project_user"
- set :use_sudo, true
- set :stages, %w(production staging)
- set :default_stage, 'staging'
- require 'capistrano/setup'
- require 'capistrano/deploy'
- require 'capistrano/bundler'
- require 'capistrano/rails/assets'
- require 'capistrano/rails/migrations'
- require 'capistrano/sidekiq'
- Dir.glob('capistrano/tasks/*.rake').each { |r| import r }
- namespace :deploy do
- desc 'Generate sidekiq assets'
- task :publishing do
- on roles(:app), in: :sequence, wait: 5 do
- sidekiq_asset_path = capture("cd #{current_path} && bundle show sidekiq").split("\n")[0] + "/web/assets/."
- execute "cp -R \"#{sidekiq_asset_path}\" \"#{current_path}/public/sidekiq\""
- end
- end
- desc 'Restart application'
- task :finishing do
- on roles(:app), :in => :sequence, :wait => 5 do
- execute "sudo systemctl reload #{fetch(:application)}"
- execute "sudo systemctl restart #{fetch(:application)}_sidekiq"
- execute "sudo nginx -s reload"
- end
- end
- end
- #Capistrano::Application.invoke("production")
- Capistrano::Application.invoke("deploy")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement