hoarder-app / hoarder

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
https://hoarder.app
GNU Affero General Public License v3.0
3.36k stars 120 forks source link

[FR] Adding Healthchecks do the dockerfiles #326

Open wuast94 opened 1 month ago

wuast94 commented 1 month ago

would be nice if healthchecks would be added to the containers 😊 im running a swam cluster and containers without a healtheck can make problems

MohamedBassem commented 1 month ago

@wuast94 Makes sense. You can define the healthchecks manually from the compose file as well btw.

wuast94 commented 1 month ago

yeah i know, the thing is on the worker part i dont even know how to define the healthcheck.

on the web part it should be an extra endpoint that just return a json or something like that if the web part and all sub parts are working as intended (redis db and so on), its more efficient than just checking a rendered html page.

MohamedBassem commented 1 month ago

@wuast94 makes sense. The good news is that the worker container is going away in the next release. For the web container, I can add a dummy ping endpoint.

wuast94 commented 1 month ago

well than it can be a thing i can do maybe. im in the beginning of development (atm im building a web app with svelte), but an healtheck endpoint seams like a nice thing to do for learning 😊

MohamedBassem commented 1 month ago

@wuast94 Sure! Hoarder uses Next.js. You can drop a ping/route.ts here (https://github.com/hoarder-app/hoarder/tree/main/apps/web/app/api) and implement a dummy endpoint (using this docs: https://nextjs.org/docs/app/api-reference/file-conventions/route) to return a plain text containing "PONG" for example. Then you should be able to call it with http://localhost:3000/api/ping

wuast94 commented 1 month ago

yeah sounds like a nice starting point. if i can i will also return if the redis and db connection are ok 😊

MohamedBassem commented 1 month ago

Redis is going away, and the db is sqlite db, so it's usually always ok :)

wuast94 commented 1 month ago

my bad i meaned meilisearch