-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Fix Redis TLS scheme rediss
for Redis connection
#39599
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
[Cache] Fix Redis TLS scheme rediss
for Redis connection
#39599
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
Tested the code, and it's working. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be great to use the github action test suite and one of the running container to provide functional tests.
If we add a new parameter |
There really is no difference between |
From the predis Readme:
IMHO the fix should be about keeping the scheme defined here: symfony/src/Symfony/Component/Cache/Traits/RedisTrait.php Lines 93 to 97 in 6dc5fea
And use that scheme in the relevant places:
|
For |
And it doesn't work with the same DSN on Symfony Messenger because of https://github.com/symfony/messenger/blob/5.x/Transport/TransportFactory.php#L46:
|
I don't have strong opinion about
Given The RedisTrait didn't work, maybe it's easier to deprecate the |
I've created a PR to add |
For reference, a codebase I took over recently uses this bundle to configure their redis connections: https://github.com/snc/SncRedisBundle The developers told me that they in favor of that bundle mainly because it allowed them to configure TLS connections, which is a requirement when using the managed Redis services of our current hoster Digital Ocean. Our DSNs are all configured with the |
SncRedisBundle is indeed reading the TLS configuration from the |
For now, I changed the code to support both. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either tls
option should not be added here, rediss
scheme should be deprecated.
We should not support both.
To be consistent with #39607, I keep the |
rediss
for Redis connection
@nicolas-grekas I would vote for merging that in 4.4 as a bugfix, as symfony/cache claims to support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I rebased on 4.4, cleaned up implementation a bit and fixed tests)
… to Redis transport (njutn95) This PR was squashed before being merged into the 5.3-dev branch. Discussion ---------- [Messenger] Add `rediss://` DSN scheme support for TLS to Redis transport | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | | License | MIT | Doc PR | This adds a support for `rediss://` DSN (as discussed in #39599) and deprecates the use of `tls` parameter introduced in #35503 so it can be standardized to single format. Commits ------- 28e7b74 [Messenger] Add `rediss://` DSN scheme support for TLS to Redis transport
This PR was merged into the 4.4 branch. Discussion ---------- [Cache] Add TLS scheme for Redis connection See symfony/symfony#39599. Commits ------- 2d2f3b7 [Cache] Add TLS scheme for Redis connection
Like #35503 on Symfony Messenger, this will enable TLS support for Redis adapter.
The implementation just prefix the host with
tls://
as described here: https://github.com/phpredis/phpredis#connect-openI don't know how to test it because I guess I need a TLS Redis in
src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
.