2024-10-28 14:47:20 +04:00
|
|
|
services:
|
|
|
|
zookeeper:
|
2024-11-12 18:03:45 +04:00
|
|
|
networks:
|
|
|
|
- vpn
|
2024-10-28 14:47:20 +04:00
|
|
|
image: confluentinc/cp-zookeeper:7.4.0
|
|
|
|
environment:
|
|
|
|
ZOOKEEPER_CLIENT_PORT: 2181
|
|
|
|
ZOOKEEPER_TICK_TIME: 2000
|
|
|
|
ports:
|
|
|
|
- 2181:2181
|
|
|
|
|
|
|
|
kafka:
|
2024-11-12 18:03:45 +04:00
|
|
|
networks:
|
|
|
|
- vpn
|
2024-10-28 14:47:20 +04:00
|
|
|
image: confluentinc/cp-kafka:7.4.0
|
|
|
|
ports:
|
|
|
|
- 29092:29092
|
|
|
|
environment:
|
|
|
|
KAFKA_BROKER_ID: 1
|
|
|
|
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
2024-11-12 18:03:45 +04:00
|
|
|
KAFKA_LISTENERS: EXTERNAL_SAME_HOST://:29092,EXTERNAL_DIFFERENT_HOST://:29093,INTERNAL://:9092
|
|
|
|
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,EXTERNAL_SAME_HOST://localhost:29092,EXTERNAL_DIFFERENT_HOST://157.245.80.232:29093
|
|
|
|
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL_SAME_HOST:PLAINTEXT,EXTERNAL_DIFFERENT_HOST:PLAINTEXT
|
|
|
|
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
|
2024-10-28 14:47:20 +04:00
|
|
|
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
|
|
|
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
|
|
|
|
KAFKA_LOG_FLUSH_INTERVAL_MESSAGES: 10000
|
|
|
|
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
|
|
|
|
depends_on:
|
|
|
|
- zookeeper
|
|
|
|
|
|
|
|
init-kafka:
|
2024-11-12 18:03:45 +04:00
|
|
|
networks:
|
|
|
|
- vpn
|
2024-10-28 14:47:20 +04:00
|
|
|
image: confluentinc/cp-kafka:7.4.0
|
|
|
|
depends_on:
|
|
|
|
- kafka
|
|
|
|
entrypoint: [ '/bin/sh', '-c' ]
|
|
|
|
command: |
|
|
|
|
"
|
|
|
|
# blocks until kafka is reachable
|
2024-11-12 18:03:45 +04:00
|
|
|
kafka-topics --bootstrap-server kafka:9092 --list
|
2024-10-28 14:47:20 +04:00
|
|
|
|
|
|
|
echo -e 'Creating kafka topics'
|
2024-11-12 18:03:45 +04:00
|
|
|
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --topic commands --replication-factor 1 --partitions 1
|
|
|
|
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --topic data --replication-factor 1 --partitions 1
|
|
|
|
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --topic response --replication-factor 1 --partitions 1
|
2024-10-28 14:47:20 +04:00
|
|
|
|
|
|
|
echo -e 'Successfully created the following topics:'
|
2024-11-12 18:03:45 +04:00
|
|
|
kafka-topics --bootstrap-server kafka:9092 --list
|
2024-10-28 14:47:20 +04:00
|
|
|
"
|
|
|
|
|
|
|
|
kafka-ui:
|
2024-11-12 18:03:45 +04:00
|
|
|
networks:
|
|
|
|
- vpn
|
2024-10-28 14:47:20 +04:00
|
|
|
container_name: kafka-ui
|
|
|
|
image: provectuslabs/kafka-ui:latest
|
|
|
|
ports:
|
|
|
|
- 8080:8080
|
|
|
|
depends_on:
|
|
|
|
- kafka
|
|
|
|
environment:
|
|
|
|
KAFKA_CLUSTERS_0_NAME: local
|
|
|
|
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:29092
|
2024-11-12 18:03:45 +04:00
|
|
|
KAFKA_CLUSTERS_0_METRICS_PORT: 9997
|
|
|
|
|
|
|
|
networks:
|
|
|
|
vpn:
|
|
|
|
name: kafkaVPN
|