| @@ -0,0 +1,50 @@ | |||||
| version: "2" | |||||
| services: | |||||
| kafdrop: | |||||
| image: obsidiandynamics/kafdrop | |||||
| restart: "no" | |||||
| ports: | |||||
| - "127.0.0.1:9000:9000" | |||||
| environment: | |||||
| KAFKA_BROKERCONNECT: "kafka:29092" | |||||
| depends_on: | |||||
| - "kafka" | |||||
| kafka: | |||||
| image: apache/kafka:3.9.0 | |||||
| restart: "no" | |||||
| ports: | |||||
| # - "127.0.0.1:2181:2181" | |||||
| - "127.0.0.1:9092:9092" | |||||
| - "127.0.0.1:9093:9093" | |||||
| healthcheck: # <-- ADD THIS BLOCK | |||||
| test: ["CMD-SHELL", "/opt/kafka/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --list"] | |||||
| interval: 10s | |||||
| timeout: 5s | |||||
| retries: 10 | |||||
| start_period: 20s | |||||
| environment: | |||||
| KAFKA_NODE_ID: 1 | |||||
| KAFKA_PROCESS_ROLES: broker,controller | |||||
| KAFKA_LISTENERS: INTERNAL://:29092,EXTERNAL://:9092,CONTROLLER://127.0.0.1:9093 | |||||
| KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://localhost:9092 | |||||
| KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER | |||||
| KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT | |||||
| KAFKA_CONTROLLER_QUORUM_VOTERS: 1@127.0.0.1:9093 | |||||
| KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL | |||||
| KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | |||||
| KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 | |||||
| KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 | |||||
| KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 | |||||
| KAFKA_NUM_PARTITIONS: 3 | |||||
| kafka-init: | |||||
| image: apache/kafka:3.9.0 | |||||
| command: [ "/bin/bash", "-c", "chmod +x /tmp/create_topic.sh && /tmp/create_topic.sh"] | |||||
| depends_on: | |||||
| kafka: | |||||
| condition: service_healthy | |||||
| volumes: | |||||
| - ./init-scripts/create_topic.sh:/tmp/create_topic.sh | |||||
| environment: | |||||
| - TOPIC_NAMES=topic1,topic2,topic3 | |||||
| @@ -1,82 +0,0 @@ | |||||
| services: | |||||
| kafka: | |||||
| image: apache/kafka:3.9.0 | |||||
| container_name: kafka | |||||
| command: | |||||
| - sh | |||||
| - -c | |||||
| - | | |||||
| CLUSTER_ID=$$(/opt/kafka/bin/kafka-storage.sh random-uuid) | |||||
| /opt/kafka/bin/kafka-storage.sh format --config /opt/kafka/config/kraft/server.properties --cluster-id $$CLUSTER_ID | |||||
| /opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/kraft/server.properties & | |||||
| pid=$! | |||||
| # wait until Kafka is actually alive | |||||
| until /opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list >/dev/null 2>&1; do | |||||
| sleep 1 | |||||
| done | |||||
| # create topic | |||||
| /opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 \ | |||||
| --create --if-not-exists --topic rawbeacons \ | |||||
| --partitions 1 --replication-factor 1 | |||||
| # mark ready | |||||
| touch /tmp/ready | |||||
| wait $pid | |||||
| healthcheck: | |||||
| test: ["CMD-SHELL", "[ -f /tmp/ready ]"] | |||||
| interval: 3s | |||||
| timeout: 2s | |||||
| retries: 20 | |||||
| ports: | |||||
| - "127.0.0.1:9092:9092" | |||||
| # presense-decoder: | |||||
| # build: | |||||
| # context: ../ | |||||
| # dockerfile: build/package/Dockerfile.decoder | |||||
| # image: presense-decoder | |||||
| # container_name: presense-decoder | |||||
| # environment: | |||||
| # - REDIS_URL=valkey:6379 | |||||
| # - KAFKA_URL=kafka:9092 | |||||
| # depends_on: | |||||
| # kafka: | |||||
| # condition: service_healthy | |||||
| # restart: always | |||||
| # presense-server: | |||||
| # build: | |||||
| # context: ../ | |||||
| # dockerfile: build/package/Dockerfile.server | |||||
| # image: presense-server | |||||
| # container_name: presense-server | |||||
| # environment: | |||||
| # - REDIS_URL=valkey:6379 | |||||
| # - KAFKA_URL=kafka:9092 | |||||
| # depends_on: | |||||
| # kafka: | |||||
| # condition: service_healthy | |||||
| # ports: | |||||
| # - "127.0.0.1:1902:1902" | |||||
| # restart: always | |||||
| # presense-bridge: | |||||
| # build: | |||||
| # context: ../ | |||||
| # dockerfile: build/package/Dockerfile.bridge | |||||
| # image: presense-bridge | |||||
| # container_name: presense-bridge | |||||
| # environment: | |||||
| # - KAFKA_URL=kafka:9092 | |||||
| # - MQTT_HOST=192.168.1.101:1883 | |||||
| # - MQTT_USERNAME=user | |||||
| # - MQTT_PASSWORD=pass | |||||
| # depends_on: | |||||
| # kafka: | |||||
| # condition: service_healthy | |||||
| # restart: always | |||||
| @@ -0,0 +1,16 @@ | |||||
| #!/bin/bash | |||||
| # create topic rawbeacons | |||||
| /opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:29092 \ | |||||
| --create --if-not-exists --topic rawbeacons \ | |||||
| --partitions 1 --replication-factor 1 | |||||
| # create topic apibeacons | |||||
| /opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:29092 \ | |||||
| --create --if-not-exists --topic apibeacons \ | |||||
| --partitions 1 --replication-factor 1 | |||||
| # create topic alertBeacons | |||||
| /opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:29092 \ | |||||
| --create --if-not-exists --topic alertbeacons \ | |||||
| --partitions 1 --replication-factor 1 | |||||