Skip to content

Instantly share code, notes, and snippets.

Created June 10, 2011 17:28
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 anonymous/1019302 to your computer and use it in GitHub Desktop.
Save anonymous/1019302 to your computer and use it in GitHub Desktop.
bluepill + resque
########################################################################
# This is a simplified recipe that runs all of the queues on all workers
########################################################################
app_name = "profile_poller"
rack_env = "development"
num_workers = "2".to_i
owner_name = "profiler"
rake_command = "/usr/local/bin/rake "
Bluepill.application("#{app_name}_resque", :log_file => "/var/log/bluepill/profile_poller.log") do |app|
app.uid = app.gid = owner_name
num_workers.times do |idx|
app.process("resque_worker_#{idx}") do |process|
process.group = "profiler"
process.pid_file = "/var/run/bluepill/worker_#{idx}.pid"
process.working_dir = "/profile_poller/app/script/resque"
process.start_command = "#{rake_command} PIDFILE=/var/run/bluepill/worker_#{idx}.pid RACK_ENV=#{rack_env} QUEUE=* resque:work"
process.stop_command = "kill -TERM {{PID}}"
#process.stop_command = "/usr/local/bin/resque list | while read line; do id=`echo $line | awk '{print $1}'`; /usr/local/bin/resque kill $id; done"
process.start_grace_time = 5.seconds
process.stop_grace_time = 75.seconds
process.restart_grace_time = 80.seconds
#process.daemonize = true
process.checks :mem_usage, :below => 100.megabytes, :every => 1.minute, :times => 3
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment