Is there any dedicated endpoint in DXA 2.0 where we can make a call to validate the status of the application? (Something similar to Spring Actuator's health check endpoint). I did some investigation and was unable to find information so ended up making custom endpoint for health check.
I have an web application which is based in DXA 2.0 and it is deployed over AWS ECS. In order to have a healthy instance I created a health check controller,
@RequestMapping(value = "/en-us/health/index.html", method = {RequestMethod.GET}) public @ResponseBody String ping() { return "Up"; }
In the target-group of AWS I have configured the health check path to
/en-us/health/index.html and I am expecting http status code 200 to mark this target as a healthy target.
My application starts correctly and has a request mapping in it with the endpoint I mentioned earlier,
[main] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/en-us/health/index.html],methods=[GET]}" onto public void com.abc.test.controller.HealthCheckController.ping()
However when a call is sent by the load balancer to this endpoint to verify if its up it's giving error 404 (See error that is shown in ECS events) , which does not make sense because there is an endpoint expecting that call and should return HTTP status 200. Due to this problem I never get and healthy instance behind the load balancer.
service custom-web (instance i-**********) (port 123) is unhealthy in target-group custom-web due to (reason Health checks failed with these codes: [404])
Is it possible that it has to do with topologyManager configuration? I am mentioning it because when a call is done by the load balancer, call originates from the EC2 instance where application is deployed and the request url is built in following structure,
11.11.11.111/en-us/health/index.html then it its possible that ModelService is throwing 404 Localization not found.
How is it possible to make health check work for DXA 2.0 application deployed in AWS ECS?