Rails:在 Heroku 上启动 Sidekiq
我在 Heroku 部署的 Rails 应用程序上启动和运行 Sidekiq 时遇到问题.我的应用在开发中运行良好(在没有 Sidekiq 的 Heroku 上运行).
I'm having a problem getting Sidekiq up and running on my Heroku deployed Rails app. I have my app working fine in development (and on Heroku without Sidekiq).
我创建了一个 Procfile:
I created a Procfile with:
worker: bundle exec sidekiq
如果我运行 heroku ps
,我看到的唯一进程是 web.1
.
If I run heroku ps
, the only process I see is web.1
.
我应该看一个吗Sidekiq?
Should I see one for Sidekiq?
我确实收到一个错误:
Redis::CannotConnectError (Error connected to Redis on localhost:6379)
在我的 Heroku 日志中.
Redis::CannotConnectError (Error connecting to Redis on localhost:6379)
in my Heroku logs.
更新:发现我可能需要heroku addons:add redistogo
.还是行不通.我觉得我缺少一些基本配置.
UPDATE: Found I probably needed heroku addons:add redistogo
. Still not working. I feel I'm missing some basic configuration.
我需要做些什么才能让 Redis 为我的 Heroku 应用程序启动并运行吗?
Is there something I need to do to get Redis up and running for my Heroku app?
我已经使用 Redis/Sidekiq 大约一天了,所以这对我来说是新的.
I've been using Redis/Sidekiq for about a day, so this is new to me.
谢谢!
格雷格
不,Sidekiq 的 Heroku 不需要任何配置,只需添加 RedisToGo 插件即可.不要忘记在您的 Heroku 配置中将至少 1 个 worker 归因于您的应用.
No you do not need any config with Heroku for Sidekiq, just add the RedisToGo plugin and you're on. Do not forget to attribute at least 1 worker to your app in your Heroku config.
这是我的默认 Procfile:
Here is my default Procfile:
web: bundle exec thin start -p $PORT
worker: bundle exec sidekiq -c 5 -v