Skip to content

Instantly share code, notes, and snippets.

@akzhan
Forked from igorsokolov/gist:448201
Created June 24, 2010 06:29
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 akzhan/451067 to your computer and use it in GitHub Desktop.
Save akzhan/451067 to your computer and use it in GitHub Desktop.
Bluepill.application("app", :base_dir => "#{RAILS_ROOT}/tmp/bluepill", :log_file => "#{RAILS_ROOT}/log/bluepill.log") 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 = "unicorn -c config/unicorn.rb -E production config.ru"
process.stop_command = "kill -QUIT {{PID}}"
process.restart_command = "kill -USR2 {{PID}}"
process.uid = process.gid = 'www'
process.start_grace_time = 20.seconds
process.stop_grace_time = 20.seconds
process.restart_grace_time = 25.seconds
process.daemonize = true
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