Skip to content

Utility to simplify health check applications.

License

Notifications You must be signed in to change notification settings

kool-dev/healthz

Repository files navigation

healthz

Kool.dev

Utility to simplify health check on container applications.


Go Report Card codecov Maintainability

Installation

healthz is available with a one-line install script for Linux:

curl -fsSL https://raw.githubusercontent.com/kool-dev/healthz/main/install.sh | bash

Usage

healthz receives a JSON array as parameter, which contains all tests it needs to perform.

After executing all the checks, it will exit with with 0 exit code for success, and non-zero otherwise.

# check for a TCP listening port to accept connections
healthz -i '[{"type": "tcp", "value": "localhost:80"}]'

# check for an HTTP server to respond with a 200 status code
healthz -i '[{"type": "http", "value": "http://localhost"}]'

# execute a command and check for exit code to be zero
healthz -i '[{"type": "exec", "value": "ls -lah /"}]'

Docker image

We also provide a single binary Docker image with healthz. The image can be used to fetch the binary easily on other images you want to add health check to.

Adding it to your own images:

COPY --from=kooldev/healthz /healthz /healthz

Running it with Docker:

$ docker run --rm kooldev/healthz:1.0 -i "..."

License

The MIT License (MIT). Please see License File for more information.