如何设置Rails 4,Resque 2以与Foreman一起运行? [英] How to setup Rails 4, Resque 2 to run with Foreman?

查看:102
本文介绍了如何设置Rails 4,Resque 2以与Foreman一起运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Heroku上运行一些后台任务的简单Rails应用程序.

I am trying to run a simple Rails application on Heroku with some background tasks.

该应用程序已部署到Heroku,因此我在本地与Foreman一起运行,以便其工作与生产中的工作类似.

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.

但是,我无法让Resque启动并保持正常状态.即使没有提交任何任务,它也会每次关闭.

However, I cannot get Resque to start and stay up. It shuts down everytime, even without any tasks submitted.

这是设置方式.

Gemfile(基于github页面的resque)

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

Procfile

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

当我运行"foreman start -e config/dev.env"时,一切开始启动,但随后重新启动SIGTERMS.这是日志:

When I run 'foreman start -e config/dev.env' everything starts booting up, but then Resque 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

您可以看到Resque正在启动,然后关闭并关闭了Web服务器.如果我在Procfile中注释掉"resque",则网络服务器会正​​常启动.

You can see Resque booting up, then shutting down and shutting down the webserver. If I comment out 'resque' in the Procfile, the webserver boots up fine.

有什么想法要设置所有这些吗?

Any idea how to set all of this up?

推荐答案

我没有更多时间调查此问题.回滚到旧版本的Resque为我解决了它.我要做的就是更改我的Gemfile.

I didn't have more time to investigate this issue. Rolling back to an old version of Resque solved it for me. All I had to do was change my Gemfile.

在我的Gemfile中

In my Gemfile

gem 'resque', "~> 1.22.0"

不幸的是,这不是Resque 2.

Unfortunately, this isn't Resque 2.

这篇关于如何设置Rails 4,Resque 2以与Foreman一起运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆