openhab / openhab-cloud

Cloud companion for openHAB instances
Eclipse Public License 2.0
314 stars 162 forks source link

add a health endpoint #448

Closed andibraeu closed 3 months ago

andibraeu commented 4 months ago

I use openhab cloud in a kubernetes environment. When the mongodb connection gets lost, it doesn't recover alone.

Kubernetes doesn't see that the state isn't healthy by just probing the home page. So I created a health endpoint that returns HTTP status 200 in case every is ok, else it returns HTTP status 500.

andibraeu commented 4 months ago

@digitaldan can you please have a look on that?

digitaldan commented 4 months ago

Hi, LGTM, i'm working in the code this week, so will give this a quick test today or tomorrow. Thanks!

digitaldan commented 4 months ago

HI one comment, can you add a config option to enable/disable this? I don't want to have this exposed on our public service, and would prefer not to try and block this specific route in our load balancer (its already complicated). Thanks !

andibraeu commented 4 months ago

Sure, I added a config option. Usually things like that I would only expose to another endpoint, that is not public.

andibraeu commented 3 months ago

@digitaldan can you please take a look again?

digitaldan commented 3 months ago

Hi, sorry i missed your changes in my sea of github notifications. Just left a few questions.

digitaldan commented 3 months ago

LGTM, thanks.