Skip to content

Instantly share code, notes, and snippets.

@kml
Last active December 9, 2015 14:01
Show Gist options
  • Select an option

  • Save kml/5559c5a515e042960efc to your computer and use it in GitHub Desktop.

Select an option

Save kml/5559c5a515e042960efc to your computer and use it in GitHub Desktop.
Create pidfile before loading the application. Thanks to this monit/god knows that process exists and will not try to run other instance event when initialization takes a long time.
gem "puma", require: false, platform: :jruby
# Issue: https://github.com/puma/puma/issues/785
begin
require "puma/single"
class ::Puma::Single
alias unpatched_run run
def run
unless daemon?
@cli.write_pid
end
unpatched_run
end
end
rescue LoadError => exception
warn "#{exception.class}: #{exception.message}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment