How to use ActionCable with redis server hosted on redislabs.com?

547 views Asked by At

I am trying to set up a rails app with actioncable, where it's using a redis database hosted on app.redislabs.com. I am having trouble getting the connection to successfully initiate, even though I can connect to a localhost redis server fine.

If I use the url redis://myredisurl, I get the following errors: Connection reset by peer (Errno::ECONNRESET) followed by Connection lost (ECONNRESET) (Redis::ConnectionError).

From a google search, the only thing I could find was possibly that the redis server wants an ssl connection. So I tried the url rediss://myredisurl, and that gives an SSL error: SSL_connect returned=1 errno=0 state=error: wrong version number (OpenSSL::SSL::SSLError)

The development section of cable.yml looks like this:

development: &development
  adapter: redis
  password: <%= ENV['REDIS_PASSWORD'] || '' %>
  db: <%= ENV['REDIS_DB'] || '' %>
  url: <%= ENV['REDIS_HOST'] || 'redis://127.0.0.1' %>
  port: <%= ENV['REDIS_PORT'] || '6379' %>
  ssl: true
  ssl_params: 
    verify_mode: <%= OpenSSL::SSL::VERIFY_NONE %>

I tried with & without ssl: true. With & without ssl_params. I'm still unable to get the connection to work, and I don't know what I'm missing.

Of note, I am able to connect to the hosted redis with redis-cli, so I know it's reachable.

I am using Rails 5.2.7, and it is not possible to upgrade.

1

There are 1 answers

0
user1779418 On

This turned out to be a corporate network firewall issue - not an issue with our app setup.