Resque命令可以从终端运行,但不能通过bluepill运行

时间:2011-07-12 22:11:44

标签: ruby-on-rails-3 resque bluepill

我正试图让bluepill监视我的resque工人。

如果我以root用户身份从我的rails root运行此命令,则启动resque worker ok。

cd /var/www/domain.com/current; RAILS_ENV=production QUEUE=* bundle exec rake resque:work

但是当我尝试使用bluepill运行它时,它一直试图启动它并且不会给我一个错误。

这是我的bluepill日志显示它正在尝试....!

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

它一遍又一遍地这样做。

这是我的.pill文件过程

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

我试图延长启动宽限时间,如果它没有在所需的时间加载但没有产生影响。

请有人帮忙吗?

提前谢谢 瑞克

4 个答案:

答案 0 :(得分:1)

不适合使用bundle exec(有点旧)但可以轻松编辑。

这是我的生产环境Bluepill AudioBox.fm配置,经过测试,很乐意分享。

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

答案 1 :(得分:0)

@kain的答案解决了你的问题吗?我刚刚开始发生类似的事情,请参阅bluepill not detecting that processes have, in fact, started successfully, and so creates new ones

答案 2 :(得分:0)

你没有说明你所使用的是什么版本的bluepill,但我刚刚修正了一个错误,这个错误表明了这种行为。 Pull request submitted

答案 3 :(得分:0)

我在capistrano + resque中得到了这样的东西......

在ssh中的

- &gt; sudo service redis start,starts

通过capistrano - &gt; sudo service redis start,说命令工作但没有进程...

相关问题