app: add /healthz liveness endpoint
This commit is contained in:
parent
9485b6b72a
commit
afde73e772
2 changed files with 18 additions and 0 deletions
12
asxpio.rb
12
asxpio.rb
|
|
@ -143,6 +143,18 @@ class AsxpioWeb < Sinatra::Base
|
|||
redirect '/thanks'
|
||||
end
|
||||
|
||||
# Liveness for the Docker HEALTHCHECK and the deploy pipeline. Pings the DB
|
||||
# when invoicing is configured — a wedged connection pool should read as
|
||||
# unhealthy, not just "process exists".
|
||||
get '/healthz' do
|
||||
begin
|
||||
DB.connection['SELECT 1'].get if defined?(Invoice)
|
||||
rescue Sequel::Error
|
||||
halt 503, 'db unreachable'
|
||||
end
|
||||
'ok'
|
||||
end
|
||||
|
||||
get '/thanks' do
|
||||
@page_title = 'Thanks — IE Sergei Poljanski'
|
||||
@page_desc = 'Your message has been received. A confirmation copy has been sent to your inbox.'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue