我在使用上帝宝石时遇到了一些麻烦。我基本上从Github复制了配置文件,但它似乎没有正确启动resque worker。我的配置文件如下所示:
rails_env = "production"
rails_root = "/path/to/root"
num_workers = 1
num_workers.times do |num|
God.watch do |w|
w.dir = "#{rails_root}"
w.name = "emailer-#{num}"
w.group = 'emailer'
w.interval = 30.seconds
w.behavior(:clean_pid_file)
w.env = {"QUEUE"=>"emailer", "RAILS_ENV"=>rails_env}
w.start = "/usr/local/bin/rake -f #{rails_root}/Rakefile environment resque:work"
end
end
我用以下命令运行上帝:
sudo god -c resque.god -D
这给了我以下输出:
I [2012-08-15 19:32:00] INFO: resque.god
I [2012-08-15 19:32:00] INFO: Syslog enabled.
I [2012-08-15 19:32:00] INFO: Using pid file directory: /var/run/god
I [2012-08-15 19:32:00] INFO: Socket already in use
I [2012-08-15 19:32:01] INFO: Socket is stale, reopening
I [2012-08-15 19:32:01] INFO: Started on drbunix:///tmp/god.17165.sock
I [2012-08-15 19:32:01] INFO: emailer-0 move 'unmonitored' to 'up'
I [2012-08-15 19:32:01] INFO: emailer-0 moved 'unmonitored' to 'up'
但是没有工人出现在resque-web界面中,也没有工作从队列中撤出。谁能发现我做错了什么?此外,我已经尝试使用我常用的脚本从命令行启动一个worker,并且按预期工作。哦,这在Ubuntu 10.04上运行
答案 0 :(得分:0)
我认为您需要在w.start上传递queue_name,如下所示:
w.start = "/usr/local/bin/rake -f #{rails_root}/Rakefile environment resque:work QUEUE=emailer"