Skip to content

Instantly share code, notes, and snippets.

@maxim
Created February 12, 2015 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxim/bdddd0343fdfe5451eaf to your computer and use it in GitHub Desktop.
Save maxim/bdddd0343fdfe5451eaf to your computer and use it in GitHub Desktop.
puma.rb.j2
# {{ 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