From: Kai Moritz Date: Wed, 26 Oct 2022 16:44:00 +0000 (+0200) Subject: Healthcheck und Depends-On für die KRAFT-Konfig X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=3689a7c43e1e828106ab28baa70ca124350aa5bc;p=demos%2Fkafka%2Ftraining Healthcheck und Depends-On für die KRAFT-Konfig --- diff --git a/docker-compose.yml b/docker-compose.yml index 293db15..024b4d8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,8 @@ services: KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "false" ports: - 9081:9081 + healthcheck: + test: [ "CMD", "kafka-topics.sh", "--bootstrap-server", ":9092", "--list" ] kafka-2: image: bitnami/kafka:3.3.1 @@ -58,6 +60,8 @@ services: default: aliases: - kafka + healthcheck: + test: [ "CMD", "kafka-topics.sh", "--bootstrap-server", ":9092", "--list" ] kafka-3: image: bitnami/kafka:3.3.1 @@ -77,6 +81,8 @@ services: KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "false" ports: - 9083:9083 + healthcheck: + test: [ "CMD", "kafka-topics.sh", "--bootstrap-server", ":9092", "--list" ] setup: image: juplo/toolbox @@ -86,6 +92,13 @@ services: kafka-topics --bootstrap-server kafka:9092 --create --topic test --partitions 2 --replication-factor 3 --config min.insync.replicas=2 kafka-topics --bootstrap-server kafka:9092 --describe --topic test " + depends_on: + kafka-1: + condition: service_healthy + kafka-2: + condition: service_healthy + kafka-3: + condition: service_healthy cli: image: juplo/toolbox @@ -94,18 +107,46 @@ services: producer: image: juplo/simple-producer:1.0-SNAPSHOT command: producer + depends_on: + kafka-1: + condition: service_healthy + kafka-2: + condition: service_healthy + kafka-3: + condition: service_healthy consumer-1: image: juplo/simple-consumer:1.0-SNAPSHOT command: kafka:9092 test my-group consumer-1 + depends_on: + kafka-1: + condition: service_healthy + kafka-2: + condition: service_healthy + kafka-3: + condition: service_healthy consumer-2: image: juplo/simple-consumer:1.0-SNAPSHOT command: kafka:9092 test my-group consumer-2 + depends_on: + kafka-1: + condition: service_healthy + kafka-2: + condition: service_healthy + kafka-3: + condition: service_healthy consumer-3: image: juplo/simple-consumer:1.0-SNAPSHOT command: kafka:9092 test my-group consumer-3 + depends_on: + kafka-1: + condition: service_healthy + kafka-2: + condition: service_healthy + kafka-3: + condition: service_healthy spikzettel: image: juplo/toolbox @@ -116,3 +157,10 @@ services: --topic __consumer_offsets --from-beginning \ --formatter "kafka.coordinator.group.GroupMetadataManager\$$OffsetsMessageFormatter" ' + depends_on: + kafka-1: + condition: service_healthy + kafka-2: + condition: service_healthy + kafka-3: + condition: service_healthy