Skip to content

Instantly share code, notes, and snippets.

@arunsingh
Created September 6, 2016 09:36
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 arunsingh/ee9b6ca6c602a2972c08399ef5d22f09 to your computer and use it in GitHub Desktop.
Save arunsingh/ee9b6ca6c602a2972c08399ef5d22f09 to your computer and use it in GitHub Desktop.
unicorn-worker-killer usage
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# Unicorn self-process killer
require 'unicorn/worker_killer'
# Max requests per worker
use Unicorn::WorkerKiller::MaxRequests, 3072, 4096
# Max memory size (RSS) per worker
use Unicorn::WorkerKiller::Oom, (124*(1024**2)), (256*(1024**2))
# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')
$0 = "master"
# if you want debugging:
# ARGV << "--debug"
ARGV << "--rack"
require 'puppet/application/master'
# we're usually running inside a Rack::Builder.new {} block,
# therefore we need to call run *here*.
run Puppet::Application[:master].run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment