LuckPerms / rest-api

A REST API for LuckPerms.
MIT License
31 stars 8 forks source link

Standalone app health actuator/health check endpoint #4

Closed clrxbl closed 2 years ago

clrxbl commented 2 years ago

Description

Deployment fault-tolerance can be achieved in e.g. Kubernetes environments by polling an HTTP health check endpoint to only send traffic to a healthy application when the application is ready to accept connections because of the HTTP health check endpoint returning the HTTP response 200 OK.

If the application health check endpoint does not return 200 OK, Kubernetes will automatically spin up a new container and shut down the unhealthy one.

Currently, there is no health check endpoint on the standalone REST API.

Proposed Behaviour

Spring Framework has an excellent health actuator system example, https://docs.spring.io/spring-boot/docs/current/actuator-api/htmlsingle/#health.

It polls components such as databases continuously and returns the status whenever you HTTP GET the actuator endpoint. It would be great for the LP application to have something similar. It simply has to return 200 OK if the application is healthy and ready to receive connections, and return like a 500 Internal Server Error if something is going wrong (database connection failures etc.).

Extra Details

No response

lucko commented 2 years ago

b1953632c58551ad1450c034ee4a14e7f5eb01f7

The endpoint is exposed by the standalone app, not the rest-api, so is available from a different port (3001 by default) and isn't part of the API spec, at least at the moment. I can possibly duplicate the endpoint in the API itself if this would be useful.

clrxbl commented 2 years ago

b1953632c58551ad1450c034ee4a14e7f5eb01f7

The endpoint is exposed by the standalone app, not the rest-api, so is available from a different port (3001 by default) and isn't part of the API spec, at least at the moment. I can possibly duplicate the endpoint in the API itself if this would be useful.

That's fine. Spring does something similar where it exposes it on a separate "management" endpoint (that exposes a bunch of other nifty tools like HTTP endpoints for thread dumps)