devilry / trix2

Next generation Trix. Detailed task control and statistics app for better learning outcome.
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

Health check endpoint #135

Closed torgeirl closed 7 months ago

torgeirl commented 1 year ago

When hosting Trix as a service in a container orchestration environment, the service will need to answer health checks quite often. Doing these against the / endpoint will clutter the access logs. A better approach is to have a dedicated endpoint, i.e. /health. This way, the production environment can use a logging.Filter to do disable access logging for /health endpoint so it never enters the logging infrastructure (ELK, etc).

The implementation included in Devilry 6.0.0rc2 should be a good starting point; hopefully it can be re-used with just small modifications (Devilry issue: https://github.com/devilry/devilry-django/issues/1261).

Levijatan commented 7 months ago

Pretty much reused as much as possible from devilry so there is now 2 new api endpoints at '_api/application-state/ready' and '_api/application-state/alive'. 7fdbc91. 'ready' checks if the db is up, and 'alive' just returns 200.

torgeirl commented 7 months ago

Perfect! :+1: