EuNEx / docker /docker-compose.yml
RayMelius's picture
v0.5.0: Kafka Bus integration (Optiq KFK model)
06cfa59
services:
kafka:
image: apache/kafka:3.9.0
ports:
- "9092:9092"
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_NUM_PARTITIONS: 4
KAFKA_LOG_RETENTION_HOURS: 24
CLUSTER_ID: "EuNEx-kafka-cluster-001"
volumes:
- kafka_data:/tmp/kraft-combined-logs
healthcheck:
test: ["CMD-SHELL", "/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list || exit 1"]
interval: 10s
timeout: 5s
retries: 5
kafka-init:
image: apache/kafka:3.9.0
depends_on:
kafka:
condition: service_healthy
entrypoint: ["/bin/bash", "-c"]
command:
- |
/opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists \
--topic eunex.recovery.fragments --partitions 4 --replication-factor 1
/opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists \
--topic eunex.trades --partitions 4 --replication-factor 1
/opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists \
--topic eunex.market-data --partitions 4 --replication-factor 1
/opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists \
--topic eunex.orders --partitions 4 --replication-factor 1
/opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists \
--topic eunex.control --partitions 1 --replication-factor 1
echo "Topics created."
eunex:
build:
context: ..
dockerfile: docker/Dockerfile
depends_on:
kafka-init:
condition: service_completed_successfully
environment:
EUNEX_KAFKA_BROKERS: kafka:9092
EUNEX_DATA_DIR: /app/data
ports:
- "7860:7860"
- "8090:8090"
- "8091:8091"
- "9001:9001"
volumes:
- eunex_data:/app/data
volumes:
kafka_data:
eunex_data: