Sidekiq worker repeatedly crashing after deploy with "Connection refused... for 127.0.0.1:6379"
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:
- I have the REDIS_URL
set on the Web service
- I imported the repo
from Github directly20 Replies
Project ID:
2637570f-afaf-462c-887b-912303121dfd,63bb6b2e-042f-443b-a46c-7d34958bd347
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
I have the REDIS_URL set on the
worker
but it doesn't seem to be picking it up.show me your service variables please
On the worker, I'm currrently trying this:
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 stringsorry 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
I just re-deployed and tried adding the Postgres database URL - it's green in the screenshot, but it literally just crashed again
your redis reference variable is incorrect, please take a look at this docs section
https://docs.railway.app/develop/variables#reference-variables
I'll try this one again
okay now show me the redis service variables please
looks good
show me how you are using the
REDIS_URL
environment variable in codeWorker seems stable now
oh then all good
There's a few places where we're using
<%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
Thanks for your help @Brody !no problem!
@Estafette How did you get a sidekiq worker up and running? It doesn't seem like
worker
is supported in the procfileI ended up just bailing on it entirely. It would reboot and be stable for a bit, then inevitably crash. My app isn’t using Sidekiq just yet, so I can live without it in the interim
quick little bit of info here, railway does not support worker processes defined in the Procfile, that is a heroku specific thing. instead you would want to deploy another railway service to run the worker processes, essentially that involves deploying a duplicate service and then setting the start command accordingly in the service settings