Curso-lenguaje-python/catch-all/05_infra_test/03_kafka/docker-compose.yaml
2024-08-07 23:59:44 +02:00

138 lines
3.3 KiB
YAML

services:
zookeeper:
image: bitnami/zookeeper:latest
container_name: zookeeper
ports:
- "2181:2181"
volumes:
- "zookeeper_data:/bitnami"
environment:
ALLOW_ANONYMOUS_LOGIN: "yes"
networks:
- kafka-network
healthcheck:
test: ["CMD-SHELL", "nc -z localhost 2181"]
interval: 10s
retries: 5
start_period: 10s
timeout: 5s
kafka:
image: bitnami/kafka:latest
container_name: kafka
ports:
- "9092:9092"
volumes:
- "kafka_data:/bitnami"
environment:
KAFKA_ADVERTISED_LISTENERS: INSIDE://kafka:9092,OUTSIDE://localhost:9093
KAFKA_LISTENERS: INSIDE://0.0.0.0:9092,OUTSIDE://0.0.0.0:9093
KAFKA_LISTENER_NAME: INSIDE
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_LISTENER_SECURITY_PROTOCOL: PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
networks:
- kafka-network
depends_on:
zookeeper:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "kafka-broker-api-versions.sh --bootstrap-server localhost:9092"]
interval: 10s
retries: 10
start_period: 60s
timeout: 10s
kafdrop:
image: obsidiandynamics/kafdrop:latest
container_name: kafdrop
ports:
- "9000:9000"
environment:
KAFKA_BROKERCONNECT: kafka:9092
networks:
- kafka-network
depends_on:
kafka:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:9000/ || exit 1"]
interval: 10s
retries: 5
start_period: 10s
timeout: 5s
producer_raw_recipes:
container_name: producer-raw-recipes
build:
context: ./producer-raw-recipes
networks:
- kafka-network
depends_on:
kafdrop:
condition: service_healthy
kafka:
condition: service_healthy
zookeeper:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/kafka/9092' || exit 1"]
interval: 10s
retries: 5
start_period: 10s
timeout: 5s
producer_consumer_parse_recipes:
container_name: producer-consumer-parse-recipes
build:
context: ./producer-consumer-parse-recipes
networks:
- kafka-network
depends_on:
kafdrop:
condition: service_healthy
kafka:
condition: service_healthy
zookeeper:
condition: service_healthy
producer_raw_recipes:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/kafka/9092' || exit 1"]
interval: 10s
retries: 5
start_period: 10s
timeout: 5s
consumer_notification:
container_name: consumer-notification
build:
context: ./consumer-notification
networks:
- kafka-network
depends_on:
kafdrop:
condition: service_healthy
kafka:
condition: service_healthy
zookeeper:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/kafka/9092' || exit 1"]
interval: 10s
retries: 5
start_period: 10s
timeout: 5s
networks:
kafka-network:
driver: bridge
volumes:
zookeeper_data:
driver: local
kafka_data:
driver: local