When I had described the Go CD Health check plugin I’ve briefly talk about it’s use cases and that it can be set up for automatic delay of acceptance or stress tests. It’s time to describe a bit more in details and how it can be used with Spring Cloud application in particular. We wanted to run the tests of system user interface, but to do that we needed all the backing systems to be available. Since the application works in reverse proxy setup, we had simply await for the depending services to register with ‘UP’ state in our discovery service. So what we wanted to do, is to adjust the application health endpoint to make it aware whether the routes to backend services are available.
This required to register custom Spring Boot’s Actuator health indicator. Actually I had prepared a small utility project that will do this:
It can be turn on and off through settings ‘zulu.health.enabled’ flag:
zuul: ignoredServices: '*' health: enabled: true routes: resource: path: /api/** serviceId: rest-service oauth2: path: /uaa/** serviceId: oauth2 stripPrefix: false
So you can configure it for your test/dev/stg environments and disable it for production, mostly because cascading the system failures might not be such a good idea. Though for our use case this worked more then well.
The extensions has it’s limitations, at this point it only checks the explicitly configures services (the routes with specified serviceId) and verifies whether they are accessible from the discovery service.