-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
316 lines (298 loc) · 11.9 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
---
version: '2.3'
services:
zookeeper:
container_name: workshop-zookeeper
image: confluentinc/cp-zookeeper:latest
cpus: 0.5
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
container_name: workshop-kafka
image: confluentinc/cp-enterprise-kafka:latest
depends_on:
- zookeeper
ports:
# Exposes 9092 for external connections to the broker
# Use kafka:29092 for connections internal on the docker network
- 9092:9092
environment:
KAFKA_BROKER_ID: 1
KAFKA_BROKER_RACK: "rack-1"
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_DELETE_TOPIC_ENABLE: "true"
KAFKA_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_CONFLUENT_LICENSE_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 100
CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: kafka:9092
CONFLUENT_METRICS_REPORTER_ZOOKEEPER_CONNECT: zookeeper:2181
CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1
CONFLUENT_METRICS_REPORTER_MAX_REQUEST_SIZE: 1000012
# to avoid race condition with c3
CONFLUENT_METRICS_REPORTER_TOPIC_CREATE: "true"
CONFLUENT_METRICS_ENABLE: 'false'
CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous'
KAFKA_LOG4J_ROOT_LOGLEVEL: WARN
KAFKA_LOG4J_LOGGERS: "kafka.controller=WARN,state.change.logger=WARN,kafka.log.LogCleaner=WARN"
KAFKA_JMX_PORT: 9991
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
# Schema Validation
KAFKA_CONFLUENT_SCHEMA_REGISTRY_URL: "http://schema-registry:8081"
volumes:
- ./produce-data:/produce-data
schema-registry:
image: confluentinc/cp-schema-registry:latest
container_name: workshop-schema-registry
cpus: 0.4
ports:
- 8081:8081
depends_on:
- zookeeper
- kafka
environment:
SCHEMA_REGISTRY_HOST_NAME: schema-registry
# SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper:2181
SCHEMA_REGISTRY_LISTENERS: "http://0.0.0.0:8081"
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: "PLAINTEXT://kafka:29092"
SCHEMA_REGISTRY_LOG4J_ROOT_LOGLEVEL: INFO
connect-ext:
image: confluentinc/cp-kafka-connect:latest
container_name: workshop-connect-ext
depends_on:
- zookeeper
- kafka
- schema-registry
ports:
- 8083:8083
environment:
CONNECT_BOOTSTRAP_SERVERS: "kafka:29092"
CONNECT_REST_PORT: 8083
CONNECT_REST_ADVERTISED_HOST_NAME: connect-ext
CONNECT_GROUP_ID: connect-ext
CONNECT_CONFIG_STORAGE_TOPIC: _connect-ext-configs
CONNECT_OFFSET_STORAGE_TOPIC: _connect-ext-offsets
CONNECT_STATUS_STORAGE_TOPIC: _connect-ext-status
CONNECT_KEY_CONVERTER: io.confluent.connect.avro.AvroConverter
CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081'
CONNECT_VALUE_CONVERTER: io.confluent.connect.avro.AvroConverter
CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081'
CONNECT_LOG4J_ROOT_LOGLEVEL: "INFO"
CONNECT_LOG4J_LOGGERS: "org.apache.kafka.connect.runtime.rest=WARN,org.reflections=ERROR"
CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: "1"
CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: "1"
CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: "1"
CONNECT_PLUGIN_PATH: '/usr/share/java,/usr/share/confluent-hub-components,/local-connect-jars'
CONNECT_PRODUCER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor"
CONNECT_CONSUMER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor"
volumes:
- ./confluent-hub-components:/local-connect-jars
- ./datagen:/datagen
command:
- /bin/bash
- -c
- |
# Now launch Kafka Connect
/etc/confluent/docker/run &
#
echo "Waiting for Kafka Connect to start listening on $$CONNECT_REST_ADVERTISED_HOST_NAME ⏳"
while [ $$(curl -s -o /dev/null -w %{http_code} http://$$CONNECT_REST_ADVERTISED_HOST_NAME:$$CONNECT_REST_PORT/connectors) -ne 200 ] ; do
echo -e $$(date) " Kafka Connect listener HTTP state: " $$(curl -s -o /dev/null -w %{http_code} http://$$CONNECT_REST_ADVERTISED_HOST_NAME:$$CONNECT_REST_PORT/connectors) " (waiting for 200)"
sleep 5
done
echo "Waiting for Schema Registry to start listening on schema-registry:8081 ⏳"
while [ $$(curl -s -o /dev/null -w %{http_code} http://schema-registry:8081) -eq 000 ] ; do
echo -e $$(date) " Schema Registry listener HTTP state: " $$(curl -s -o /dev/null -w %{http_code} http://schema-registry:8081) " (waiting for != 000)"
sleep 5
done
#
echo "Creating datagen connector 1"
curl -s -X PUT -H "Content-Type:application/json" http://localhost:8083/connectors/source-aml-status-change/config \
-d '{
"connector.class": "io.confluent.kafka.connect.datagen.DatagenConnector",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"kafka.topic": "AML_Status",
"max.interval": 1000,
"schema.filename": "/datagen/aml_service.avro",
"schema.keyfield": "payment_id"
}'
sleep 2
echo "Creating datagen connector 2"
curl -s -X PUT -H "Content-Type:application/json" http://localhost:8083/connectors/source-funds-status-change/config \
-d '{
"connector.class": "io.confluent.kafka.connect.datagen.DatagenConnector",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"kafka.topic": "Funds_Status",
"max.interval": 1500,
"schema.filename": "/datagen/funds_service.avro",
"schema.keyfield": "payment_id"
}'
sleep 2
echo "Creating datagen connector 3"
curl -s -X PUT -H "Content-Type:application/json" http://localhost:8083/connectors/source-payment-instruction/config \
-d '{
"connector.class": "io.confluent.kafka.connect.datagen.DatagenConnector",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"kafka.topic": "Payment_Instruction",
"msgRate": 3,
"schema.filename": "/datagen/payment_service.avro",
"schema.keyfield": "payment_id"
}'
# Don't let the container die
sleep infinity
ksqldb-server:
image: confluentinc/cp-ksqldb-server:latest
container_name: workshop-ksqldb-server
depends_on:
- kafka
- schema-registry
volumes:
- ./extensions:/etc/ksqldb/ext
cpus: 1.0
ports:
- 8088:8088
environment:
KSQL_CONFIG_DIR: "/etc/ksqldb"
KSQL_KSQL_EXTENSION_DIR: "/etc/ksqldb/ext/"
KSQL_CUB_KAFKA_TIMEOUT: 120
KSQL_BOOTSTRAP_SERVERS: kafka:29092
KSQL_LISTENERS: http://0.0.0.0:8088
KSQL_KSQL_SCHEMA_REGISTRY_URL: http://schema-registry:8081
KSQL_KSQL_SERVICE_ID: workshop_
KSQL_KSQL_CONNECT_URL: http://connect-ext:8083
# uncomment this one to launch a Connect worker INSIDE the KSQL JVM
# KSQL_KSQL_CONNECT_WORKER_CONFIG: /etc/ksql/worker.properties
KSQL_KSQL_LOGGING_PROCESSING_TOPIC_AUTO_CREATE: "true"
KSQL_KSQL_LOGGING_PROCESSING_STREAM_AUTO_CREATE: "true"
KSQL_KSQL_LOGGING_PROCESSING_TOPIC_PARTITIONS: 2
KSQL_KSQL_LOGGING_PROCESSING_TOPIC_REPLICATION_FACTOR: 1
KSQL_PRODUCER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor"
KSQL_CONSUMER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor"
KSQL_KSQL_COMMIT_INTERVAL_MS: 2000
KSQL_KSQL_CACHE_MAX_BYTES_BUFFERING: 10000000
healthcheck:
disable: true
ksqldb-cli:
# *-----------------------------*
# To connect to the KSQL CLI:
# docker exec -it ksql-cli ksql http://ksqldb-server:8088
# *-----------------------------*
container_name: workshop-ksqldb-cli
image: confluentinc/cp-ksqldb-cli:latest
cpus: 0.8
depends_on:
- ksqldb-server
entrypoint: /bin/sh
tty: true
# Other systems
mysql:
# *-----------------------------*
# To connect to the DB:
# docker-compose exec mysql bash -c 'mysql -u root -p$MYSQL_ROOT_PASSWORD'
# *-----------------------------*
image: mysql:8.0
container_name: workshop-mysql
cpus: 0.5
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=confluent
# specify an empty database to be created, adn a user with all rights to it, on FIRST startup
- MYSQL_DATABASE=db4
- MYSQL_USER=mysqluser
- MYSQL_PASSWORD=mysqlpass
volumes:
- ./data/mysql:/docker-entrypoint-initdb.d/
control-center:
image: confluentinc/cp-enterprise-control-center:latest
hostname: control-center
container_name: workshop-control-center
depends_on:
- zookeeper
- kafka
- schema-registry
- connect-ext
- ksqldb-server
cpus: 0.8
ports:
- "9021:9021"
environment:
CONTROL_CENTER_BOOTSTRAP_SERVERS: 'kafka:29092'
CONTROL_CENTER_ZOOKEEPER_CONNECT: 'zookeeper:2181'
CONTROL_CENTER_CONNECT_WORKSHOP_CLUSTER: 'http://connect-ext:8083'
CONTROL_CENTER_KSQL_WORKSHOP_URL: "http://ksqldb-server:8088"
CONTROL_CENTER_KSQL_WORKSHOP_ADVERTISED_URL: http://localhost:8088
CONTROL_CENTER_SCHEMA_REGISTRY_URL: "http://schema-registry:8081"
CONTROL_CENTER_REPLICATION_FACTOR: 1
CONTROL_CENTER_INTERNAL_TOPICS_PARTITIONS: 1
CONTROL_CENTER_INTERNAL_TOPICS_REPLICATION: 1
CONTROL_CENTER_MONITORING_INTERCEPTOR_TOPIC_PARTITIONS: 1
CONTROL_CENTER_MONITORING_INTERCEPTOR_TOPIC_REPLICATION: 1
CONTROL_CENTER_METRICS_TOPIC_PARTITIONS: 1
CONTROL_CENTER_METRICS_TOPIC_REPLICATION: 1
CONTROL_CENTER_COMMAND_TOPIC_REPLICATION: 1
CONFLUENT_METRICS_TOPIC_REPLICATION: 1
CONTROL_CENTER_STREAMS_NUM_STREAM_THREADS: 2
CONTROL_CENTER_STREAMS_CACHE_MAX_BYTES_BUFFERING: 104857600
CONTROL_CENTER_DEPRECATED_VIEWS_ENABLE: "true"
CONTROL_CENTER_LOG4J_ROOT_LOGLEVEL: WARN
CONTROL_CENTER_REST_LISTENERS: "http://0.0.0.0:9021"
PORT: 9021
mongo:
image: mongo:4.2.5
hostname: mongo
container_name: mongo
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: mongo-user
MONGO_INITDB_ROOT_PASSWORD: mongo-pw
MONGO_REPLICA_SET_NAME: my-replica-set
command: --replSet my-replica-set --bind_ip_all
mongo:
image: mongo:4.2.5
hostname: mongo
container_name: mongo
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: mongo-user
MONGO_INITDB_ROOT_PASSWORD: mongo-pw
MONGO_REPLICA_SET_NAME: my-replica-set
command: --replSet my-replica-set --bind_ip_all
postgres:
image: debezium/postgres:12
hostname: postgres
container_name: postgres
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres-user
POSTGRES_PASSWORD: postgres-pw
POSTGRES_DB: customers
volumes:
- ./postgres/custom-config.conf:/etc/postgresql/postgresql.conf
command: postgres -c config_file=/etc/postgresql/postgresql.conf
oracle:
image: store/oracle/database-enterprise:12.2.0.1
hostname: oracle
volumes:
- ./scripts:/scripts
container_name: oracle
ports:
- 1521:1521
elastic:
image: elasticsearch:7.6.2
hostname: elastic
container_name: elastic
ports:
- "9200:9200"
- "9300:9300"
environment:
discovery.type: single-node