簡體   English   中英

Rails / resque麻煩開始工頭

[英]Rails/resque trouble starting foreman

我正在嘗試使用Foreman幫助我的Rails應用程序運行一些簡單的后台任務,但是在通過工頭開始工作時遇到了麻煩。

使用以下命令在運行redis-server和rails服務器的同時從終端啟動我的工作程序時,我的工作程序正常運行:

bundle exec rake resque:work QUEUE=myqueue

但是,我無法從Foreman開始。 這是我的Procfile中的內容...

web: bundle exec rails server -p $PORT
worker: bundle exec rake resque:work QUEUE=myqueue

在終端中運行“ foreman start”時,我得到以下信息

14:14:39 web.1    | started with pid 48120
14:14:39 worker.1 | started with pid 48121
14:14:43 worker.1 | [deprecated] I18n.enforce_available_locales will default to true in  the future. If you really want to skip validation of your locale you can set    I18n.enforce_available_locales = false to avoid this message.
14:14:43 web.1    | => Booting WEBrick
14:14:43 web.1    | => Rails 4.0.3 application starting in development on http://0.0.0.0:5000
14:14:43 web.1    | => Run `rails server -h` for more startup options
14:14:43 web.1    | => Ctrl-C to shutdown server
14:14:43 worker.1 | D, [2014-04-18T14:14:43.561321 #48121] DEBUG -- : resque-2.0.0.pre.1:  Starting
14:14:43 worker.1 | exited with code 0
14:14:43 system   | sending SIGTERM to all processes
14:14:43 web.1    | Exiting
14:14:43          | D, [2014-04-18T14:14:43.568351 #48138] DEBUG -- : Registered signals
14:14:43          | I, [2014-04-18T14:14:43.574222 #48138]  INFO -- : Running before_first_fork hooks with [#<Worker Jacks-MacBook-Pro.local:48138:pledges>]
14:14:43 web.1    | terminated by SIGTERM

當我從Procfile中刪除“ worker:”行時,我可以啟動領班,所以我認為這一定是該行的問題。

我正在使用Rails 4.0.3和Resque 2.0.0

您的工作程序是否作為守護程序運行? 當您運行bundle exec rake resque:work QUEUE=myqueue ,它是否在后台運行並返回到您的shell提示符? Foreman根本不使用守護程序進程,並且可以將resque worker配置為以Background = true運行。

如果工作程序在后台運行,請禁用此行為,並讓工頭管理該過程。

如果工頭失去與它生成的進程的連接,它將殺死它從procfile啟動的所有其他進程,因為它認為它失敗了。

這行還令人困擾:

14:14:43 worker.1 | D, [2014-04-18T14:14:43.561321 #48121] DEBUG -- : resque-2.0.0.pre.1:  Starting

看來您使用的是Resque 2.0。 有穩定的版本嗎?

也相關:

如何設置Rails 4,Resque 2以與Foreman一起運行?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM