Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate REDIS_PROVIDER #3969

Closed
mperham opened this issue Sep 17, 2018 · 8 comments
Closed

Validate REDIS_PROVIDER #3969

mperham opened this issue Sep 17, 2018 · 8 comments

Comments

@mperham
Copy link
Collaborator

mperham commented Sep 17, 2018

REDIS_PROVIDER is meant to hold the name of the env var that contains the Redis URL. I see people misunderstand this abstraction and place the URL directly in REDIS_PROVIDER frequently. Add validation that will fail fast if the user makes this mistake. This is a breaking change and needs to be called out in the changelog loudly.

REDIS_PROVIDER should be set to the name of the variable which contains the Redis URL, not a URL itself.
Platforms like Heroku will sell addons that publish a *_URL variable.  You need to tell Sidekiq with REDIS_PROVIDER, e.g.:

REDIS_PROVIDER=REDISTOGO_URL
REDISTOGO_URL=redis://somehost.example.com:6379/4
mperham added a commit that referenced this issue Sep 17, 2018
@seuros
Copy link
Collaborator

seuros commented Sep 17, 2018

Maybe we should namespace the variable too and deprecate REDIS_PROVIDER ?SIDEKIQ_REDIS_PROVIDER ? wdyt ?
I can work on it in another PR .

mperham added a commit that referenced this issue Dec 7, 2018
@Tensho
Copy link
Contributor

Tensho commented Dec 9, 2018

@mperham I can't understand why Sidekiq provides indirect Redis server reference? What's wrong with directENV['REDIS_URL'] setting at Heroku?

@mperham
Copy link
Collaborator Author

mperham commented Dec 9, 2018 via email

@Tensho
Copy link
Contributor

Tensho commented Dec 9, 2018

I have never deployed sidekiq to Heroku, does Redis-to-Go addon requires specific URL env var name?

@mperham
Copy link
Collaborator Author

mperham commented Dec 9, 2018 via email

@Tensho
Copy link
Contributor

Tensho commented Dec 9, 2018

Yeah, I see. I doubt people deploy multiple Redis add-ons and it's sensible for me to have a common env var name for all of them (convention over configuration) – REDIS_URL. Thanks for the clarification 🙇

@mperham
Copy link
Collaborator Author

mperham commented Dec 10, 2018

Assume you are using Redis-To-Go. Heroku will only allow RTG to modify the ENV var called REDISTOGO_URL in your app. So if RTG wants to migrate you seamlessly to another datacenter, your app uses their variable directly and they modify the value so that on reboot, your app picks up the new Redis instance. REDIS_URL is not a thing they can control. Sidekiq supports it for those people who want to run and manage their own Redis instance.

Since there are many Redis service providers, you use REDIS_PROVIDER to tell Sidekiq which ENV var is the live Redis and Sidekiq will use that variable to find Redis.

@mperham mperham closed this as completed Dec 10, 2018
@Tensho
Copy link
Contributor

Tensho commented Dec 10, 2018

Got it, thank you 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants