Skip to content

Instantly share code, notes, and snippets.

@mrrooijen
Created May 16, 2011 16:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrrooijen/974793 to your computer and use it in GitHub Desktop.
Save mrrooijen/974793 to your computer and use it in GitHub Desktop.
Bluepill Process Monitoring configuration for Unicorn Ruby App Server.
#! /usr/bin/env ruby
Bluepill.application("app_name-production") do |app|
app.process("unicorn") do |process|
process.pid_file = File.join(RAILS_ROOT, 'tmp', 'pids', 'unicorn.pid')
process.working_dir = RAILS_ROOT
process.start_command = "/usr/bin/env UNICORN_SERVERS=#{ENV['UNICORN_SERVERS']} #{UNICORN_PATH} -D -c config/unicorn.rb -E production"
process.stop_command = "kill -QUIT {{PID}}"
process.restart_command = "kill -USR2 {{PID}}"
process.uid = process.gid = 'deploy'
process.start_grace_time = 8.seconds
process.stop_grace_time = 5.seconds
process.restart_grace_time = 13.seconds
process.monitor_children do |child_process|
child_process.stop_command = "kill -QUIT {{PID}}"
child_process.checks :mem_usage, :every => 10.seconds, :below => 150.megabytes, :times => [3,4], :fires => :stop
child_process.checks :cpu_usage, :every => 10.seconds, :below => 20, :times => [3,4], :fires => :stop
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment