-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
84 lines (78 loc) · 2.1 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
version: '3.5'
networks:
kafka-cluster-py:
services:
zookeeper:
image: wurstmeister/zookeeper
hostname: zookeeper
container_name: zookeeper
networks:
- kafka-cluster-py
ports:
- "0.0.0.0:2181:2181"
restart: unless-stopped
kafka-broker:
image: wurstmeister/kafka
hostname: kafka-broker
container_name: kafka-broker
networks:
- kafka-cluster-py
depends_on:
- zookeeper
ports:
- "0.0.0.0:9092:9092"
environment:
DOCKER_API_VERSION: 1.22
KAFKA_ADVERTISED_HOST_NAME: kafka-broker
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_CREATE_TOPICS: "messages:1:1"
restart: unless-stopped
schema-registry:
image: confluentinc/cp-schema-registry:7.0.1
hostname: schema-registry
container_name: schema-registry
networks:
- kafka-cluster-py
depends_on:
- kafka-broker
ports:
- "0.0.0.0:8081:8081"
environment:
SCHEMA_REGISTRY_HOST_NAME: schema-registry
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'kafka-broker:9092'
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
producer:
build: .
image: kafka-application:latest
hostname: producer
container_name: producer
networks:
- kafka-cluster-py
depends_on:
- kafka-broker
environment:
DOCKER_API_VERSION: 1.22
BOOTSTRAP_SERVERS: kafka-broker:9092
TOPIC: messages
AVRO_SCHEMA_LOCATION: /avro/messages.avro
SCHEMA_REGISTRY_URL: http://schema-registry:8081
command: ["python3", "/app/producer.py"]
subscriber:
build: .
image: kafka-application:latest
hostname: subscriber
container_name: subscriber
networks:
- kafka-cluster-py
depends_on:
- kafka-broker
environment:
DOCKER_API_VERSION: 1.22
BOOTSTRAP_SERVERS: kafka-broker:9092
TOPIC: messages
AVRO_SCHEMA_LOCATION: /avro/messages.avro
SCHEMA_REGISTRY_URL: http://schema-registry:8081
KAFKA_GROUP_ID: the-consumer
KAFKA_POLL_TIMEOUT: "1.0"
KAFKA_POLL_MAX_RECS_PER_POLL: "5"
command: ["python3", "/app/subscriber.py"]