conf: add redis
This commit is contained in:
parent
4862cc2be8
commit
da507ff0ea
5 changed files with 31 additions and 2 deletions
1
Gemfile
1
Gemfile
|
@ -74,6 +74,7 @@ gem 'rack-attack'
|
|||
gem 'rails-i18n' # Locales par défaut
|
||||
gem 'rake-progressbar', require: false
|
||||
gem 'redcarpet'
|
||||
gem 'redis'
|
||||
gem 'rexml' # add missing gem due to ruby3 (https://github.com/Shopify/bootsnap/issues/325)
|
||||
gem 'rqrcode'
|
||||
gem 'saml_idp'
|
||||
|
|
|
@ -171,6 +171,7 @@ GEM
|
|||
coercible (1.0.0)
|
||||
descendants_tracker (~> 0.0.1)
|
||||
concurrent-ruby (1.2.2)
|
||||
connection_pool (2.4.1)
|
||||
content_disposition (1.0.0)
|
||||
crack (0.4.5)
|
||||
rexml
|
||||
|
@ -561,6 +562,10 @@ GEM
|
|||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
redcarpet (3.6.0)
|
||||
redis (5.0.6)
|
||||
redis-client (>= 0.9.0)
|
||||
redis-client (0.14.1)
|
||||
connection_pool
|
||||
regexp_parser (2.8.1)
|
||||
request_store (1.5.0)
|
||||
rack (>= 1.4)
|
||||
|
@ -893,6 +898,7 @@ DEPENDENCIES
|
|||
rails-i18n
|
||||
rake-progressbar
|
||||
redcarpet
|
||||
redis
|
||||
rexml
|
||||
rqrcode
|
||||
rspec-rails
|
||||
|
|
|
@ -210,3 +210,8 @@ API_COJO_URL=""
|
|||
|
||||
# Set to `disabled` if you want to diable postgis
|
||||
POSTGIS_EXTENSION_DISABLED=""
|
||||
|
||||
# Use redis as primary rails cache store, file system otherwise
|
||||
REDIS_CACHE_URL=""
|
||||
REDIS_CACHE_SSL="enabled"
|
||||
REDIS_CACHE_SSL_VERIFY_NONE="enabled"
|
||||
|
|
|
@ -25,7 +25,11 @@ Rails.application.configure do
|
|||
config.action_controller.perform_caching = true
|
||||
config.action_controller.enable_fragment_cache_logging = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
if ENV['REDIS_CACHE_URL'].present?
|
||||
config.cache_store = :redis_cache_store, { url: ENV['REDIS_CACHE_URL'] }
|
||||
else
|
||||
config.cache_store = :memory_store
|
||||
end
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
||||
}
|
||||
|
|
|
@ -61,7 +61,20 @@ Rails.application.configure do
|
|||
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
if ENV['REDIS_CACHE_URL'].present?
|
||||
redis_options = { url: ENV['REDIS_CACHE_URL'] }
|
||||
redis_options[:ssl] = (ENV['REDIS_CACHE_SSL'] == 'enabled')
|
||||
if ENV['REDIS_CACHE_SSL_VERIFY_NONE'] == 'enabled'
|
||||
redis_options[:ssl_params] = { verify_mode: OpenSSL::SSL::VERIFY_NONE }
|
||||
end
|
||||
|
||||
redis_options[:error_handler] = -> (method:, returning:, exception:) {
|
||||
Sentry.capture_exception exception, level: 'warning',
|
||||
tags: { method: method, returning: returning }
|
||||
}
|
||||
|
||||
config.cache_store = :redis_cache_store, redis_options
|
||||
end
|
||||
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment).
|
||||
config.active_job.queue_adapter = :delayed_job
|
||||
|
|
Loading…
Add table
Reference in a new issue