From f8940f111ce20c85dc35c2f64e0ee8808d132c66 Mon Sep 17 00:00:00 2001 From: Tony Lawson Date: Thu, 28 Mar 2024 15:01:23 +0000 Subject: [PATCH] ES-2038: Optimize container dependencies in Compose file --- config/combined-worker-compose.yaml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/config/combined-worker-compose.yaml b/config/combined-worker-compose.yaml index a6e9cbc0..90ba1c1b 100644 --- a/config/combined-worker-compose.yaml +++ b/config/combined-worker-compose.yaml @@ -1,7 +1,12 @@ -version: '2' +version: '2.1' services: postgresql: image: postgres:14.10 + healthcheck: + test: [ "CMD-SHELL", "pg_isready", "-d", "${POSTGRES_DB}" ] + interval: 30s + timeout: 60s + retries: 5 restart: unless-stopped tty: true environment: @@ -13,6 +18,11 @@ services: kafka: image: confluentinc/cp-kafka:7.6.0 + healthcheck: + test: kafka-topics --bootstrap-server kafka:29092 --list + interval: 30s + timeout: 10s + retries: 3 ports: - 9092:9092 environment: @@ -34,7 +44,8 @@ services: kafka-create-topics: image: corda-os-docker.software.r3.com/corda-os-plugins:${CORDA_RUNTIME_VERSION} depends_on: - - kafka + kafka: + condition: service_healthy command: [ "topic", "-b=kafka:29092", @@ -45,9 +56,12 @@ services: corda: image: corda-os-docker.software.r3.com/corda-os-combined-worker-kafka:${CORDA_RUNTIME_VERSION} depends_on: - - postgresql - - kafka - - kafka-create-topics + postgresql: + condition: service_healthy + kafka: + condition: service_healthy + kafka-create-topics: + condition: service_completed_successfully volumes: - ../config:/config - ../logs:/logs