Created
February 12, 2015 21:08
-
-
Save maxim/bdddd0343fdfe5451eaf to your computer and use it in GitHub Desktop.
puma.rb.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# {{ ansible_managed }} | |
require 'puma_worker_killer' | |
daemonize false | |
directory '/srv/{{ app_name }}' | |
threads {{ puma_threads_min }}, {{ puma_threads_max }} | |
workers {{ ansible_processor_vcpus }} | |
bind 'unix:///var/run/{{ app_name }}/{{ app_name }}.sock' | |
prune_bundler | |
tag '{{ app_name }}' | |
worker_timeout {{ request_timeout_sec }} | |
pwk_started = false | |
after_worker_boot do | |
unless pwk_started | |
pwk_started = true | |
PumaWorkerKiller.config do |config| | |
config.ram = {{ ansible_memtotal_mb }} | |
config.percent_usage = {{ puma_mem_percent }} | |
config.frequency = 20 # seconds | |
end | |
PumaWorkerKiller.start | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment