openflighthpc / concertim-ansible-playbook

Ansible playbook for building a Concertim appliance
Eclipse Public License 2.0
0 stars 0 forks source link

Add Docker healthcheck for visualisation service #86

Closed jamesremuscat closed 6 months ago

jamesremuscat commented 6 months ago

A number of the services started by the Concertim docker-compose file require that the visualisation service is up and running before they are able to start.

Previously, this had been worked around in the Ansible playbook by manually starting the visualisation service, waiting for it to start listening on its assigned port, then starting the remainder of the services.

This PR instead defines a Docker healthcheck for the visualisation service: Docker itself will poll the HTTP endpoint periodically (from within the container itself) and report when the container is "healthy". Adding explicit dependencies to the generated docker-compose file means that docker compose up will wait for the visualisation service to be healthy before it attempts to start any service depending on it.

The dependencies are only added to relevant services in docker-compose.yml if the visualisation service has also been defined (i.e. enable_concertim is true). I think I've identified which of the concertim-openstack-service containers have this dependency, but please check I've not missed anything :)

Possible future enhancement

We could consider defining the healthcheck in the Dockerfile for the visualisation app rather than in this docker-compose.yml, so that it's available for other uses of the image (if there are any).