fix: Redis 6 on Heroku breaks ActionCable config (#4269)

Heroku made some SSL/TLS changes with Redis 6, which is breaking the ActionCable configuration.
Hence providing an environment variable configuration `REDIS_OPENSSL_VERIFY_MODE` to fix that.

set the value `none` for this environment variable in your Heroku installations where breakage occurs.

fixes: #2420
This commit is contained in:
Sojan Jose
2022-03-24 19:25:07 +05:30
committed by GitHub
parent 60a0709de6
commit 8e153d6350
6 changed files with 23 additions and 2 deletions

View File

@@ -33,4 +33,13 @@ module Chatwoot
def self.config
@config ||= Rails.configuration.x
end
def self.redis_ssl_verify_mode
# Introduced this method to fix the issue in heroku where redis connections fail for redis 6
# ref: https://github.com/chatwoot/chatwoot/issues/2420
#
# unless the redis verify mode is explicitly specified as none, we will fall back to the default 'verify peer'
# ref: https://www.rubydoc.info/stdlib/openssl/OpenSSL/SSL/SSLContext#DEFAULT_PARAMS-constant
ENV['REDIS_OPENSSL_VERIFY_MODE'] == 'none' ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER
end
end

View File

@@ -2,6 +2,8 @@ default: &default
adapter: redis
url: <%= ENV.fetch('REDIS_URL', 'redis://127.0.0.1:6379') %>
password: <%= ENV.fetch('REDIS_PASSWORD', nil).presence %>
ssl_params:
verify_mode: <%= Chatwoot.redis_ssl_verify_mode %>
channel_prefix: <%= "chatwoot_#{Rails.env}_action_cable" %>
development: