01110 November
Monitoring delayed_job with bluepill
Bluepill is a pure-ruby process monitoring library similar to god/monit. Unlike god, bluepill doesn’t leak memory (according to the bluepill authors anyway :] .)
To set up delayed_job, please have a look at this asciicast (note that you should use the collectiveidea-delayed_job fork for this!)
Once you’ve got your delayed_job set up you’ll want to ensure your workers don’t die.
Now to configure bluepill
Follow these steps:
$ sudo gem sources -a http://gemcutter.org $ sudo gem install bluepill $ sudo mkdir /var/bluepill # The /var/bluepill directory is for bluepill to store its PID files in # For more details like configuring logging, see the installation section on github: http://github.com/arya/bluepill
Now that you have bluepill installed, we need to configure it for our app.
# A sample configuration which we can store in the rails ./config directory as
# RAILS_ROOT/config/bluepill.pill:
Bluepill.application("my_complex_app") do |app|
app.process("delayed_job") do |process|
process.start_command = "/path/to/rails_root/script/delayed_job -e production start"
process.stop_command = "/path/to/rails_root/script/delayed_job -e production stop"
process.pid_file = "/path/to/rails_root/tmp/pids/delayed_job.pid"
process.uid = "my_complex_app_user"
process.gid = "my_complex_app_group"
process.checks :cpu_usage, :every => 10.seconds, :below => 5, :times => 3
process.checks :mem_usage, :every => 10.seconds, :below => 100.megabytes, :times => [3,5]
end
end
To start monitoring, we execute:
$ sudo bluepill load /path/to/rails_root/config/bluepill.pill # Check it with $ sudo bluepill status delayed_job(pid:29710): up
Sweet!
For more on the command line interface to bluepill, check out the CLI section of the readme. I’ll let the respective readme’s tell you about the more detailed config options available.