[feature] Add sentinel support to ActionCable Redis subscription adapter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[feature] Add sentinel support to ActionCable Redis subscription adapter

Alistair Israel
I've been trying to deploy a small, sample Rails 5 app that uses ActionCable to send some real-time updates via WebSockets to the front-end Javascript. It works fine when running locally, or on single node test environments running single-node Redis as well.

When I tried to deploy it on to Kubernetes, however, I ran into a small stumbling block because to deploy Redis on to Kubernetes in a highly available manner it seems the recommended way is through use of Redis Sentinels:

* https://github.com/kubernetes/kubernetes/tree/master/examples/storage/redis
* https://redis.io/topics/sentinel

redis-rails already supports sentinels, so use of Redis with sentinels for cache, sessions, etc. is not a problem: https://github.com/redis-store/redis-rails#usage-with-redis-sentinel

However, the ActionCable Redis subscription adapter is configured independently, and when I dived into the code it became apparent that the configuration did not currently support specifying Redis sentinel configuration (even though the underlying redis gem powering both ActionCable and redis-rails already does).

It looks like it should only take a couple of lines of additional code at https://github.com/rails/rails/blob/master/actioncable/lib/action_cable/subscription_adapter/redis.rb#L13 to support an additional `sentinels: [...]` configuration parameter (if present).

I realize that I could simply supply my own custom lambda to ActionCable::SubscriptionAdapter::Redis.redis_connector in an initializer to support sentinels there, but am wondering if this is something the rest of the community might appreciate. If so, I'll gladly raise a PR.

Cheers!
- alistair

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Loading...