A simple container to send a HTTP GET request to a specified url on an interval with the ability to send only if a 200 is returned from another URL. Useful as a Kubernetes Sidecar for reporting health information to an external service.
You can either run this as a containerized application using Docker or as a direct Go app. We recommend using the Docker method for ease of use if you have Docker Desktop installed.
- Make sure Docker Desktop is installed
- Set your environmental variables inside the docker-compose.yaml file
- Run
docker compose up --build
- Run
go mod downloadto install dependencies - Run
go build -o ./http_heartbeat ./src/cmd/main.goto build the binary - Run
./http_heartbeatwhile passing settings as environmental variables
HEARTBEAT_URL- Required
- URL to send GET request to on interval
TEST_URL- If set, app will first perform a HTTP GET request to this URL and require an OK status before sending the heartbeat to the
HEARTBEAT_URL
- If set, app will first perform a HTTP GET request to this URL and require an OK status before sending the heartbeat to the
INTERVAL- Default Value:
30 - Number of seconds between heartbeat cycles
- Default Value:
VERBOSE- If set, enables verbose logging