diff options
author | Robert Speicher <rspeicher@gmail.com> | 2019-07-08 22:46:34 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2019-07-08 23:04:38 +0300 |
commit | 9f677359a78c78bce702411c4a0da5d7f3f429d6 (patch) | |
tree | dd13df525cea1791a7c0ef6e739d1b0754b22f91 /config/initializers/load_balancing.rb | |
parent | b77d94aab5e021e35e60e5c03fdd9993577f8b48 (diff) |
Add EE-only initializers
These files are only used by EE, and are now wrapped in `Gitlab.ee`
blocks for file parity.
Diffstat (limited to 'config/initializers/load_balancing.rb')
-rw-r--r-- | config/initializers/load_balancing.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/config/initializers/load_balancing.rb b/config/initializers/load_balancing.rb new file mode 100644 index 00000000000..1ac422a6e8a --- /dev/null +++ b/config/initializers/load_balancing.rb @@ -0,0 +1,23 @@ +# We need to run this initializer after migrations are done so it doesn't fail on CI + +Gitlab.ee do + if ActiveRecord::Base.connected? && ActiveRecord::Base.connection.data_source_exists?('licenses') + 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 |