forked from BrynjulvBrynjulvsen/kafka-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
125 lines (112 loc) · 3.61 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
version: '3.5'
networks:
kafkaworkshop:
name: kafkaworkshop
services:
kafka1:
image: confluentinc/cp-kafka:7.5.2
hostname: kafka1
container_name: kafka1
environment:
KAFKA_LISTENERS: BROKER://kafka1:9092,EXTERNAL://kafka1:9094,CONTROLLER://kafka1:9093
KAFKA_ADVERTISED_LISTENERS: BROKER://kafka1:9092,EXTERNAL://localhost:9094
KAFKA_INTER_BROKER_LISTENER_NAME: BROKER
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,BROKER:PLAINTEXT,EXTERNAL:PLAINTEXT
KAFKA_PROCESS_ROLES: 'controller,broker'
KAFKA_NODE_ID: 1
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka1:9093'
KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'
KAFKA_SCHEMA_REGISTRY_URL: "schemaregistry:8085"
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
CLUSTER_ID: KUQll_wsRdWF7yPPb85xNA
ports:
- "9094:9094"
networks:
- kafkaworkshop
volumes:
- kafka1-data:/var/lib/kafka/data
schemaregistry:
image: confluentinc/cp-schema-registry:7.5.2
hostname: schemaregistry
container_name: schemaregistry
restart: always
depends_on:
- kafka1
networks:
- kafkaworkshop
ports:
- "8085:8085"
environment:
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: kafka1:9092
SCHEMA_REGISTRY_KAFKASTORE_SECURITY_PROTOCOL: PLAINTEXT
SCHEMA_REGISTRY_HOST_NAME: schemaregistry
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8085
kafkaconnect:
image: confluentinc/cp-kafka-connect:7.4.3
restart: always
hostname: kafkaconnect
container_name: kafkaconnect
ports:
- "8083:8083"
volumes:
- kc-data:/data
environment:
CONNECT_BOOTSTRAP_SERVERS: kafka1:9092
CONNECT_GROUP_ID: "kafka-connect"
CONNECT_CONFIG_STORAGE_TOPIC: "_kafka-connect-configs"
CONNECT_OFFSET_STORAGE_TOPIC: "_kafka-connect-offsets"
CONNECT_STATUS_STORAGE_TOPIC: "_kafka-connect-status"
CONNECT_REPLICATION_FACTOR: 1
CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: 1
CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: 1
CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1
CONNECT_KEY_CONVERTER: "org.apache.kafka.connect.storage.StringConverter"
CONNECT_VALUE_CONVERTER: "io.confluent.connect.avro.AvroConverter"
CONNECT_VALUE_CONVERTER_SCHEMAS_ENABLE: "true"
CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: "http://schemaregistry:8085"
CONNECT_REST_ADVERTISED_HOST_NAME: "kafkaconnect"
CONNECT_LISTENERS: http://kafkaconnect:8083
CONNECT_PLUGIN_PATH: "/usr/share/java,/usr/share/confluent-hub-components"
# Connect worker
CONNECT_SECURITY_PROTOCOL: PLAINTEXT
# Connect producer
CONNECT_PRODUCER_SECURITY_PROTOCOL: PLAINTEXT
# Connect consumer
CONNECT_CONSUMER_SECURITY_PROTOCOL: PLAINTEXT
depends_on:
- kafka1
- schemaregistry
- postgres
networks:
- kafkaworkshop
command:
- bash
- -c
- |
echo "Installing Connector"
confluent-hub install --no-prompt confluentinc/kafka-connect-jdbc:10.7.0
#
echo "Launching Kafka Connect worker"
/etc/confluent/docker/run &
#
sleep infinity
postgres:
image: postgres:latest
container_name: postgres
hostname: postgres
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=password
- POSTGRES_USER=user
- POSTGRES_DB=workshop
networks:
- kafkaworkshop
volumes:
kafka1-data:
kc-data:
postgres-data: