Sanito

Plug health check module, used for example for container healthcheck

Installation

If available in Hex, the package can be installed by adding sanito to your list of dependencies in mix.exs:

def deps do
  [
    {:sanito, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/sanito.

Usage

Define the plug module in endpoint.ex, this will expose an endpoint for health check, this endpoint won't send anything to the logger so it is safe to use without worrying about generating tons of dogs

defmodule MyAppWeb.Endpoint do
  use Phoenix.Endpoint, otp_app: :my_app

  ...

  plug Sanito.Plug, path: "/health"
  ...

  plug Plug.RequestId
  plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]

  ...

  plug MyAppWeb.Router
end