Kubernetes liveness and readiness probes for Phoenix.
Mount probes in a router:
import PhoenixHealthy.Router
phoenix_healthy("/health", repo: MyApp.Repo)Or put PhoenixHealthy.Plug near the top of your endpoint.
Use this module in a controller when you want the actions on your own module (for example PhoenixSwagger):
defmodule MyAppWeb.HealthController do
use MyAppWeb, :controller
use PhoenixHealthy, repo: MyApp.Repo
end
Summary
Functions
Options for a request: application env, module/router overrides, then
values stored on conn.private.phoenix_healthy.
Merges application env with explicit overrides.