-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpuma.rb.example
40 lines (30 loc) · 1.01 KB
/
puma.rb.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env puma
rackup DefaultRackup
tag 'staff_development'
directory 'PATH_TO_PROJECT'
environment 'development'
state_path 'PATH_TO_PROJECT/tmp/pids/puma.state'
pidfile 'PATH_TO_PROJECT/tmp/pids/puma.pid'
# stdout_redirect 'PATH_TO_PROJECT/log/puma-stdout.log', 'PATH_TO_PROJECT/log/puma-stderr.log'
threads 2, 5
port 9002
workers 2
worker_timeout 5000
preload_app!
on_restart do
puts 'Refreshing Gemfile'
ENV['BUNDLE_GEMFILE'] = 'PATH_TO_PROJECT/Gemfile'
end
before_fork do
require 'puma_worker_killer'
PumaWorkerKiller.config do |config|
config.ram = 512 # mb
config.frequency = 5 # seconds
config.percent_usage = 0.90
config.rolling_restart_frequency = 6 * 3600 # in seconds
config.reaper_status_logs = false # setting this to false will not log lines like:
# PumaWorkerKiller: Consuming 54.34765625 mb with master and 2 workers.
config.pre_term = -> (worker) { puts "Worker #{worker.inspect} being killed" }
end
PumaWorkerKiller.start
end