Skip to content

Data5tream/simple-web-healthcheck-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-web-healthcheck

Crates.io Version Crates.io Total Downloads GitHub Release GitHub Actions Workflow Status GitHub License

Simple healthcheck for web app containers

Usage

The healthcheck will report as healthy if the HTTP request is successful and the status of the HTTP requests is not in the range of 400-599. Provide the healthcheck URL as the first argument to the binary.

Check out the web-test-container Dockerfile for a usage example.

The simple-web-healthcheck binary currently has a size of around 3.5 MB. I'll probably rewrite it in hyper or another lower level HTTP client, to reduce the size further.

Dockerfile

Add as a step to your multistage container build:

# Build healthcheck
FROM rust:1.87-bookworm AS healthcheck-builder

RUN cargo install simple-web-healthcheck

# Rest of your build...
    
FROM gcr.io/distroless/cc-debian12

COPY --from=healthcheck-builder /usr/local/cargo/bin/simple-web-healthcheck /healthcheck

# Copy your app here

HEALTHCHECK --interval=10s --timeout=1s CMD ["/healthcheck", "http://127.0.0.1:8080"]

About

A simple healthcheck for web containers

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages