简体   繁体   English

如何设置Rails 4,Resque 2以与Foreman一起运行?

[英]How to setup Rails 4, Resque 2 to run with Foreman?

I am trying to run a simple Rails application on Heroku with some background tasks. 我正在尝试使用一些后台任务在Heroku上运行一个简单的Rails应用程序。

The application is deployed to Heroku, so I run it with Foreman locally so that things are similar to how it would work in production. 该应用程序已部署到Heroku,因此我在本地与Foreman一起运行,以便其工作与生产环境相似。

However, I cannot get Resque to start and stay up. 但是,我无法让Resque启动并熬夜。 It shuts down everytime, even without any tasks submitted. 即使没有提交任何任务,它也会每次关闭。

This is how things are setup. 这就是设置方式。

Gemfile (based on the github page for resque) Gemfile(基于github页面获取resque)

gem "resque", "~> 2.0.0.pre.1", github: "resque/resque"

Procfile Procfile

web: bundle exec rails server -e $RAILS_ENV -p $PORT
resque: bundle exec rake environment resque:work

When I run 'foreman start -e config/dev.env' everything starts booting up, but then Resque SIGTERMS. 当我运行“ foreman start -e config / dev.env”时,一切开始启动,然后重新启动SIGTERMS。 Here are the logs: 以下是日志:

16:26:56 resque.1 | Loading Rails environment for Resque
16:26:56 resque.1 | D, [2014-03-12T16:26:56.237941 #22530] DEBUG -- : resque-2.0.0.pre.1: Starting
16:26:56 resque.1 | exited with code 0
16:26:56 system   | sending SIGTERM to all processes
SIGTERM received
16:26:56 web.1    | [2014-03-12 16:26:56] FATAL SignalException: SIGTERM

You can see Resque booting up, then shutting down and shutting down the webserver. 您可以看到Resque正在启动,然后关闭并关闭了Web服务器。 If I comment out 'resque' in the Procfile, the webserver boots up fine. 如果我在Procfile中注释掉“ resque”,则网络服务器会正​​常启动。

Any idea how to set all of this up? 知道如何设置所有这些吗?

这是因为进程退出并在后台生成工作程序,因此请尝试在./bin/resque work中使用./bin/resque work

I didn't have more time to investigate this issue. 我没有更多时间调查此问题。 Rolling back to an old version of Resque solved it for me. 回滚到旧版本的Resque为我解决了它。 All I had to do was change my Gemfile. 我要做的就是更改我的Gemfile。

In my Gemfile 在我的Gemfile中

gem 'resque', "~> 1.22.0"

Unfortunately, this isn't Resque 2. 不幸的是,这不是Resque 2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM