forked from UKHomeOffice/callisto-localdev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
353 lines (323 loc) · 10.7 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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
version: "3.9"
x-healthcheck-settings: &healthcheck-settings
interval: 10s
retries: 10
start_period: 15s
timeout: 5s
x-db-env-conf: &db-env
DATABASE_NAME: ${DATABASE_NAME}
DATABASE_USERNAME: ${PSQL_USER}
DATABASE_PASSWORD: ${PSQL_PASSWORD}
DATABASE_ENDPOINT: postgres
DATABASE_PORT: 5432
x-db-schema-creation: &db-schema-creation
image: quay.io/ukhomeofficedigital/postgres:latest
volumes:
- ./sql:/sql
environment:
<<: *db-env
entrypoint: ["/sql/create-db-schema.sh"]
depends_on:
postgres:
condition: service_healthy
networks:
- callisto
x-liquibase-settings: &liquibase-setting
pull_policy: ${PULL_POLICY}
volumes:
- ./liquibase/liquibase-setup.sh:/liquibase-setup.sh
entrypoint: /liquibase-setup.sh
networks:
- callisto
depends_on:
postgres:
condition: service_healthy
x-certificate-creation: &certificate-creation
pull_policy: ${PULL_POLICY}
image: eclipse-temurin:17-jre-focal
volumes:
- ./kafka:/kafka
- keystore:/keystore
working_dir: /kafka
entrypoint: ["/kafka/create_keystore.sh"]
services:
postgres:
image: postgres:13.1
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=${PSQL_PASSWORD}
- POSTGRES_USER=${PSQL_USER}
- POSTGRES_DB=${DATABASE_NAME}
networks:
- callisto
healthcheck:
test: ["CMD", "psql", "-U", "${PSQL_USER}", "-d", "${DATABASE_NAME}"]
interval: 500ms
timeout: 1s
retries: 5
kafka-setup:
<<: *certificate-creation
command: ["kafka"]
kafka:
image: confluentinc/cp-kafka:7.3.1
ports:
- "9093"
volumes:
- keystore:/etc/kafka/secrets/keystore
- ./kafka/update_run.sh:/tmp/update_run.sh
- ./kafka/kafka.properties:/tmp/kafka.properties
networks:
- callisto
environment:
KAFKA_ADVERTISED_LISTENERS: SSL://kafka:9093
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: false
KAFKA_AUTHORIZER_CLASS_NAME: org.apache.kafka.metadata.authorizer.StandardAuthorizer
KAFKA_AUTO_CREATE_TOPICS_ENABLE: false
KAFKA_BROKER_ID: 1
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9092
KAFKA_INTER_BROKER_LISTENER_NAME: SSL
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:SSL,SSL:SSL
KAFKA_LISTENERS: CONTROLLER://kafka:9092,SSL://kafka:9093
KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_SSL_CLIENT_AUTH: required
KAFKA_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM: " "
KAFKA_SSL_KEY_CREDENTIALS: keystore/kafka/kafka_creds
KAFKA_SSL_KEYSTORE_CREDENTIALS: keystore/kafka/kafka_creds
KAFKA_SSL_KEYSTORE_FILENAME: keystore/kafka/kafka.keystore.jks
KAFKA_SSL_PRINCIPAL_MAPPING_RULES: RULE:^C=GB,O=UK Home Office,CN=Callisto (.+)$$/$$1/,DEFAULT
KAFKA_SSL_TRUSTSTORE_CREDENTIALS: keystore/kafka/kafka_creds
KAFKA_SSL_TRUSTSTORE_FILENAME: keystore/kafka/kafka.truststore.jks
KAFKA_SUPER_USERS: "User:kafka"
command: "bash -c '(/tmp/update_run.sh && /etc/confluent/docker/run) || sleep infinity'"
healthcheck:
<<: *healthcheck-settings
test: kafka-topics --bootstrap-server kafka:9093 --list --command-config /tmp/kafka.properties || exit 1
depends_on:
kafka-setup:
condition: service_completed_successfully
kafka-topics-acls:
image: confluentinc/cp-kafka:7.3.1
volumes:
- keystore:/etc/kafka/secrets/keystore
- ./kafka/kafka.properties:/tmp/kafka.properties
- ./kafka/setup_scripts:/setup_scripts
entrypoint:
[
"/setup_scripts/setup-topics-acls.sh",
"/tmp/kafka.properties",
]
depends_on:
kafka:
condition: service_healthy
networks:
- callisto
kafka-producer-setup:
<<: *certificate-creation
command: ["kafka-producer"]
kafka-consumer-setup:
<<: *certificate-creation
command: ["kafka-consumer"]
kafka-tester:
image: confluentinc/cp-kafka:7.3.1
volumes:
- keystore:/etc/kafka/secrets/keystore
- ./kafka/kafka-producer.properties:/tmp/kafka-producer.properties
- ./kafka/kafka-consumer.properties:/tmp/kafka-consumer.properties
entrypoint: ["sleep", "1h"]
depends_on:
kafka:
condition: service_healthy
kafka-producer-setup:
condition: service_completed_successfully
kafka-consumer-setup:
condition: service_completed_successfully
kafka-topics-acls:
condition: service_completed_successfully
networks:
- callisto
ingress:
image: nginx:1.19.2-alpine
ports:
- 80:80
- 443:443
volumes:
- ./ingress/default.conf:/etc/nginx/conf.d/default.conf
- ./ingress/nginx-selfsigned.crt:/etc/ssl/certs/nginx-selfsigned.crt:ro
- ./ingress/nginx-selfsigned.key:/etc/ssl/private/nginx-selfsigned.key:ro
networks:
- callisto
healthcheck:
<<: *healthcheck-settings
test: "nc -z ingress 443 || exit -1"
keycloak:
image: "quay.io/ukhomeofficedigital/callisto-auth-keycloak:$KEYCLOAK_TAG"
pull_policy: ${PULL_POLICY}
environment:
- DB_VENDOR=h2
- PROXY_ADDRESS_FORWARDING=true
healthcheck:
<<: *healthcheck-settings
test: ["CMD", "curl", "-f", "http://keycloak:9090/auth"]
command:
- "-Djboss.http.port=9090"
ports:
- "50000:9090"
networks:
- callisto
web:
image: "quay.io/ukhomeofficedigital/callisto-ui:$WEB_TAG"
pull_policy: ${PULL_POLICY}
ports:
- "50001:9090"
networks:
- callisto
depends_on:
keycloak:
condition: service_healthy
healthcheck:
<<: *healthcheck-settings
test: ["CMD", "curl", "-f", "http://web:9090/index.html"]
timecard-schema-creation:
<<: *db-schema-creation
command: ["timecard"]
timecard-database-migrations:
<<: *liquibase-setting
image: "quay.io/ukhomeofficedigital/callisto-timecard-database:$TIMECARD_RESTAPI_TAG"
environment:
<<: *db-env
command: ["timecard"]
depends_on:
timecard-schema-creation:
condition: service_completed_successfully
accruals-schema-creation:
<<: *db-schema-creation
command: ["accruals"]
accruals-database-migrations:
<<: *liquibase-setting
image: "quay.io/ukhomeofficedigital/callisto-accruals-database:$ACCRUALS_RESTAPI_TAG"
environment:
<<: *db-env
command: ["accruals"]
depends_on:
accruals-schema-creation:
condition: service_completed_successfully
person-schema-creation:
<<: *db-schema-creation
command: ["person"]
person-database-migrations:
<<: *liquibase-setting
image: "quay.io/ukhomeofficedigital/callisto-person-database:$PERSON_RESTAPI_TAG"
environment:
<<: *db-env
command: ["person"]
depends_on:
person-schema-creation:
condition: service_completed_successfully
timecard-restapi-kafka-setup:
<<: *certificate-creation
command: ["timecard-restapi"]
person-restapi-kafka-setup:
<<: *certificate-creation
command: ["person-restapi"]
balance-calculator-kafka-setup:
<<: *certificate-creation
command: ["balance-calculator"]
callisto-timecard-restapi:
image: "quay.io/ukhomeofficedigital/callisto-timecard-restapi:$TIMECARD_RESTAPI_TAG"
environment:
<<: *db-env
BOOTSTRAP_SERVER: kafka:9093
KEYSTORE_LOCATION: file://keystore/timecard-restapi/timecard-restapi.keystore.jks
TIMECARD_KEYSTORE_PASSWORD: changeit
SPRING_APPLICATION_JSON: '{
"spring.kafka.ssl.trust-store-location": "file://keystore/timecard-restapi/timecard-restapi.truststore.jks",
"spring.kafka.ssl.trust-store-password": "changeit"
}'
ports:
- "50100:9090"
depends_on:
timecard-database-migrations:
condition: service_completed_successfully
timecard-restapi-kafka-setup:
condition: service_completed_successfully
volumes:
- keystore:/keystore
healthcheck:
<<: *healthcheck-settings
test: wget --no-verbose --tries=1 --spider http://callisto-timecard-restapi:9090/swagger-ui/index.html || exit 1
networks:
- callisto
callisto-accruals-restapi:
image: "quay.io/ukhomeofficedigital/callisto-accruals-restapi:$ACCRUALS_RESTAPI_TAG"
environment:
<<: *db-env
command:
- "--server.port=9090" # Having to override server port as application.properties is setting it to a different port
ports:
- "50200:9090"
depends_on:
accruals-database-migrations:
condition: service_completed_successfully
healthcheck:
<<: *healthcheck-settings
test: wget --no-verbose --tries=1 --spider http://callisto-accruals-restapi:9090/swagger-ui/index.html || exit 1
networks:
- callisto
callisto-person-restapi:
image: "quay.io/ukhomeofficedigital/callisto-person-restapi:$PERSON_RESTAPI_TAG"
environment:
<<: *db-env
BOOTSTRAP_SERVER: kafka:9093
KEYSTORE_LOCATION: file://keystore/person-restapi/person-restapi.keystore.jks
KEYSTORE_PASSWORD: changeit
SPRING_APPLICATION_JSON: '{
"spring.kafka.ssl.trust-store-location": "file://keystore/person-restapi/person-restapi.truststore.jks",
"spring.kafka.ssl.trust-store-password": "changeit"
}'
ports:
- "50300:9090"
depends_on:
person-database-migrations:
condition: service_completed_successfully
person-restapi-kafka-setup:
condition: service_completed_successfully
volumes:
- keystore:/keystore
healthcheck:
<<: *healthcheck-settings
test: wget --no-verbose --tries=1 --spider http://callisto-person-restapi:9090/swagger-ui/index.html || exit 1
networks:
- callisto
balance-calculator:
image: "quay.io/ukhomeofficedigital/callisto-balance-calculator:$BALANCE_CALCULATOR_TAG"
environment:
BOOTSTRAP_SERVER: kafka:9093
ACCRUALS_URL: http://callisto-accruals-restapi:9090
KEYSTORE_LOCATION: file://keystore/balance-calculator/balance-calculator.keystore.jks
KEYSTORE_PASSWORD: changeit
SPRING_APPLICATION_JSON: '{
"spring.kafka.ssl.trust-store-location": "file://keystore/balance-calculator/balance-calculator.truststore.jks",
"spring.kafka.ssl.trust-store-password": "changeit"
}'
ports:
- "50500:9090"
depends_on:
balance-calculator-kafka-setup:
condition: service_completed_successfully
volumes:
- keystore:/keystore
healthcheck:
<<: *healthcheck-settings
test: wget --no-verbose --tries=1 --spider http://balance-calculator:9090/actuator/health || exit 1
networks:
- callisto
networks:
callisto:
driver: bridge
volumes:
keystore:
driver: local