-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add configuration for Redis cluster support #166
Conversation
Hey @MartyHimmel - I would maybe take a slightly different approach here and instead let you actually specify the entire Redis connection information if you want. Something like: 'scaling' => [
'enabled' => env('REVERB_SCALING_ENABLED', false),
'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'),
'server' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
], Then pass that info into the PubSub class as an array. It's a bit more verbose on the configuration side but I think more flexible. |
Thanks for the direction @taylorotwell! This is my first contribution to any part of Laravel, so I was trying to keep it minimal. 😅 The updated config is working well except for the failing Laravel 10 test. I'll push another update as soon as I figure out what's going on there. |
Digging into that a bit more, it seems like the failing test above is unrelated (appears to be happening on the |
config/reverb.php
Outdated
@@ -39,6 +39,14 @@ | |||
'scaling' => [ | |||
'enabled' => env('REVERB_SCALING_ENABLED', false), | |||
'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'), | |||
'server' => [ | |||
'url' => env('REDIS_URL'), |
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 think we can remove the url
key since we don't use it?
config/reverb.php
Outdated
'server' => [ | ||
'url' => env('REDIS_URL'), | ||
'host' => env('REDIS_HOST', '127.0.0.1'), | ||
'username' => env('REDIS_USERNAME'), |
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.
We also don't appear to use username
.
@joedixon Done and done. |
Thanks @MartyHimmel - just want to confirm, this configuration works with your cluster? |
@joedixon Yep. I tried it on a localhost setup Friday and the server started. Just tried it on my work's dev environment (that's the one that uses AWS with the Elasticache/Redis cluster) and it started up without any issues. Thanks again for yours and Taylor's direction! I'm excited to dig into this more and finally move our app out of long polling and into websockets. 😁 |
This adds a configuration setting and check to allow Redis in cluster mode (see issue #160). Adding
REVERB_SCALING_CLUSTER_ENABLED=true
to the.env
file will change the config used fromdatabase.redis.default
todatabase.redis.clusters.default.0
. Like the horizontal scaling feature, this is off by default.