-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
252 lines (241 loc) · 7.34 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
version: "3.4"
name: "database-replication"
services:
source_db:
image: postgres:14-alpine
container_name: "source_db"
ports:
- "5432:5432"
volumes:
- .docker/data/postgres:/var/lib/postgresql/pgdata
- .docker/backups/postgres:/backups
- .docker/postgres-add-de-user.sh:/docker-entrypoint-initdb.d/postgres-add-de-user.sh
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- PGDATA=/var/lib/postgresql/pgdata
restart: unless-stopped
networks:
- upstream_networks
- kafka_networks
healthcheck:
test: pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}
interval: 30s
timeout: 10s
retries: 5
start_period: 10s
adminer:
image: adminer:standalone
container_name: "adminer"
ports:
- "8080:8080"
depends_on:
- source_db
networks:
- upstream_networks
restart: unless-stopped
upstream-app:
build:
context: .
dockerfile: .docker/images/app/Dockerfile
container_name: "upstream-app"
ports:
- "8501:8501"
volumes:
- ./app:/app
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=source_db
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_DB=${POSTGRES_DB}
restart: on-failure
depends_on:
- source_db
networks:
- upstream_networks
healthcheck:
test: curl --fail http://localhost:8501/healthz || exit 1
interval: 30s
timeout: 30s
retries: 5
start_period: 10s
zookeeper:
image: bitnami/zookeeper:3.8
container_name: zookeeper
volumes:
- .docker/data/zookeeper:/bitnami/zookeeper
environment:
- ZOO_SERVER_ID=0
- ALLOW_ANONYMOUS_LOGIN=yes
# How far out of date a server can be from a leader
- ZOO_SYNC_LIMIT=7
- ZOO_LOG_LEVEL=INFO
restart: unless-stopped
networks:
- kafka_networks
kafka-0:
image: bitnami/kafka:3.5
container_name: kafka-server
ports:
- "9092:9092"
volumes:
- .docker/data/kafka-0:/bitnami/kafka
- .docker/log/kafka-0:/tmp/kafka_mounts/logs
environment:
- KAFKA_BROKER_ID=0
- ALLOW_PLAINTEXT_LISTENER=true
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka-0:9092
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
- KAFKA_CFG_LOG_DIRS=/tmp/kafka_mounts/logs
restart: unless-stopped
depends_on:
- zookeeper
networks:
- kafka_networks
healthcheck:
test: kafka-topics.sh --list --bootstrap-server kafka-server:9092 || exit -1
interval: 5s
timeout: 5s
retries: 5
start_period: 30s
kafka-1:
image: bitnami/kafka:3.5
container_name: kafka-1
ports:
- ":9092"
volumes:
- .docker/data/kafka-1:/bitnami/kafka
- .docker/log/kafka-1:/tmp/kafka_mounts/logs
environment:
- KAFKA_BROKER_ID=1
- ALLOW_PLAINTEXT_LISTENER=true
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka-1:9092
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
- KAFKA_CFG_LOG_DIRS=/tmp/kafka_mounts/logs
restart: unless-stopped
depends_on:
- zookeeper
networks:
- kafka_networks
healthcheck:
test: kafka-topics.sh --list --bootstrap-server kafka-1:9092 || exit -1
interval: 5s
timeout: 5s
retries: 5
start_period: 30s
kafka-2:
image: bitnami/kafka:3.5
container_name: kafka-2
ports:
- ":9092"
volumes:
- .docker/data/kafka-2:/bitnami/kafka
- .docker/log/kafka-2:/tmp/kafka_mounts/logs
environment:
- KAFKA_BROKER_ID=2
- ALLOW_PLAINTEXT_LISTENER=true
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka-2:9092
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
- KAFKA_CFG_LOG_DIRS=/tmp/kafka_mounts/logs
restart: unless-stopped
depends_on:
- zookeeper
networks:
- kafka_networks
healthcheck:
test: kafka-topics.sh --list --bootstrap-server kafka-2:9092 || exit -1
interval: 5s
timeout: 5s
retries: 5
start_period: 30s
kafka-connect:
build:
context: .
dockerfile: .docker/images/kafka-connect/Dockerfile
container_name: kafka-connect
ports:
- "8083:8083"
volumes:
- .docker/data/kafka-connect:/data
environment:
- CONNECT_BOOTSTRAP_SERVERS=${CONNECT_BOOTSTRAP_SERVERS}
- CONNECT_GROUP_ID=kafka-connectx
- CONNECT_REPLICATION_FACTOR=3
- CONNECT_CONFIG_STORAGE_TOPIC=_kafka-connectx-config
- CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR=3
- CONNECT_OFFSET_STORAGE_TOPIC=_kafka-connectx-offsets
- CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR=3
- CONNECT_STATUS_STORAGE_TOPIC=_kafka-connectx-status
- CONNECT_STATUS_STORAGE_REPLICATION_FACTOR=3
# Converters
- CONNECT_KEY_CONVERTER=org.apache.kafka.connect.json.JsonConverter
- CONNECT_VALUE_CONVERTER=org.apache.kafka.connect.json.JsonConverter
- CONNECT_INTERNAL_KEY_CONVERTER=org.apache.kafka.connect.json.JsonConverter
- CONNECT_INTERNAL_VALUE_CONVERTER=org.apache.kafka.connect.json.JsonConverter
# Misc
- CONNECT_REST_ADVERTISED_HOST_NAME=${CONNECT_REST_ADVERTISED_HOST_NAME}
- CONNECT_REST_PORT=8083
- CONNECT_LISTENERS=http://kafka-connect:8083
- CONNECT_PLUGIN_PATH=/usr/share/java,/usr/share/confluent-hub-components
restart: unless-stopped
depends_on:
- zookeeper
- kafka-0
networks:
- kafka_networks
kafka-ui:
image: provectuslabs/kafka-ui:latest
container_name: kafka-manager-ui
ports:
- "8000:8080"
environment:
- KAFKA_CLUSTERS_0_NAME=${KAFKA_CLUSTERS_0_NAME}
- KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=${KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS}
- KAFKA_CLUSTERS_0_ZOOKEEPER=${KAFKA_CLUSTERS_0_ZOOKEEPER}
- KAFKA_CLUSTERS_0_PROPERTIES_SECURITY_PROTOCOL=${KAFKA_CLUSTERS_0_PROPERTIES_SECURITY_PROTOCOL}
- KAFKA_CLUSTERS_0_PROPERTIES_SASL_MECHANISM=${KAFKA_CLUSTERS_0_PROPERTIES_SASL_MECHANISM}
- KAFKA_CLUSTERS_0_PROPERTIES_SASL_JAAS_CONFIG=${KAFKA_CLUSTERS_0_PROPERTIES_SASL_JAAS_CONFIG}
- KAFKA_CLUSTERS_0_KAFKACONNECT_0_NAME=kafka-connect
- KAFKA_CLUSTERS_0_KAFKACONNECT_0_ADDRESS=http://kafka-connect:8083
depends_on:
- zookeeper
- kafka-0
networks:
- kafka_networks
sink_db:
image: mcr.microsoft.com/mssql/server:2022-CU8-ubuntu-20.04
container_name: sink_db
user: root
ports:
- "1433:1433"
environment:
- ACCEPT_EULA=Y
- MSSQL_PID=Developer
- MSSQL_USER=SA
- MSSQL_SA_PASSWORD=${MSSQL_SA_PASSWORD}
volumes:
- .docker/data/mssql:/var/opt/mssql/data
- .docker/log/mssql:/var/opt/mssql/log
- .docker/backups/mssql:/var/opt/mssql/backup
restart: on-failure
networks:
- downstream_networks
- kafka_networks
healthcheck:
test: /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "$$MSSQL_SA_PASSWORD" -Q "SELECT 1;" || exit
interval: 30s
timeout: 10s
retries: 5
start_period: 10s
networks:
upstream_networks:
driver: bridge
kafka_networks:
driver: bridge
downstream_networks:
driver: bridge