Skip to content

Commit

Permalink
Gracefull pump restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Oct 18, 2016
1 parent aae774f commit 8c28d7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@
set :nginx_read_timeout, 60
set :app_server_port, 5000

set :puma_conf, "#{current_path}/config/puma.rb"
set :puma_state, "#{shared_path}/tmp/pids/puma.state"

set :maintenance_template_path, File.join(File.expand_path('../../public/system', __FILE__), 'maintenance.html')
11 changes: 7 additions & 4 deletions config/deploy/production.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
server ENV['WEB_SERVER'], user: ENV['WEB_USER'], roles: %w{app web}
server ENV['SIDEKIQ_SERVER'], user: ENV['SIDEKIQ_USER'], roles: %w{app}
server ENV['SIDEKIQ_SERVER2'], user: ENV['SIDEKIQ_USER'], roles: %w{app}
server ENV['SIDEKIQ_SERVER3'], user: ENV['SIDEKIQ_USER'], roles: %w{app}
server ENV['SIDEKIQ_SERVER'], user: ENV['SIDEKIQ_USER'], roles: %w{app worker}
server ENV['SIDEKIQ_SERVER2'], user: ENV['SIDEKIQ_USER'], roles: %w{app worker}
server ENV['SIDEKIQ_SERVER3'], user: ENV['SIDEKIQ_USER'], roles: %w{app worker}

namespace :deploy do
task :restart do
on roles(:app) do |host|
on roles(:worker) do |host|
execute "restart librariesio"
end
on roles(:web) do |host|
execute "cd #{current_path} && bundle exec pumactl -P #{fetch(:puma_state)} -F #{fetch(:puma_conf)} restart"
end
end
after :publishing, :restart
end

0 comments on commit 8c28d7c

Please sign in to comment.