-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
220 lines (203 loc) · 5.93 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
version: '3.6'
volumes:
zookeeper-data:
driver: local
zookeeper-log:
driver: local
kafka-data:
driver: local
services:
# ------------------------------------------------------------ #
# akhq: Kafka GUI for Apache Kafka to manage topics,
# topics data, consumers group, schema registry, connect ..
# ----------------- -------------------------------------------#
akhq:
image: tchiotludo/akhq
restart: unless-stopped
container_name: akhq
environment:
AKHQ_CONFIGURATION: |
akhq:
connections:
docker-kafka-server:
properties:
bootstrap.servers: "kafka:9092"
connect:
- name: "connect"
url: "http://localhost:8083"
ports:
- 8080:8080
links:
- kafka
networks:
- MONGO
# -----------------------------#
# Zookeeper, Apache Kafka #
# ---------------------------- #
zookeeper:
image: confluentinc/cp-zookeeper:${CONFLUENT_VERSION:-latest}
restart: unless-stopped
container_name: zookeeper
volumes:
- zookeeper-data:/var/lib/zookeeper/data:Z
- zookeeper-log:/var/lib/zookeeper/log:Z
environment:
ZOOKEEPER_CLIENT_PORT: '2181'
ZOOKEEPER_ADMIN_ENABLE_SERVER: 'false'
networks:
- MONGO
kafka:
image: confluentinc/cp-kafka:${CONFLUENT_VERSION:-latest}
restart: unless-stopped
container_name: kafka
volumes:
- kafka-data:/var/lib/kafka/data:Z
environment:
KAFKA_BROKER_ID: '0'
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_NUM_PARTITIONS: '12'
KAFKA_COMPRESSION_TYPE: 'gzip'
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: '1'
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: '1'
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: '1'
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:9092'
KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE: 'false'
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
KAFKA_AUTHORIZER_CLASS_NAME: 'kafka.security.authorizer.AclAuthorizer'
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: 'true'
links:
- zookeeper
networks:
- MONGO
# -----------------------------#
# Kafka Connect #
# ---------------------------- #
connect:
image: confluentinc/cp-kafka-connect:${CONFLUENT_VERSION:-latest}
container_name: connect1
restart: unless-stopped
ports:
- 8083:8083
environment:
CONNECT_BOOTSTRAP_SERVERS: 'kafka:9092'
CONNECT_REST_PORT: 8083
CONNECT_REST_ADVERTISED_HOST_NAME: 'localhost'
CONNECT_CONFIG_STORAGE_TOPIC: '__connect-config'
CONNECT_OFFSET_STORAGE_TOPIC: '__connect-offsets'
CONNECT_STATUS_STORAGE_TOPIC: '__connect-status'
CONNECT_GROUP_ID: 'kafka-connect'
CONNECT_KEY_CONVERTER_SCHEMAS_ENABLE: 'true'
CONNECT_KEY_CONVERTER: 'io.confluent.connect.avro.AvroConverter'
CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL: 'http://schema-registry:8085'
CONNECT_VALUE_CONVERTER_SCHEMAS_ENABLE: 'true'
CONNECT_VALUE_CONVERTER: 'io.confluent.connect.avro.AvroConverter'
CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: 'http://schema-registry:8085'
CONNECT_INTERNAL_KEY_CONVERTER: 'org.apache.kafka.connect.json.JsonConverter'
CONNECT_INTERNAL_VALUE_CONVERTER: 'org.apache.kafka.connect.json.JsonConverter'
CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: '1'
CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: '1'
CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: '1'
CONNECT_PLUGIN_PATH: /usr/share/java/,/etc/kafka-connect/jars
volumes:
- ./kafka-jars:/etc/kafka-connect/jars
networks:
- MONGO
# -------------------------------------------------#
# Create 3 mongo servers that will act as replicas #
# -------------------------------------------------#
mongo1:
hostname: mongo1
container_name: mongo1
image: mongo
expose:
- 27017
ports:
- 30001:27017
restart: always
command: mongod --replSet my-mongo-set
networks:
- MONGO
mongo2:
hostname: mongo2
container_name: mongo2
image: mongo
expose:
- 27017
ports:
- 30002:27017
restart: always
command: mongod --replSet my-mongo-set
networks:
- MONGO
mongo3:
hostname: mongo3
container_name: mongo3
image: mongo
expose:
- 27017
ports:
- 30003:27017
restart: always
command: mongod --replSet my-mongo-set
networks:
- MONGO
# -------------------------------------------------------------#
# Define the initialization server
# that runs the `rs.initiate` command to intialize
# the replica set and connect the three servers to each other
# -------------------------------------------------------------#
mongoinit:
image: mongo
# this container will exit after executing the command
restart: "no"
depends_on:
- mongo1
- mongo2
- mongo3
networks:
- MONGO
command: >
mongosh --host localhost:30001 --eval
'
db = (new Mongo("localhost:30001")).getDB("test");
config = {
"_id" : "my-mongo-set",
"members" : [
{
"_id" : 0,
"host" : "mongo1:27017"
},
{
"_id" : 1,
"host" : "mongo2:27017"
},
{
"_id" : 2,
"host" : "mongo3:27017"
}
]
};
rs.initiate(config);
'
# -----------------------------#
# Mongo Express #
# ---------------------------- #
mongo-express:
image: mongo-express:latest
container_name: mongo-express
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: admin
ME_CONFIG_MONGODB_ADMINPASSWORD: password
ME_CONFIG_MONGODB_SERVER: localhost
ME_CONFIG_MONGODB_PORT: "30001,30002,30003"
ports:
- "0.0.0.0:8081:8081"
networks:
- MONGO
depends_on:
- mongo1
- mongo2
- mongo3
networks:
MONGO:
driver: bridge