summaryrefslogtreecommitdiff
path: root/config/application.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-06 13:20:02 -0700
committerStan Hu <stanhu@gmail.com>2018-07-06 15:22:26 -0700
commit4de118d5250691708a83f8f9d9590e6d61b19f32 (patch)
treec8fa7b858368b4aaecb84e9dd1acbd7ce2e9fb82 /config/application.rb
parent06e3ea7ac3deefad9b91030994b40c7c8abe06d3 (diff)
downloadgitlab-ce-sh-simplify-liveness-check.tar.gz
Simplify /-/liveness check to avoid connecting to the databasesh-simplify-liveness-check
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.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/config/application.rb b/config/application.rb
index 97bc86b3e3a..5dd75ca8400 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -151,6 +151,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