Created
May 18, 2011 02:05
-
-
Save revans/977862 to your computer and use it in GitHub Desktop.
Bluepill used at Halftoneapp.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Halftoneapp.com Sample Bluepill Configuration File | |
# Read more at: http://blog.halftoneapp.com | |
# | |
# Set paths | |
home_dir = "/home/railsapp" | |
rails_shared = "#{home_dir}/app/shared" | |
unicorn_path = "/path/to/unicorn_rails" | |
# Set environment variables | |
rails_env = ENV['RAILS_ENV'] || 'production' | |
rails_root = ENV['RAILS_ROOT'] || "#{home_dir}/app/current" | |
Bluepill.application("railsapp", :log_file => rails_root+"/log/bluepill.log") do |app| | |
app.process("unicorn") do |process| | |
## THE APPLICATION ## | |
## ----------------- | |
# Set Unicorn PID file | |
process.pid_file = File.join(rails_root, 'tmp', 'pids', 'unicorn.pid') | |
process.working_dir = "#{rails_root}" | |
# Set the command line argument to START Unicorn. | |
process.start_command = "#{unicorn_path} -Dc #{home_dir}/unicorn.conf.rb -E #{rails_env}" | |
# Set the command line argument to STOP Unicorn. | |
process.stop_command = "kill -QUIT {{PID}}" | |
# Set the command line argument to RESTART Unicorn. (The USR2 causes the master to re-create itself and spawn a new worker pool) | |
process.restart_command = "kill -USR2 {{PID}}" | |
## GRACE PERIODS ## | |
## ----------------- | |
# After we start the app, how long should we wait until we start monitoring the application | |
process.start_grace_time = 3.seconds | |
# Same as above, grace period after we've restarted the application | |
process.restart_grace_time = 8.seconds | |
## APPLICATION CHECKS | |
## ----------------- | |
process.checks :cpu_usage, :every => 10.seconds, :below => 30, :times => 3 | |
process.checks :mem_usage, :every => 10.seconds, :below => 500.megabytes, :times => [3,5] | |
## SETUP UNICORN CHILDREN MONITORING | |
## ----------------- | |
process.monitor_children do |child_process| | |
child_process.checks :cpu_usage, :every => 10, :below => 25, :times => 3 | |
child_process.checks :mem_usage, :every => 10, :below => 200.megabytes, :times => [3, 5] | |
child_process.stop_command = "kill -QUIT {{PID}}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment