iv-org / inv_sig_helper

GNU Affero General Public License v3.0
19 stars 4 forks source link

Healthcheck endpoint #16

Open unixfox opened 1 month ago

unixfox commented 1 month ago

@techmetx11 we would like to offer an healthcheck endpoint. Could be used on Kubernetes or Docker.

What would be the ideal way? Have a separate very small HTTP server running which provides only a healthcheck?

Or sending some data using netcat to the code?

We would prefer to have something more in depth than just checking the port.

mini-bomba commented 3 weeks ago

I think the simplest way to implement the healthcheck would be to add a cmdline parameter to the main binary that instead of starting the server would check if the server is responsive, probably by sending a simple request like PLAYER_STATUS and waiting no more than 1 second for a response.

While K8s natively supports a variety of liveness probes, including commands and HTTP, docker and podman appear to only support running healthcheck commands inside the container. Checking the HTTP healthcheck endpoint in docker and podman would require including an http client binary in the image, including any dependencies if dynamically linked. (the final image is built from scratch) Another rust dependency would likely need to be included for the HTTP server.

On the other hand, implementing a command-based healthcheck would only require adding another cmdline flag to check the server and exit with either 0 or 1.

techmetx11 commented 3 weeks ago

I think the simplest way to implement the healthcheck would be to add a cmdline parameter to the main binary that instead of starting the server would check if the server is responsive, probably by sending a simple request like PLAYER_STATUS and waiting no more than 1 second for a response.

While K8s natively supports a variety of liveness probes, including commands and HTTP, docker and podman appear to only support running healthcheck commands inside the container. Checking the HTTP healthcheck endpoint in docker and podman would require including an http client binary in the image, including any dependencies if dynamically linked. (the final image is built from scratch) Another rust dependency would likely need to be included for the HTTP server.

On the other hand, implementing a command-based healthcheck would only require adding another cmdline flag to check the server and exit with either 0 or 1.

We just need a simple flag in the main binary, no need for any HTTP-related stuff.