forked from gongled/kafka-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
190 lines (167 loc) · 4.18 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
version: '3.9'
################################################################################
x-app: &app
build: &app-build
context: .
dockerfile: Dockerfile.app
profiles:
- app
command:
- /bin/sh
- -c
- "while : ; do sleep 60 ; done"
restart: unless-stopped
x-consumer: &consumer
<<: *app
command:
- app
environment:
KAFKA_TOPIC: "example"
KAFKA_BROKERS: "kafka-1:9092,kafka-2:9092,kafka-3:9092"
KAFKA_CONSUMER_GROUP: "example-consumer-group"
build:
<<: *app-build
args:
BUILD_TARGET: "consumer"
x-producer: &producer
<<: *app
command:
- app
environment:
KAFKA_TOPIC: "example"
KAFKA_BROKERS: "kafka-1:9092,kafka-2:9092,kafka-3:9092"
build:
<<: *app-build
args:
BUILD_TARGET: "producer"
x-kafka: &kafka
build: &kafka-build
context: .
dockerfile: Dockerfile.kafka
args:
JMX_JAVAAGENT_VERSION: "${JMX_JAVAAGENT_VERSION}"
environment: &kafka-env
HOME: /opt/bitnami/kafka
KAFKA_CFG_ZOOKEEPER_CONNECT: "zookeeper:2181"
ALLOW_PLAINTEXT_LISTENER: "yes"
KAFKA_OPTS: >-
-javaagent:/opt/bitnami/kafka/libs/jmx_prometheus_javaagent-${JMX_JAVAAGENT_VERSION}.jar=${JMX_JAVAAGENT_PORT}:/etc/kafka/prometheus/kafka.yml
volumes:
- ./jmx-exporter/kafka.yml:/etc/kafka/prometheus/kafka.yml:ro
depends_on:
- zookeeper
x-zookeeper: &zookeeper
image: docker.io/bitnami/zookeeper:${ZK_VERSION}
volumes:
- "zookeeper:/bitnami"
environment:
ALLOW_ANONYMOUS_LOGIN: "yes"
x-redpanda-console: &redpanda-console
image: docker.redpanda.com/vectorized/console:v${REDPANDA_CONSOLE_VERSION}
entrypoint: /bin/sh
command: -c 'echo "$$CONSOLE_CONFIG_FILE" > /tmp/config.yml; /app/console'
environment:
CONFIG_FILEPATH: /tmp/config.yml
CONSOLE_CONFIG_FILE: |
kafka:
brokers: ["kafka-1:9092", "kafka-2:9092", "kafka-3:9092"]
schemaRegistry:
enabled: false
urls: ["http://redpanda-0:8081"]
ports:
- ${REDPANDA_CONSOLE_PORT}:8080
depends_on:
- kafka-1
- kafka-2
- kafka-3
x-kafka-exporter: &kafka-exporter
image: docker.io/bitnami/kafka-exporter:${KAFKA_EXPORTER_VERSION}
restart: unless-stopped
command: ["--kafka.server=kafka-1:9092"]
# profiles:
# - metrics
x-prometheus: &prometheus
image: quay.io/prometheus/prometheus:${PROMETHEUS_VERSION}
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- ${PROMETHEUS_PORT}:9090
# profiles:
# - metrics
x-grafana: &grafana
image: docker.io/grafana/grafana:${GRAFANA_VERSION}
user: root
restart: unless-stopped
ports:
- ${GRAFANA_PORT}:3000
volumes:
- grafana:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning
- ./grafana/dashboards:/var/lib/grafana/dashboards
# profiles:
# - metrics
environment:
GF_SECURITY_ADMIN_PASSWORD: admin
################################################################################
services:
# Sample consumer
consumer-1:
<<: *consumer
container_name: consumer-1
consumer-2:
<<: *consumer
container_name: consumer-2
consumer-3:
<<: *consumer
container_name: consumer-3
# Sample producer
producer:
<<: *producer
container_name: producer-1
# Zookeeper quorum
zookeeper:
<<: *zookeeper
container_name: zookeeper
# Redpanda Console UI
ui:
<<: *redpanda-console
container_name: ui
# Kafka: broker #1
kafka-1:
<<: *kafka
container_name: kafka-1
environment:
<<: *kafka-env
KAFKA_BROKER_ID: 1
# Kafka: broker #2
kafka-2:
<<: *kafka
container_name: kafka-2
environment:
<<: *kafka-env
KAFKA_BROKER_ID: 2
# Kafka: broker #3
kafka-3:
<<: *kafka
container_name: kafka-3
environment:
<<: *kafka-env
KAFKA_BROKER_ID: 3
# Grafana
grafana:
<<: *grafana
container_name: grafana
# Prometheus
prometheus:
<<: *prometheus
container_name: prometheus
# Prometheus
kafka-exporter:
<<: *kafka-exporter
container_name: kafka-exporter
################################################################################
volumes:
zookeeper:
driver: local
grafana:
driver: local