Redistogo and Sidekiq on Heroku: Can't connect

北战南征 提交于 2019-11-30 13:02:05

Remove everything from the if and below and run this:

heroku config:set REDIS_PROVIDER=REDISTOGO_URL

Sidekiq will automatically use it.

I looked up the correct, new connection that RedisToGo provides and then inserted it into the variables. Some posts here on SO claimed that this wasn't necessary, but it seems it is.

My sidekiq.rb file in the initializers now looks like this, everything works.

require 'sidekiq/web'

Sidekiq.configure_server do |config|
ActiveRecord::Base.configurations[Rails.env.to_s]['pool'] = 30
end

if Rails.env.production?
 Sidekiq.configure_server do |config|
 config.redis = { url: ENV["REDISTOGO_URL"]}
end
Sidekiq.configure_client do |config|
 config.redis = { url: ENV["REDISTOGO_URL"]}
end
end

Not an answer - but want to add to the SEO for this post so others can find this. This is also the answer to an issue where heroku will throw the error:

could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

This issue has been unanswered on many SO questions (example), and everyone says the database isn't correctly configured, which is not necessarily the case.

I tried for hourrrrsss to figure out the issue, and this was the solution! Thank you so much - I wish I could upvote your answers more than once!!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!