我想在Heroku上運行一些簡單的Rails應用程序,並執行一些後臺任務。如何設置Rails 4,Resque 2與Foreman一起運行?
該應用程序已部署到Heroku,所以我在本地使用Foreman進行運行,以便與生產中的工作方式類似。
但是,我無法讓Resque開始並熬夜。它每次都會關閉,即使沒有提交任何任務。
這是如何設置的。
的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
當我運行 '工頭開始-e配置/ 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',web服務器啓動正常。
任何想法如何設置所有這一切?
對於那些來自谷歌的到來,至少根據對v4.2.3軌道API文檔,它僅支持'resque v1.xx':http://api.rubyonrails.org/v4.2.3/classes/ActiveJob/QueueAdapters.html – richsinn