Micro Services, Headless & Integration Testing using Umbraco Health Checks.

Micro Services, Headless & Integration Testing using Umbraco Health Checks.

A website today is rarely depending on a single source of data. Using micro services and headless implementations our websites are usually a combination of several different services in a larger ecosystem, and all of these services combined add up to become your website application. It's not unusual in this day and age that a website might consist of more than 10, maybe 20 different API integrations, and keeping track of all these integrations requires well written documentation and a good build-/deploy process.

At Creuna, what we usually do is we create integration tests which we then setup in our build process in TeamCity, so if one of these services would stop working or start acting wonky, we usually catch this before it reaches the production site. It's also not possible to deploy a release to OctopusDeploy if any of our integration tests are failing. But what if one of these services unexpectedly starts acting out in production, due to something that might be out of our control?

Something I’ve been experimenting with lately is using custom Health Checks in Umbraco to secure integrations and ensure that all services in this ecosystem are up and running in a desired state. Health Checks are super easy to set up in Umbraco. These simple checks each consist of no more than 10 lines of code and all they really do is ping each service API used in the frontend, and in some cases also perform some sort of reversible operation. 

If a check is passed, show a friendly success message and if something is not doing what it's supposed to, show an error message. For me who loves test driven development it’s hard not to draw parallels between Health Checks and Integration/Unit Tests, because they resemble each other a lot. In this example I’ve created Health Checks for each integration and these checks can be run at anytime from the back-office of Umbraco (As you can see, something seems to be wrong with the OrderService API.):

No alt text provided for this image

This way, the next time the client calls support saying that their website is acting strange or is missing some sort of data, my first go-to will be these Health Checks to make sure all services are up and running before I start to investigate any further. It’s even possible to run these checks on a scheduled basis and attach email notifications so that I get a heads up if something is not responding the way it should.

This is just some inspiration, a proof of concept, of how one could use Health Checks in Umbraco. Go check out the Umbraco Documentation for more inspiration and example implementations: https://our.umbraco.com/documentation/extending/Health-Check/

Linn Örneskog

Sales Europe at GYMPAK - Partner at Bluewater-Bridge

8mo

Dennis, tack för att du delar med dig!

Like
Reply

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics