forked from Axual/ksml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
118 lines (111 loc) · 5.95 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
---
networks:
ksml:
name: ksml_example
driver: bridge
services:
broker:
image: bitnami/kafka:3.8.0
hostname: broker
ports:
- "9092:9092"
networks:
- ksml
restart: always
environment:
KAFKA_CFG_PROCESS_ROLES: 'controller,broker'
KAFKA_CFG_BROKER_ID: 0
KAFKA_CFG_NODE_ID: 0
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: '0@broker:9090'
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
KAFKA_CFG_ADVERTISED_LISTENERS: 'INNER://broker:9093,OUTER://localhost:9092'
KAFKA_CFG_LISTENERS: 'INNER://broker:9093,OUTER://broker:9092,CONTROLLER://broker:9090'
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: 'INNER:PLAINTEXT,OUTER:PLAINTEXT,CONTROLLER:PLAINTEXT'
KAFKA_CFG_LOG_CLEANUP_POLICY: delete
KAFKA_CFG_LOG_RETENTION_MINUTES: 10
KAFKA_CFG_INTER_BROKER_LISTENER_NAME: INNER
KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_CFG_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'true'
KAFKA_CFG_MIN_INSYNC_REPLICAS: 1
KAFKA_CFG_NUM_PARTITIONS: 1
healthcheck:
# If the kafka topics can list data, the broker is healthy
test: kafka-topics.sh --bootstrap-server broker:9093 --list
interval: 5s
timeout: 10s
retries: 10
start_period: 5s
schema_registry:
image: apicurio/apicurio-registry:3.0.2
hostname: schema_registry
depends_on:
broker:
condition: service_healthy
ports:
- "8081:8081"
networks:
- ksml
restart: always
environment:
QUARKUS_HTTP_PORT: 8081
QUARKUS_HTTP_CORS_ORIGINS: '*'
QUARKUS_PROFILE: "prod"
APICURIO_STORAGE_KIND: kafkasql
APICURIO_KAFKASQL_BOOTSTRAP_SERVERS: 'broker:9093'
APICURIO_KAFKASQL_TOPIC: '_apciurio-kafkasql-store'
healthcheck:
# If the api endpoint is available, the service is considered healthy
test: curl http://localhost:8081/apis
interval: 15s
timeout: 10s
retries: 10
start_period: 10s
# This "container" is a workaround to pre-create topics
kafka-setup:
image: bitnami/kafka:3.8.0
hostname: kafka-setup
networks:
- ksml
depends_on:
broker:
condition: service_healthy
restart: on-failure
command: "bash -c 'echo Trying to create topics... && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_avro && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_avro_binary && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_csv && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_json && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_xml && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_transformed && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_manipulated && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensoralert_settings --config cleanup.policy=compact&& \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensoralert && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic io.ksml.example.processor-ksml_sensordata_grouped-repartition && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_count && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_filtered && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_blue && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_red && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_sensor0 && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_sensor1 && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_sensor2 && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic ksml_sensordata_table && \
kafka-topics.sh --create --if-not-exists --bootstrap-server broker:9093 --partitions 1 --replication-factor 1 --topic io.ksml.example.processor-ownerCount-changelog'"
example-producer:
image: axual/ksml:latest
hostname: kafka-data-generator
restart: on-failure
networks:
- ksml
working_dir: /ksml
command:
- /ksml/ksml-data-generator.yaml
volumes:
- ./examples:/ksml
depends_on:
broker:
condition: service_healthy
schema_registry:
condition: service_healthy
kafka-setup:
condition: service_completed_successfully