Test app for Cloud Foundry app lifecycle & health check debugging.
The app offers various endpoints that allow for fine control over its health state & responses on TCP level.
It also logs every request it receives, plus various lifecycle events.
Toggles App Health State and returns new app health state.
Returns a 200
if the app is healthy, drops/closes the connection otherwise.
Always drops the Connection. Results in Gorouter error-code 502
with x_cf_routererror:"endpoint_failure (EOF (via idempotent request))"
.
Always returns a 200
response even when the app is unhealthy.
Returns a 200
if the app is healthy, drops/closes the connection otherwise.
Also writes the HTTP Method into the response
go build
Either run the binary or push it to CloudFoundry with the given manifest.yml
.
Use health-check-type: process
for process healthchecks, or the following for HTTP health checks:
health-check-type: http
health-check-http-endpoint: /health
The following environment variables affect the apps behaviour and can be specified in the manifest (see example).
If INITIAL_HEALTH: false
is specified, the app will start with failing Health endpoint (i.e. cf push
will fail)
flowchart LR
start["Process started"] --->|START_DELAY| listens["listener starts"] -.-|App runs| crash["SIGTERM received"] --->|DRAIN_DELAY| drain["listener stopped"] --->|STOP_DELAY| stop["Process stopped"]
START_DELAY
, DRAIN_DELAY
and STOP_DELAY
can be set to durations, e.g. "10s", "5m".
After pushing the app to CF, use cf logs cf-tcp-test-app
to see the detailed log output of every request/health-check/event.