2019-07-08 21:06:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-07-08 15:46:34 -04:00
|
|
|
# We need to run this initializer after migrations are done so it doesn't fail on CI
|
|
|
|
|
|
|
|
Gitlab.ee do
|
2020-02-17 19:09:20 -05:00
|
|
|
if Gitlab::Database.cached_table_exists?('licenses')
|
2019-07-08 15:46:34 -04:00
|
|
|
if Gitlab::Database::LoadBalancing.enable?
|
|
|
|
Gitlab::Database.disable_prepared_statements
|
|
|
|
|
|
|
|
Gitlab::Application.configure do |config|
|
|
|
|
config.middleware.use(Gitlab::Database::LoadBalancing::RackMiddleware)
|
|
|
|
end
|
|
|
|
|
|
|
|
Gitlab::Database::LoadBalancing.configure_proxy
|
|
|
|
|
|
|
|
# This needs to be executed after fork of clustered processes
|
|
|
|
Gitlab::Cluster::LifecycleEvents.on_worker_start do
|
|
|
|
# Service discovery must be started after configuring the proxy, as service
|
|
|
|
# discovery depends on this.
|
|
|
|
Gitlab::Database::LoadBalancing.start_service_discovery
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|