gaul / s3proxy

Access other storage backends via the S3 API
Apache License 2.0
1.7k stars 221 forks source link

Feature Request Implement health check probe #427

Open ryanfaircloth opened 2 years ago

ryanfaircloth commented 2 years ago

Implement a health check probe "/healthz" that returns 200 on get using a http endpoint not serving s3 i.e 8080 for a get this should return 200 this will prevent infra mon solutions including k8s from killing containers when misconfigured our back end systems fail

gaul commented 2 years ago

Does minio or some other private object store have a mechanism that S3Proxy could mimic?

ryanfaircloth commented 2 years ago

Yes, its really as simple as an additional "status" endpoint that returns 200 and a json payload { 'status': "ok" } and optionally an error if not ok with a 500. An example using jetty https://gist.github.com/jkutner/7b3d154729de6563f7387c26c656233c

The status endpoint will allow k8s to avoid sending requests until the instance is fully started and prevent it from killing the instance if its slow to respond due to backend issues (azure) or just busy

gaul commented 2 years ago

I just want to align S3Proxy with a similar implementation instead of creating some proprietary functionality.

EraYaN commented 1 year ago

This is essentially how all ASP.NET stuff does it for example, although the content of the actual health check is moot for kubernetes. The only "standard" that is really out there is the Grpc Healthchecks.

Google seems to be the source of the healthz endpoint. So stuff like prometheus also implements it as does ASP.NET Core in most examples. MinIO does something a bit more complex because they want to expose cluster information: https://min.io/docs/minio/linux/operations/monitoring/healthcheck-probe.html But there is nothing stopping you from mapping both /healthz and /minio/health/live to the same response.

missingcharacter commented 1 year ago

@gaul minio does offer a healthcheck https://min.io/docs/minio/linux/operations/monitoring/healthcheck-probe.html and metrics https://min.io/docs/minio/linux/operations/monitoring/metrics-and-alerts.html