如何设置Rails 4,Resque 2与Foreman一起运行?
我试图在Heroku上运行一个简单的Rails应用程序,其中包含一些后台任务。
该应用程序部署到Heroku,因此我在本地使用Foreman运行它,以便它与生产中的工作方式类似。
但是,我不能让Resque开始并熬夜。 即使没有提交任何任务,它也会每次都关闭。
这就是设置的方式。
Gemfile(基于resith的github页面)
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’时,一切都开始启动,但随后Resque SIGTERMS。 这是日志:
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’,那么网络服务器就可以正常启动了。
知道如何设置所有这些吗?
这是因为进程退出并在后台生成工作者,尝试在./bin/resque work
中使用./bin/resque work
我没有更多时间来研究这个问题。 回到旧版本的Resque为我解决了这个问题。 我所要做的就是改变我的Gemfile。
在我的Gemfile中
gem 'resque', "~> 1.22.0"
不幸的是,这不是Resque 2。