Resque command works from terminal but not via bluepill
I am trying to get bluepill to monitor my resque workers.
If i run this command from my rails root as root user it starts up resque worker ok.
cd /var/www/domain.com/current; RAILS_ENV=production QUEUE=* bundle exec rake resque:work
but when i try to run it using bluepill it just keeps trying to start it and doesnt give me an error.
Here is my bluepill log showing it trying....!
W, [2011-07-12T22:58:21.640467 #19267] WARN -- : [domain.com:resque] Executing start command: cd /var/www/domain.com/current; RAILS_ENV=production QUEUE=* bundle exec rake resque:work
I, [2011-07-12T22:58:21.754392 #19267] INFO -- : [domain.com:resque] Going from down => starting
I, [2011-07-12T22:59:21.334300 #19267] INFO -- : [domain.com:resque] Going from starting => down
W, [2011-07-12T22:59:22.339873 #19267] WARN -- : [domain.com:resque] Executing start command: cd /var/www/domain.com/current; RAILS_ENV=production QUEUE=* bundle exec rake resque:work
I, [2011-07-12T22:59:22.479740 #19267] INFO -- : [domain.com:resque] Going from down => starting
it keeps doing th开发者_高级运维is over and over.
here is my .pill file process
app.process("resque") do |process|
process.start_command = "cd #{RAILS_ROOT}; RAILS_ENV=#{RAILS_ENV} QUEUE=* bundle exec rake resque:work"
process.daemonize = true
process.start_grace_time = 10.seconds
process.stop_grace_time = 10.seconds
process.restart_grace_time = 10.seconds
end
I have tried to extend the start grace time for if its not loading in the required time but not making a difference.
Please can anyone help with this ?
thanks in advance Rick
Not adapted to use bundle exec (a little old) but can be edited easily.
This is my production environment Bluepill AudioBox.fm config, battle tested, happy to share.
ENVIRONMENT = 'production'
RAILS_ROOT = ENV['RAILS_ROOT'] || "/var/www/myapp/current"
Bluepill.application("myapp", :log_file => "/var/log/bluepill.log") do |app|
app.uid = "ubuntu"
app.gid = "ubuntu"
4.times do |i|
app.process("uploaders-#{i}") do |process|
process.working_dir = RAILS_ROOT
process.group = "resque"
queues = "amazon_upload"
process.start_command = "/usr/bin/env VERBOSE=true RAILS_ENV=#{ENVIRONMENT} QUEUE=#{queues} rake resque:work --trace"
process.stop_command = <<-EOF
kill -QUIT {{PID}}
sleep_count=0
while [ -e /proc/{{PID}} ]; do
sleep 1
let "sleep_count+=1"
if [ $sleep_count -eq 60 ]; then
kill -TERM {{PID}}
fi
if [ $sleep_count -ge 70 ]; then
kill -KILL {{PID}}
fi
done
EOF
process.stdout = process.stderr = "#{RAILS_ROOT}/log/resque.log"
process.pid_file = "#{RAILS_ROOT}/tmp/pids/resque-uploader-#{i}.pid"
process.daemonize = true
process.start_grace_time = 5.seconds
process.stop_grace_time = 75.seconds
process.restart_grace_time = 80.seconds
process.checks :mem_usage, :below => 350.megabytes, :every => 1.minute, :times => 3
end
end
end
Did @kain's answer solve your problem? I have something very similar just started happening, see bluepill not detecting that processes have, in fact, started successfully, and so creates new ones
You don't say what version of bluepill you were on, but I just fixed a bug which manifested itself in exactly that behavior. Pull request submitted.
I'm getting this kind of thing with capistrano + resque...
in ssh -> sudo service redis start, starts
through capistrano -> sudo service redis start, says command worked but no process...
精彩评论