generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose.yaml
executable file
·244 lines (231 loc) · 6.54 KB
/
docker-compose.yaml
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
version: "3"
services:
frontend:
depends_on:
api-gateway:
condition: service_started
matching-producer:
condition: service_started
matching-consumer:
condition: service_started
collaboration-service:
condition: service_started
user-service:
condition: service_started
question-service:
condition: service_started
environment:
- NEXT_PUBLIC_BACKEND_URL=http://localhost:1234
- NEXT_PUBLIC_GITHUB_OAUTH_CLIENT_ID=${GITHUB_CLIENT_ID}
- NEXT_PUBLIC_GITHUB_OAUTH_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
- NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000
- NEXT_PUBLIC_COLLAB_SERVICE_URL=ws://localhost:5005
- NEXTAUTH_SECRET=nextauth_secret
- NEXTAUTH_URL=http://localhost:3000
- NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=dgxltgjxl
- NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET=usohal3c
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: frontend
volumes:
- ./frontend:/usr/src/app
- /usr/src/app/node_modules
- /usr/src/app/.next
ports:
- "3000:3000" # Maps container port 3000 to local 3000
api-gateway:
container_name: api-gateway
build:
context: ./backend/api-gateway
dockerfile: Dockerfile.dev
environment:
- PGUSER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=apigateway
- POSTGRES_HOST=db-agw
- ACCESS_TOKEN_SECRET_KEY=super_secret_key
- REFRESH_TOKEN_SECRET_KEY=super_secret_key
- USER_SERVICE_URL=http://user-service:8080
- QUESTION_SERVICE_URL=http://question-service:8080
- COLLAB_SERVICE_URL=http://collaboration-service:8080
- MATCHING_SERVICE_URL=http://matching-producer:8080
- AGW_URL=http://localhost:1234
- FRONTEND_URL=http://localhost:3000
- GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
- GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
- SUPER_ADMIN_KEY=i_want_to_be_superadmin
ports:
- "1234:1234" # Maps container port 1234 to local 1234
volumes:
- ./backend/api-gateway:/usr/src/app
networks:
- peerpreps-backend
depends_on:
db-agw:
condition: service_healthy
collaboration-service:
container_name: collaboration-service
build:
context: ./backend/collaboration-service
dockerfile: Dockerfile.dev
ports:
- "5005:8080" # Maps container port 8080 to local 5005
environment:
QUESTION_SERVICE_URL: http://question-service:8080
USER_SERVICE_URL: http://user-service:8080
volumes:
- ./backend/collaboration-service:/usr/src/app
networks:
- peerpreps-backend
user-service:
container_name: user-service
build:
context: ./backend/user-service
dockerfile: Dockerfile.dev
environment:
- PGUSER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=users
- AGW_URL=http://localhost:1234
- POSTGRES_HOST=db-us
ports:
- "5006:8080" # Maps container port 8080 to local 5006
volumes:
- ./backend/user-service:/usr/src/app
depends_on:
db-us:
condition: service_healthy
networks:
- peerpreps-backend
matching-producer:
container_name: matching-producer
build:
context: ./backend/matching-service/producer
dockerfile: Dockerfile.dev
ports:
- "5007:8080"
environment:
- AMQP_SERVER_URL=amqp://guest:guest@rabbitmq:5672/
- AGW_URL=http://localhost:1234
networks:
- peerpreps-backend
- rabbitmq-network
volumes:
- ./backend/matching-service/producer:/usr/src/app
depends_on:
rabbitmq:
condition: service_healthy
restart: on-failure
matching-consumer:
container_name: matching-consumer
build:
context: ./backend/matching-service/consumer
dockerfile: Dockerfile.dev
ports:
- "5008:8080"
environment:
- AMQP_SERVER_URL=amqp://guest:guest@rabbitmq:5672/
- COLLAB_URL=http://collaboration-service:8080
- RMQ_QUEUE_URL=http://rabbitmq:15672/api/queues/%2f/
networks:
- peerpreps-backend
- rabbitmq-network
volumes:
- ./backend/matching-service/consumer:/usr/src/app
depends_on:
matching-producer:
condition: service_started
rabbitmq:
condition: service_healthy
restart: on-failure
rabbitmq:
image: "rabbitmq:3-management-alpine"
container_name: rabbitmq
networks:
- peerpreps-backend
- rabbitmq-network
ports:
- "5672:5672"
- "15672:15672"
healthcheck:
test: ["CMD", "nc", "-z", "rabbitmq", "5672"]
interval: 5s
timeout: 10s
retries: 5
question-service:
container_name: question-service
build:
context: ./backend/question-service
dockerfile: Dockerfile.dev
environment:
- MONGO_URI=mongodb://mongodb:27017
- AGW_URL=http://localhost:1234
ports:
- "5009:8080" # Maps container port 8080 to local 5009
volumes:
- ./backend/question-service:/usr/src/app
depends_on:
mongodb:
condition: service_started
networks:
- peerpreps-backend
mongodb:
image: mongo:7.0.1
container_name: mongodb-question-service
restart: always
ports:
- "27017:27017"
volumes:
- db-data:/data/db
networks:
- peerpreps-backend
db-us:
image: postgres:16rc1-alpine3.18
container_name: postgres-user-service
restart: always
environment:
- PGUSER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=users
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "users", "-p", "5432"]
interval: 5s
timeout: 60s
retries: 5
ports:
- 5432:5432
volumes:
- ./scripts/init_user_db.sh:/docker-entrypoint-initdb.d/init_user_db.sh
- data:/var/lib/postgresql/data
networks:
- peerpreps-backend
db-agw:
image: postgres:16rc1-alpine3.18
container_name: postgres-api-gateway
restart: always
environment:
- PGUSER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=apigateway
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "apigateway", "-p", "5433"]
interval: 5s
timeout: 60s
retries: 5
ports:
- 5433:5432
volumes:
- ./scripts/init_apigw_db.sh:/docker-entrypoint-initdb.d/init_apigw_db.sh
- agw-data:/var/lib/postgresql/data
networks:
- peerpreps-backend
volumes:
data: {}
db-data: {}
agw-data: {}
networks:
peerpreps-backend:
driver: bridge
rabbitmq-network:
driver: bridge