demarches-normaliennes/config/initializers/sidekiq.rb
simon lehericey 4c0b6fd93a
enable yabeda sidekiq metrics
a webserver is launched with the sidekiq process. It listen on the 9394 port and bind on 0.0.0.0 by default.
2024-03-28 12:11:14 +01:00

38 lines
920 B
Ruby

if ENV.has_key?('REDIS_SIDEKIQ_SENTINELS')
name = ENV.fetch('REDIS_SIDEKIQ_MASTER')
username = ENV.fetch('REDIS_SIDEKIQ_USERNAME')
password = ENV.fetch('REDIS_SIDEKIQ_PASSWORD')
sentinels = ENV.fetch('REDIS_SIDEKIQ_SENTINELS')
.split(',')
.map { URI.parse(_1) }
.map { { host: _1.host, port: _1.port, username:, password: } }
Sidekiq.configure_server do |config|
config.redis = {
name:,
sentinels:,
username:,
password:,
role: :master
}
if ENV['PROMETHEUS_EXPORTER_ENABLED'] == 'enabled'
Yabeda.configure!
Yabeda::Prometheus::Exporter.start_metrics_server!
end
if ENV['SKIP_RELIABLE_FETCH'].blank?
Sidekiq::ReliableFetch.setup_reliable_fetch!(config)
end
end
Sidekiq.configure_client do |config|
config.redis = {
name:,
sentinels:,
username:,
password:,
role: :master
}
end
end