Compare commits

...

5 commits

Author SHA1 Message Date
Sojan Jose
d51d7cdc23
Merge branch 'develop' into chore/5938-fix-heroku-ssl 2022-12-06 17:47:28 +03:00
Sojan
3817d297d5 chore: test 2022-11-25 18:32:47 +03:00
Sojan
27295fc47c chore: debug heroku config 2022-11-25 18:17:00 +03:00
Sojan Jose
e4b363e07f
Merge branch 'develop' into chore/5938-fix-heroku-ssl 2022-11-25 17:03:38 +03:00
Sojan
ddd79affec chore: debug heorku redis issue 2022-11-25 16:35:59 +03:00
3 changed files with 12 additions and 11 deletions

View file

@ -38,13 +38,4 @@ module Chatwoot
def self.config def self.config
@config ||= Rails.configuration.x @config ||= Rails.configuration.x
end 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 end

View file

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

View file

@ -5,6 +5,16 @@ module Redis::Config
config config
end end
def 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
ENV['REDIS_OPENSSL_VERIFY_MODE'] == 'none' ? 0 : 1
end
def config def config
@config ||= sentinel? ? sentinel_config : base_config @config ||= sentinel? ? sentinel_config : base_config
end end
@ -13,7 +23,7 @@ module Redis::Config
{ {
url: ENV.fetch('REDIS_URL', 'redis://127.0.0.1:6379'), url: ENV.fetch('REDIS_URL', 'redis://127.0.0.1:6379'),
password: ENV.fetch('REDIS_PASSWORD', nil).presence, password: ENV.fetch('REDIS_PASSWORD', nil).presence,
ssl_params: { verify_mode: Chatwoot.redis_ssl_verify_mode }, ssl_params: { verify_mode: redis_ssl_verify_mode },
reconnect_attempts: 2, reconnect_attempts: 2,
network_timeout: 5 network_timeout: 5
} }