-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
107 lines (99 loc) · 2.87 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
# SPDX-FileCopyrightText: NOI Techpark <digital@noi.bz.it>
#
# SPDX-License-Identifier: CC0-1.0
services:
rabbitmq:
image: rabbitmq:management-alpine
ports:
- "5671:5671"
- "5672:5672"
- "4369:4369"
- "25672:25672"
- "15672:15672"
volumes:
- ./rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf
healthcheck:
test: nc -z localhost:5672
attach: false
mongodb:
image: mongo
ports:
- 27017:27017
command: --replSet rs0 --bind_ip localhost,mongodb,127.0.0.1 --port 27017
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
attach: false
# Initializes replicaset once after it has been started
mongodb-init:
image: mongo
depends_on:
mongodb:
condition: service_healthy
restart: "no"
entrypoint: |
mongosh "mongodb://mongodb" --eval "
try{
rs.initiate({
_id : 'rs0',
members: [
{ _id : 0, host : 'mongodb:27017' },
]
})
} catch(error) {
// Already initialized. that's fine
if (error.code != 23) {
throw(error)
}
}"
# Writer service listens on ingress queue and writes raw data to mongodb
writer:
image: ghcr.io/noi-techpark/infrastructure-v2/raw-writer:latest
environment:
APP_MQ_URI: amqp://guest:guest@rabbitmq:5672
APP_MQ_EXCHANGE: ingress
APP_MQ_QUEUE: ingress
APP_MONGO_URI: mongodb://mongodb/?replicaSet=rs0&directConnection=true
APP_LOGLEVEL: INFO
depends_on:
mongodb-init:
condition: service_completed_successfully
rabbitmq:
condition: service_healthy
# Notifier service listens on mongodb oplog and generates an event when data is inserted
notifier:
image: ghcr.io/noi-techpark/infrastructure-v2/notifier:latest
depends_on:
mongodb:
condition: service_healthy
rabbitmq:
condition: service_healthy
mongodb-init:
condition: service_completed_successfully
environment:
MONGODB_CONNECTION_STRING: mongodb://mongodb:27017?directConnection=true
MONGODB_CONNECTION_REPLICA_SET: rs0
RABBITMQ_CLUSTER_URL: amqp://guest:guest@rabbitmq:5672/
# Router service listens on ready exchange (where notifier writes) and distributes messages according to routing key
router:
build:
context: infrastructure/router
dockerfile: Dockerfile
target: dev
environment:
RABBITMQ_CLUSTER_URL: rabbitmq:5672
RABBITMQ_USER: guest
RABBITMQ_PASSWORD: guest
RABBITMQ_CLIENTNAME: writer
volumes:
- ./infrastructure/router:/code
- mvn-cache:/code/.mvn
depends_on:
- notifier
working_dir: /code
command: ["mvn -B quarkus:dev"]
volumes:
mvn-cache:
networks:
default:
name: ingestion
attachable: true