Leantime / leantime

Leantime is a goals focused project management system for non-project managers. Building with ADHD, Autism, and dyslexia in mind.
https://leantime.io
GNU Affero General Public License v3.0
4.41k stars 578 forks source link

[FEATURE] Health route #865

Open phulstaert opened 2 years ago

phulstaert commented 2 years ago

It would be awesome if you would have a /health path, so we could check the health of the installation. This would also enable us to do a health check in the Leantime docker-compose file, but also self-hosted installs would benefit this. Certainly in environments where there is dedicated health monitoring.

We could check if MySQL is reachable and there are > 30 tables like zp_%

SELECT count(TABLE_NAME) AS TableCount
FROM INFORMATION_SCHEMA.TABLES
WHERE 
    TABLE_SCHEMA = (SELECT DATABASE() FROM DUAL) and 
    TABLE_NAME like 'zp_%';

This would be enough, since a not running PHP or Apache would result in a timeout and thus a not healthy system. The same is true for your network connection.

The script for leantime-docker could also check the following things

Note:

marcelfolaron commented 2 years ago

That is a great idea! Would be good to make that an api call as well and let other systems ping it.

On Sat, Aug 13, 2022 at 5:28 PM Peter Hulstaert @.***> wrote:

It would be awesome if you would have a /health path, so we could check the health of the installation. This would also enable us to do a health check in the Leantime docker-compose file, but also self-hosted installs would benefit this. Certainly in environments where there is dedicated health monitoring.

We could check if MySQL is reachable and there are > 30 tables like zp_%

SELECT count(TABLE_NAME) AS TableCount FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = (SELECT DATABASE() FROM DUAL) and TABLENAME like 'zp%';

This would be enough, since a not running PHP or Apache would result in a timeout and thus a not healthy system. The same is true for your network connection.

The script for leantime-docker could also check the following things

  • check the /health with curl
  • Diskspace utilisation < 80% OR +5GB free space
  • Webserver and PHP should not be checked; if they are not available
  • CPU utilisation < 80%

Note:

  • I would not check on internet connectivity available. There could be environments where they want to run Leantime shielded from the Internet.

— Reply to this email directly, view it on GitHub https://github.com/Leantime/leantime/issues/865, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALG4EFXSNOUY2UMNHSIBWBDVZAHPFANCNFSM56OXQFYQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

phulstaert commented 2 years ago

That's what I meant. A dashboard would also be good, but the API is my goal here. When everything is ok, it should return a json in a response with HTTP status 200. When something service-disruptive is detected, a respone has to be made using HTTP status 503. A 404 or timeout is also a possibility, but we don't have to do anything for that :-)