Overview
Thegomodel binary exposes a small set of command-line flags for operational
tasks. Flags accept both single-dash (-flag) and double-dash (--flag) forms;
the examples below use the long form.
| Flag | Description | Default |
|---|---|---|
--version | Print version information and exit | — |
--health | Probe the local /health (liveness) endpoint and exit | — |
--health-timeout | Maximum time to wait for the --health probe | 2s |
--ready | Probe the local /health/ready (readiness) endpoint and exit | — |
--ready-timeout | Maximum time to wait for the --ready probe | 4s |
Version
Print the build version and exit:Health probe
--health makes the binary act as a health-check client: it loads the same
configuration as the server, requests the local /health endpoint, and exits.
- Exits
0when the endpoint returns HTTP200with{"status":"ok"}. - Exits non-zero otherwise (connection refused, non-
200status, or any other status value).
127.0.0.1) since it runs
inside the same container as the server, but it derives the PORT and
BASE_PATH from configuration instead of hardcoding 8080 and /health. Bound
the request with --health-timeout:
Docker HEALTHCHECK
Because the probe is built into the binary, container images can report health
without shipping curl or wget — useful for minimal/distroless runtimes. The
official image wires it up automatically:
Readiness probe
--ready probes /health/ready, which reports whether the instance should
receive traffic. Unlike liveness, readiness checks the dependencies the gateway
owns:
- Storage is required. If the backend (SQLite/PostgreSQL/MongoDB) is
unreachable, readiness reports
not_ready(HTTP503). - Redis exact cache (when configured) is a performance optimization. If it
is unreachable, readiness reports
degradedbut stays HTTP200— the gateway still serves requests.
- Exits
0when the endpoint returns HTTP200(readyordegraded). - Exits non-zero on
not_ready(HTTP503), connection refused, or an unexpected status value.
--health) is the right signal for a Docker HEALTHCHECK (restart on
crash). Readiness (/health/ready) is the right signal for a Kubernetes
readinessProbe (gate traffic) — point it at the HTTP endpoint directly or run
gomodel --ready as an exec probe. Keep --ready-timeout larger than the
server’s internal per-dependency probe timeout (2s) so a slow backend returns
a clean not_ready instead of the client timing out first.