puma: add puma worker killer gem.
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -54,6 +54,7 @@ gem 'terminal-table'
|
||||
gem 'newrelic_rpm', require: false
|
||||
gem 'clockwork'
|
||||
gem 'puma-metrics'
|
||||
gem 'puma_worker_killer'
|
||||
|
||||
group :production, :staging do
|
||||
gem 'unicorn', :platforms => :ruby
|
||||
|
||||
@@ -331,6 +331,9 @@ GEM
|
||||
puma-metrics (1.2.3)
|
||||
prometheus-client (>= 0.10)
|
||||
puma (>= 3.0)
|
||||
puma_worker_killer (0.3.1)
|
||||
get_process_mem (~> 0.2)
|
||||
puma (>= 2.7)
|
||||
pundit (2.1.1)
|
||||
activesupport (>= 3.0.0)
|
||||
racc (1.5.2)
|
||||
@@ -562,6 +565,7 @@ DEPENDENCIES
|
||||
pry-rails
|
||||
puma
|
||||
puma-metrics
|
||||
puma_worker_killer
|
||||
pundit
|
||||
rack-mini-profiler
|
||||
rails (~> 6.0)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# * PUMA_PIDFILE
|
||||
# * PUMA_CONTROL_URL
|
||||
# * PUMA_METRICS_URL
|
||||
# * PUMA_RESTART_INTERVAL
|
||||
#
|
||||
# Use `bin/pumactl` to control a running Puma instance.
|
||||
#
|
||||
@@ -105,3 +106,12 @@ metrics_url ENV.fetch("PUMA_METRICS_URL", "tcp://localhost:9393")
|
||||
#
|
||||
# https://github.com/puma/puma#controlstatus-server
|
||||
activate_control_app ENV.fetch("PUMA_CONTROL_URL", "tcp://localhost:9293"), no_token: true
|
||||
|
||||
# https://github.com/schneems/puma_worker_killer
|
||||
# https://docs.gitlab.com/ee/administration/operations/puma.html#puma-worker-killer
|
||||
before_fork do
|
||||
require 'puma_worker_killer'
|
||||
|
||||
PumaWorkerKiller.rolling_restart_splay_seconds = 0.0..180.0 # 0 to 3 minutes in seconds
|
||||
PumaWorkerKiller.enable_rolling_restart ENV.fetch("PUMA_RESTART_INTERVAL", 2 * 60 * 60).to_i # every 2 hours by default
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user