Skip to content
Snippets Groups Projects
Commit 619ef7c5 authored by Taico Aerts's avatar Taico Aerts
Browse files

Revert redis to version 4 until issue is fixed and update settings

Settings are now properly loaded from the database.yml config file,
rather than only taking some of those settings.
parent 44a9afad
Branches
Tags
1 merge request!24Release 22-09-2022
...@@ -11,7 +11,7 @@ gem 'mysql2', '~> 0.5.4' ...@@ -11,7 +11,7 @@ gem 'mysql2', '~> 0.5.4'
gem 'puma', '~> 5.6' gem 'puma', '~> 5.6'
gem 'rails', '~> 7.0.0' gem 'rails', '~> 7.0.0'
gem 'rails-html-sanitizer', '~> 1.4' gem 'rails-html-sanitizer', '~> 1.4'
gem 'redis', '~> 5.0' gem 'redis', '~> 4.8'
gem 'rotp', '~> 6.2' gem 'rotp', '~> 6.2'
gem 'sass-rails', '~> 6.0' gem 'sass-rails', '~> 6.0'
gem 'sprockets', '~> 4.1' gem 'sprockets', '~> 4.1'
......
...@@ -107,7 +107,6 @@ GEM ...@@ -107,7 +107,6 @@ GEM
coffee-script-source (1.12.2) coffee-script-source (1.12.2)
commonmarker (0.23.5) commonmarker (0.23.5)
concurrent-ruby (1.1.10) concurrent-ruby (1.1.10)
connection_pool (2.2.5)
counter_culture (3.2.1) counter_culture (3.2.1)
activerecord (>= 4.2) activerecord (>= 4.2)
activesupport (>= 4.2) activesupport (>= 4.2)
...@@ -262,10 +261,7 @@ GEM ...@@ -262,10 +261,7 @@ GEM
rb-fsevent (0.11.2) rb-fsevent (0.11.2)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
redis (5.0.4) redis (4.8.0)
redis-client (>= 0.7.4)
redis-client (0.8.0)
connection_pool
regexp_parser (2.5.0) regexp_parser (2.5.0)
responders (3.0.1) responders (3.0.1)
actionpack (>= 5.0) actionpack (>= 5.0)
...@@ -396,7 +392,7 @@ DEPENDENCIES ...@@ -396,7 +392,7 @@ DEPENDENCIES
rails (~> 7.0.0) rails (~> 7.0.0)
rails-controller-testing (~> 1.0) rails-controller-testing (~> 1.0)
rails-html-sanitizer (~> 1.4) rails-html-sanitizer (~> 1.4)
redis (~> 5.0) redis (~> 4.8)
reverse_markdown (~> 2.1) reverse_markdown (~> 2.1)
rmagick rmagick
rotp (~> 6.2) rotp (~> 6.2)
......
...@@ -24,8 +24,7 @@ Rails.application.configure do ...@@ -24,8 +24,7 @@ Rails.application.configure do
redis_config = YAML.safe_load(processed, permitted_classes: [], permitted_symbols: [], aliases: true)["redis_#{Rails.env}"] redis_config = YAML.safe_load(processed, permitted_classes: [], permitted_symbols: [], aliases: true)["redis_#{Rails.env}"]
config.cache_store = QPixel::NamespacedEnvCache.new( config.cache_store = QPixel::NamespacedEnvCache.new(
ActiveSupport::Cache::RedisCacheStore.new( ActiveSupport::Cache::RedisCacheStore.new(
url: "redis://#{redis_config['host']}:#{redis_config['port']}", **redis_config.deep_symbolize_keys.merge(reconnect_attempts: 3),
inherit_socket: true,
error_handler: -> (method:, returning:, exception:) { error_handler: -> (method:, returning:, exception:) {
Rails.logger.error("Cache error: method=#{method} returning=#{returning} exception=#{exception.message}") Rails.logger.error("Cache error: method=#{method} returning=#{returning} exception=#{exception.message}")
} }
......
...@@ -58,9 +58,16 @@ Rails.application.configure do ...@@ -58,9 +58,16 @@ Rails.application.configure do
# Prepend all log lines with the following tags. # Prepend all log lines with the following tags.
config.log_tags = [ :subdomain, :uuid ] config.log_tags = [ :subdomain, :uuid ]
# Use a different cache store in production. # Set the cache store to the redis that was configured in the database.yml
processed = ERB.new(File.read(Rails.root.join('config', 'database.yml'))).result(binding)
redis_config = YAML.safe_load(processed, permitted_classes: [], permitted_symbols: [], aliases: true)["redis_#{Rails.env}"]
config.cache_store = QPixel::NamespacedEnvCache.new( config.cache_store = QPixel::NamespacedEnvCache.new(
ActiveSupport::Cache::RedisCacheStore.new(url: 'redis://localhost:6379/1') ActiveSupport::Cache::RedisCacheStore.new(
**redis_config.deep_symbolize_keys.merge(reconnect_attempts: 3),
error_handler: -> (method:, returning:, exception:) {
Rails.logger.error("Cache error: method=#{method} returning=#{returning} exception=#{exception.message}")
}
)
) )
# Use a real queuing backend for Active Job (and separate queues per environment). # Use a real queuing backend for Active Job (and separate queues per environment).
......
...@@ -28,11 +28,15 @@ Rails.application.configure do ...@@ -28,11 +28,15 @@ Rails.application.configure do
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Set the cache store to the redis that was configured in the database.yml
processed = ERB.new(File.read(Rails.root.join('config', 'database.yml'))).result(binding) processed = ERB.new(File.read(Rails.root.join('config', 'database.yml'))).result(binding)
redis_config = YAML.safe_load(processed, permitted_classes: [], permitted_symbols: [], aliases: true)["redis_#{Rails.env}"] redis_config = YAML.safe_load(processed, permitted_classes: [], permitted_symbols: [], aliases: true)["redis_#{Rails.env}"]
config.cache_store = QPixel::NamespacedEnvCache.new( config.cache_store = QPixel::NamespacedEnvCache.new(
ActiveSupport::Cache::RedisCacheStore.new( ActiveSupport::Cache::RedisCacheStore.new(
url: "redis://#{redis_config['host']}:#{redis_config['port']}" **redis_config.deep_symbolize_keys.merge(reconnect_attempts: 3),
error_handler: -> (method:, returning:, exception:) {
Rails.logger.error("Cache error: method=#{method} returning=#{returning} exception=#{exception.message}")
}
) )
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment