Health checks
HTTP, TCP and script checks, and what the daemon does when one fails.
Add a check
oxidepm start ./server --health-check http://localhost:3000/health # HTTP
oxidepm start ./server --health-check ./check-health.sh # a scriptIn a config file a check is a table with exactly one of http_url, tcp or script:
[[apps]]
name = "api"
mode = "cmd"
script = "./target/release/api"
[apps.health_check]
http_url = "http://127.0.0.1:8080/health"
expected_status = [200, 204]
interval_secs = 30
retries = 3
action = "restart"How a check runs
An app with a check is starting until its first probe has passed. The first probe runs start_period_secs after the launch, then one runs every interval_secs. A probe times out after timeout_secs.
- An HTTP check passes on status 200 unless
expected_statuslists others. It does not follow redirects: a 301 is a failure unless it is listed. - A
tcpcheck ("host:port") passes when the connection is accepted. - A
scriptcheck runs in the app's directory, assh -c, with the same limited environment as a hook.
After retries failures in a row the app is unhealthy, the on_error hook fires once for that streak, and the health_check notification is sent if the notifier adapter is enabled. It goes back to online when a probe passes again.
The child is left alone unless the check sets action = "restart", which replaces it with an automatic restart.
Fields
http_urlstringThe URL to request. Exactly one of
http_url,tcpandscriptis required.tcpstring"host:port".scriptstringA script or command.
expected_statuslist of numbers default: [200]The HTTP status codes that count as healthy.
interval_secsnumber default: 30Seconds between probes.
timeout_secsnumber default: 5Seconds before a probe fails. 5, or the interval if that is shorter.
retriesnumber default: 3Failures in a row before the app is
unhealthy.start_period_secsnumber default: 5Seconds after the launch before the first probe.
actionstring default: "notify"notifyleaves the child alone.restartreplaces it.