bitwarden / self-host

Bitwarden's self-hosted release repository
GNU General Public License v3.0
307 stars 54 forks source link

feature request: health and readiness endpoints #218

Closed georglauterbach closed 3 months ago

georglauterbach commented 4 months ago

I am deploying docker.io/bitwarden/self-host:2024.1.2-beta in a Kubernetes cluster with great success. It works flawlessly, and I am genuinely grateful for that. As an improvement to the already existing deployment, I want to propose an internal (listening on 127.0.0.1) API endpoint that one can query. Authelia, for example, can be checked on /api/health. This can then easily be used to write a startupProbe or a readinessProbe:

livenessProbe:
httpGet:
  path: /api/health
  port: web-interface
periodSeconds: 300
timeoutSeconds: 3

The upside would be improved monitoring of the container itself.

sso-bitwarden commented 4 months ago

Hi,

The server has /api/alive for checking the API server. Is it similar to your suggestion?

georglauterbach commented 4 months ago

That is indeed something viable for a readiness or liveness probe. Do you think querying this for to check that the probe has started properly is viable as well?

Apart from that, I think this should be documented somewhere :)

sso-bitwarden commented 4 months ago

Do you think querying this for to check that the probe has started properly is viable as well?

I'm sorry, I don't understand your question. Could you please elaborate more?

georglauterbach commented 4 months ago

I'm sorry, I don't understand your question. Could you please elaborate more?

It was late - probably too late when I wrote this; I'm sorry.

Do you think querying the health endpoint (sending a GET to /api/alive) to check whether the container has spun up (finished initialization) is a good idea? Are there any caveats?

sso-bitwarden commented 4 months ago

HTTP 200 on /api/alive means the API service/container is up. It doesn't tell whether it could connect to the DB.

georglauterbach commented 4 months ago

How would one find out?

georglauterbach commented 3 months ago

I guess having /api/health is quite good; closing this for now.