hapi-fhir-jpaserver-starter icon indicating copy to clipboard operation
hapi-fhir-jpaserver-starter copied to clipboard

Unable to Perform Health Checks with Hapi FHIR in Docker Swarm

Open brett-onions opened this issue 1 year ago • 3 comments

Issue Description: We are currently using Hapi Fhir (specifically the Hapi Fhir Starter) within Docker Swarm to manage our services. Our objective is to conduct health checks to monitor the current state of the service. Hapi FHIR provides a designated endpoint for health checks at /actuator/health, which we intend to utilize for this purpose.

However, we encountered a challenge while attempting to implement this. Our preference was to utilize the official image hapiproject/hapi. Regrettably, we encountered difficulty performing curl or wget commands to access the health check endpoint due to the absence of these applications within the image.

//docker-compose.yaml

healthcheck:
      test: /bin/curl --no-verbose --tries=1 --spider http://localhost:8080/actuator/health
      interval: 30s
      timeout: 5s
      retries: 5
      start_period: 2m

I seeking guidance on how to effectively conduct the health check without resorting to the creation of a separate image solely for the installation of curl or wget.

brett-onions avatar Feb 21 '24 12:02 brett-onions

@brett-onions which version of HAPI FHIR starter are you using?

jkiddo avatar Apr 16 '24 17:04 jkiddo

@jkiddo I am using Hapi FHIR v7.0.3

brett-onions avatar Apr 22 '24 06:04 brett-onions

@brett-onions I think you got the hostname wrong. If you wan't to use e.g. curl in a separate container that queries the HAPI FHIR container then you need to use the service name as hostname. If I start up a regular HAPI FHIR starter using e.g. docker run -p 8080:8080 hapiproject/hapi:latest then I can invoke curl http://localhost:8080/actuator/health with success. If I where to do it in e.g. a docker compose/swarm setting then the curl command would be e.g. curl http://<service-name>:8080/actuator/health

jkiddo avatar Apr 22 '24 16:04 jkiddo