diff options
author | Stan Hu <stanhu@gmail.com> | 2018-07-06 13:20:02 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-28 14:35:02 -0700 |
commit | eb2bc7d99a99981150f32ac2469bff29eebbfa19 (patch) | |
tree | 89fa9dab380931b67718443ab17f61c486df12c9 /config/application.rb | |
parent | 87f03f01735fb4b6dbef2e4bf625cf2546523a4e (diff) | |
download | gitlab-ce-eb2bc7d99a99981150f32ac2469bff29eebbfa19.tar.gz |
Simplify /-/liveness check to avoid connecting to the database
The previous implementation would hit the database each time
and provide a dummy response. If the database goes down, this
means all application workers would be taken out of service.
Simplify this check by using a Rails middleware that intercepts
this endpoint and returns a 200 response.
Diffstat (limited to 'config/application.rb')
-rw-r--r-- | config/application.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/config/application.rb b/config/application.rb index b9d4f6765e3..ae4ff5dd7c9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -154,6 +154,10 @@ module Gitlab config.action_view.sanitized_allowed_protocols = %w(smb) + # This middleware needs to precede ActiveRecord::QueryCache and other middlewares that + # connect to the database. + config.middleware.insert_after "Rails::Rack::Logger", "Gitlab::Middleware::LivenessHealthCheck" + config.middleware.insert_after Warden::Manager, Rack::Attack # Allow access to GitLab API from other domains |