[MGNLREST-220] Add a health check into rest-services (so it is available from CE on) Created: 15/Oct/19  Updated: 04/Mar/20  Resolved: 10/Jan/20

Status: Closed
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: None
Fix Version/s: 2.1.5

Type: Task Priority: Neutral
Reporter: Maxime Michel Assignee: Maxime Michel
Resolution: Done Votes: 2
Labels: 61
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File health-check.png    
Issue Links:
Relates
dependency
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Visible to:
Loukas Andreadelis
Epic Link: Magnolia deliverables

 Description   

This is (or should be) an easy task that's been brought up before and that could improve developer experience without a big bang. I've included a screenshot from how a partner is using the login page's logo as a health check.

Goal is to do a proper jax-rs endpoint, with ModuleManager injected, unlike the current health check: https://git.magnolia-cms.com/projects/OD/repos/cloud-modules/browse/magnolia-now-healthcheck/src/main/java/info/magnolia/cloud/monitoring/healthcheck/servlets/HealthCheckServlet.java



 Comments   
Comment by Maxime Michel [ 10/Jan/20 ]

The URL that this endpoint is available at is /.rest/status. Accessing it doesn't require credentials. In enterprise webapps, the endpoint will be accessible once Magnolia is installed and ready, even if no license was specified.

Comment by Christopher Zimmermann [ 04/Mar/20 ]

Could you provide a summary of what this does - or link to a wiki page?

I tried it and saw an empty response with a 200 response code. If there is a problem does it just give an error code - or does it give an indication of what the problem is? What all must be working in order to get a 200 - ie what does it really indicate?

Comment by Maxime Michel [ 04/Mar/20 ]

There is some documentation here: https://documentation.magnolia-cms.com/display/DOCS57/REST+services+health+check

This endpoint is meant for robots (orchestrators or monitors). That is why it only returns HTTP codes, since that is what those expect. Two scenarios are common:

  • Magnolia is started, the orchestrator will wait until it sees a 200. If that doesn't happen before a fixed timeout, then it'll report that Magnolia failed to start and bail out
  • a monitor checks whether Magnolia is still up every 5 minutes. If the outcome of that call is anything but 200, then it'll trigger an alert.

There won't be details in case there is a problem, no, it'll return 503 instead.

A 200 status code depends on MgnlContext.hasInstance() && !this.moduleManager.getStatus().needsUpdateOrInstall(). For what exact cases that covers in practice, you might want to ask a core developer. I simply transferred this from the health check that was done for the cloud, and that has been used in production for some time now.

Generated at Mon Feb 12 06:57:48 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.