Add /health endpoint and CHECKS file for zero-downtime deploys

This commit is contained in:
Graham McIntire 2026-04-02 13:01:42 -05:00
parent 20ed47397b
commit 2f65c4648c
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59
3 changed files with 20 additions and 0 deletions

5
CHECKS Normal file
View file

@ -0,0 +1,5 @@
WAIT=5
TIMEOUT=60
ATTEMPTS=3
/health ok

View file

@ -0,0 +1,12 @@
defmodule MicrowavepropWeb.HealthController do
use MicrowavepropWeb, :controller
def check(conn, _params) do
# Verify DB is reachable
Ecto.Adapters.SQL.query!(Microwaveprop.Repo, "SELECT 1")
conn
|> put_resp_content_type("text/plain")
|> send_resp(200, "ok")
end
end

View file

@ -14,6 +14,9 @@ defmodule MicrowavepropWeb.Router do
plug :accepts, ["json"] plug :accepts, ["json"]
end end
# Health check — no pipeline, minimal overhead
get "/health", MicrowavepropWeb.HealthController, :check
scope "/", MicrowavepropWeb do scope "/", MicrowavepropWeb do
pipe_through :browser pipe_through :browser