add maintenance mode
This commit is contained in:
parent
61c10bb72e
commit
fecad19b91
2 changed files with 18 additions and 3 deletions
|
@ -1,11 +1,16 @@
|
|||
class PingController < ApplicationController
|
||||
def index
|
||||
Rails.logger.silence do
|
||||
if (ActiveRecord::Base.connected?)
|
||||
head :ok, content_type: "application/json"
|
||||
status_code = if File.file?(Rails.root.join("maintenance"))
|
||||
# See https://cbonte.github.io/haproxy-dconv/2.0/configuration.html#4.2-http-check%20disable-on-404
|
||||
:not_found
|
||||
elsif (ActiveRecord::Base.connected?)
|
||||
:ok
|
||||
else
|
||||
head :internal_server_error, content_type: "application/json"
|
||||
:internal_server_error
|
||||
end
|
||||
|
||||
head status_code, content_type: "application/json"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue