roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.65k stars 1.61k forks source link

Endpoints for Kubernetes liveness and readiness health checks #8372

Open thomascube opened 2 years ago

thomascube commented 2 years ago

When running Roundcube on Kubernetes, the deployments need probes to check whether the pod running Roundcube is healthy. The preferred way to do these checks are specific HTTP endpoints returning the according status codes.

I suggest to implement a specific task/action for these health checks (e.g. _task=healthcheck&_action=liveness) which does basic checks like database and imap server connection and maybe also memcache and others if configured. The action should also trigger a plugin hook healthcheck which allows plugins to do their own checks. If the probes succeed, they shall return a HTTP status 200 OK, if not a 50x status code. The response body is not required by Kubernetes but could return some useful information for humans. Some frameworks return JSON code like this:

{
  "status": "DOWN",
  "components": {
    "db": {
      "status": "UP",
      "message": null
    },
    "imap": {
      "status": "DOWN",
      "message": "No connection to host mail.example.org:993"
    }
  }
}

See the difference between liveness and readiness explained here.

alecpl commented 2 years ago

I think this should be a plugin. So, users can enable it when needed, but it is not normally enabled.

mjhost commented 1 year ago

I'm trying to setup such a plugin but it looks like an anauthorized user cannot execute a task different than login. Is that right?

JE4GLE commented 1 week ago

@mjhost

I'm trying to setup such a plugin but it looks like an anauthorized user cannot execute a task different than login. Is that right?

You can try getting the action at "startup" to implement a healthcheck endpoint.

mjhost commented 1 week ago

thanks @JE4GLE, i gave up the plugin, with php fpm I could enable the check on a different path