-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
154 lines (137 loc) · 3.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
services:
frontend-service:
build: ./frontend-service
ports:
- 3000:3000
depends_on:
- question-service
- user-service
volumes:
- ./frontend-service:/app
- /app/node_modules
question-service:
build: ./question-service
ports:
- 8080:8080
depends_on:
- question-db
volumes:
- ./question-service:/app
- /app/node_modules
user-service:
build: ./user-service
ports:
- 3001:3001
depends_on:
- user-db
volumes:
- ./user-service:/app
- /app/node_modules
collaboration-service:
build: ./collaboration-service
ports:
- 5001:5001
volumes:
- ./collaboration-service:/app
- /app/node_modules
history-service:
build: ./history-service
ports:
- 5002:5002
depends_on:
- collaboration-service
volumes:
- ./history-service:/app
- /app/node_modules
user-db:
image: mongo:latest
container_name: user-db
volumes:
- ./db-init/init-user-db.js:/docker-entrypoint-initdb.d/init-user-db.js
- user-db-data:/data/db
ports:
- 27017:27017
question-db:
image: mongo:latest
container_name: question-db
volumes:
- ./db-init/init-question-db.js:/docker-entrypoint-initdb.d/init-question-db.js
- question-db-data:/data/db
ports:
- 27018:27017
request-service:
build: ./matching-service/request-service
ports:
- 3002:3002
depends_on:
- user-service
# - question-service # maybe to retrieve information on the questions difficulties/topics
volumes:
- ./matching-service/request-service:/app
- /app/node_modules
matcher-service:
build: ./matching-service/matcher-service
ports:
- 3003:3003
depends_on:
- user-service
# - question-service # maybe to retrieve information on the questions difficulties/topics
volumes:
- ./matching-service/matcher-service:/app
- /app/node_modules
dequeue-service:
build: ./matching-service/dequeue-service
ports:
- 3004:3004
# depends_on:
# - user-service
# - question-service # maybe to retrieve information on the questions difficulties/topics
volumes:
- ./matching-service/dequeue-service:/app
- /app/node_modules
room-service:
build: ./matching-service/room-service
ports:
- 3005:3005
depends_on:
- user-service
- collaboration-service # add after dockerising collaboration-service
volumes:
- ./matching-service/room-service:/app
- /app/node_modules
kafka:
image: bitnami/kafka
ports:
- 9092:9092
environment:
- KAFKA_ENABLE_KRAFT=yes
- KAFKA_CFG_PROCESS_ROLES=broker,controller
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://kafka:9094
- KAFKA_BROKER_ID=1
- [email protected]:9093
- ALLOW_PLAINTEXT_LISTENER=yes
- KAFKA_CFG_NODE_ID=1
- KAFKA_AUTO_CREATE_TOPICS_ENABLE=true
kafka-setup:
image: node:22-alpine
volumes:
- ./db-init:/scripts
# TODO: Prevent syncing of node stuff.
working_dir: /scripts
command: sh -c "npm install kafkajs && node init-kafka.js"
depends_on:
- kafka
volumes:
user-db-data:
name: user-db-data
question-db-data:
name: question-db-data
# Notes:
#
# Docker Compose will automatically create an internal network where services can resolve each other using their service names.
#
# For example, inside your frontend-service code, you can make requests to the question-service like this:
# - const questionServiceURL = "http://question-service:3001/api/questions"; # Hostname is the service name