Services that expose their health endpoint on a Unix domain socket instead
of a TCP port (no open ports, socket-permission access control) can be
checked by combining url with socket: the GET request is sent through
the socket, and any 2xx response counts as healthy.
processes:
- name: app
command: /usr/local/bin/app
args: ["300"]
on-failure: shutdown
checks:
app-http:
http:
url: http://localhost/health
socket: /run/app/health.sock
period: 300ms
threshold: 1socketswitches the transport: the connection goes to the unix socket,urlonly contributes the request path (and Host header).- Everything else works as with TCP HTTP checks:
period,timeout,threshold,initial-delay, plusready-checkgating andon-check-failureactions.
gopherd status lists app-http as healthy while the socket answers
200 OK on /health, unhealthy once it stops.
Run level. The test hosts an HTTP server on a unix socket in-process, substitutes its path, and asserts the check reports healthy; after closing the server it asserts the check flips to unhealthy. SIGTERM then yields a clean exit 0.
go test ./documentation/health-check-http-unix/ -v