Health Checks and Production Tuning
HEALTHCHECK, tini, signal handling in containers
Health check endpoints
A health check endpoint lets load balancers and orchestrators verify the service is alive and ready to serve traffic. Two common kinds: liveness (is it running?) and readiness (can it serve requests?).
Liveness endpoint
Returns 200 OK if the process is alive. A simple always-passing handler — the process being up is sufficient:
mux.HandleFunc("/healthz/live", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})All lessons in this course
- Multi-Stage Docker Builds for Go
- Environment Config and Secrets
- Docker Compose for Local Development
- Health Checks and Production Tuning