#Sidekiq worker repeatedly crashing after deploy with "Connection refused... for 127.0.0.1:6379"

24 messages · Page 1 of 1 (latest)

final coral
#

Project ID: 2637570f-afaf-462c-887b-912303121dfd
Service: 63bb6b2e-042f-443b-a46c-7d34958bd347

  • Rails 7.0.7 app (using Jumpstart Pro)
  • Ruby 3.2.2
  • App boots fine, but before long the Worker crashes with the following message:
Connection refused - connect(2) for 127.0.0.1:6379
/usr/local/lib/ruby/3.2.0/socket.rb:1217:in `__connect_nonblock'
/usr/local/lib/ruby/3.2.0/socket.rb:1217:in `connect_nonblock'
/usr/local/lib/ruby/3.2.0/socket.rb:60:in `connect_internal'
/usr/local/lib/ruby/3.2.0/socket.rb:141:in `connect'
/usr/local/lib/ruby/3.2.0/socket.rb:645:in `block in tcp'
/usr/local/lib/ruby/3.2.0/socket.rb:231:in `each'
/usr/local/lib/ruby/3.2.0/socket.rb:231:in `foreach'
/usr/local/lib/ruby/3.2.0/socket.rb:635:in `tcp'
  • I have the REDIS_URL set on the Web service
  • I imported the repo from Github directly
forest pebbleBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

tribal oasisBOT
#

Project ID: 2637570f-afaf-462c-887b-912303121dfd,63bb6b2e-042f-443b-a46c-7d34958bd347

fluid spear
#

looks like you are trying to connect to a local redis database, if you are wanting to connect to a redis database on railway make sure you have the reference variables setup on your service correctly
https://docs.railway.app/develop/variables#reference-variables
and make sure you are using those environment variables in code properly

final coral
#

I have the REDIS_URL set on the worker but it doesn't seem to be picking it up.

fluid spear
#

show me your service variables please

final coral
#

On the worker, I'm currrently trying this:

{"REDIS_URL":"${{web.REDIS_URL}}"}

But I also tried redis.REDIS_URL (which was provided by the redis instance I'm running)

#

The web.REDIS_URL is apparently an empty string

fluid spear
#

sorry i should have been a little more clear, so can get the best understanding of how you have things configured at the service level, please provide me with a screenshot of your service variables with the redis url variable visible

final coral
#

I just re-deployed and tried adding the Postgres database URL - it's green in the screenshot, but it literally just crashed again

fluid spear
final coral
#

I'll try this one again

fluid spear
#

okay now show me the redis service variables please

final coral
fluid spear
#

looks good

#

show me how you are using the REDIS_URL environment variable in code

final coral
#

Worker seems stable now

fluid spear
#

oh then all good

final coral
#

There's a few places where we're using <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>

#

Thanks for your help @fluid spear !

fluid spear
#

no problem!

frosty oracle
#

@final coral How did you get a sidekiq worker up and running? It doesn't seem like worker is supported in the procfile

final coral