From d6be998337f70b0f4001d31117b438844bda3fa9 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Mon, 22 Mar 2021 09:52:46 +0100 Subject: [PATCH] Improve healthcheck in consul docker image Runtime fields are not reported till some seconds after startup in Consul 1.9. If tests are fast enough, they will get event without these expected fields, and will fail. Change the healthcheck to ensure that these fields are being reported. --- metricbeat/module/consul/_meta/Dockerfile | 5 ++--- metricbeat/module/consul/docker-compose.yml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/metricbeat/module/consul/_meta/Dockerfile b/metricbeat/module/consul/_meta/Dockerfile index 640e783c9a6b..2846d457c3a2 100644 --- a/metricbeat/module/consul/_meta/Dockerfile +++ b/metricbeat/module/consul/_meta/Dockerfile @@ -5,6 +5,5 @@ ENV CONSUL_BIND_INTERFACE='eth0' EXPOSE 8500 -# Use the same healthcheck as the Windows version of the image. -# https://github.com/Microsoft/mssql-docker/blob/a3020afeec9be1eb2d67645ac739438eb8f2c545/windows/mssql-server-windows/dockerfile#L31 -HEALTHCHECK --interval=1s --retries=90 CMD curl http://0.0.0.0:8500/v1/agent/metrics +# Wait till the service reports runtime metrics +HEALTHCHECK --interval=1s --retries=90 CMD curl -s http://0.0.0.0:8500/v1/agent/metrics | grep -q consul.runtime diff --git a/metricbeat/module/consul/docker-compose.yml b/metricbeat/module/consul/docker-compose.yml index 5131b14aa32d..998c089b2b74 100644 --- a/metricbeat/module/consul/docker-compose.yml +++ b/metricbeat/module/consul/docker-compose.yml @@ -2,7 +2,7 @@ version: '2.3' services: consul: - image: docker.elastic.co/integrations-ci/beats-consul:${CONSUL_VERSION:-1.9.3}-1 + image: docker.elastic.co/integrations-ci/beats-consul:${CONSUL_VERSION:-1.9.3}-2 build: context: ./_meta args: