Skip to content

Commit 1667d91

Browse files
committed
Merge branch 'main' into role-based-authorization-spa
2 parents fcd5022 + f85a63b commit 1667d91

File tree

141 files changed

+9849
-577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+9849
-577
lines changed

.env.sample

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This is a sample environment configuration file.
2-
# Copy this file to .env and replace the placeholder values with your own.
3-
41
# Question Service
52
QUESTION_DB_CLOUD_URI=<FILL-THIS-IN>
63
QUESTION_DB_LOCAL_URI=mongodb://question-db:27017/question
@@ -19,7 +16,22 @@ MATCH_DB_LOCAL_URI=mongodb://match-db:27017/match
1916
MATCH_DB_USERNAME=user
2017
MATCH_DB_PASSWORD=password
2118

19+
# Room Service
20+
COLLAB_DB_CLOUD_URI=mongodb+srv://<username>:<password>@cluster0.h5ukw.mongodb.net/collaboration-service?retryWrites=true&w=majority&appName=Cluster0
21+
COLLAB_DB_LOCAL_URI=mongodb://collaboration-db:27017/collaboration-service
22+
23+
# Collaboration Service (Yjs Documents)
24+
YJS_DB_CLOUD_URI=mongodb+srv://<username>:<password>@cluster0.h5ukw.mongodb.net/yjs-documents?retryWrites=true&w=majority&appName=Cluster0
25+
YJS_DB_LOCAL_URI=mongodb://collaboration-db:27017/yjs-documents
26+
27+
# Will use cloud MongoDB Atlas database
28+
ENV=PROD
29+
30+
# Broker
31+
BROKER_URL=amqp://broker:5672
32+
2233
# Secret for creating JWT signature
2334
JWT_SECRET=you-can-replace-this-with-your-own-secret
2435

25-
NODE_ENV=development
36+
# Node environment
37+
NODE_ENV=development

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
service: [frontend, services/question, services/user, services/match]
26+
service: [frontend, services/question, services/user, services/match, services/collaboration]
2727
steps:
2828
- uses: actions/checkout@v4
2929
- name: Use Node.js

README.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/bzPrOe11)
2+
23
# CS3219 Project (PeerPrep) - AY2425S1
4+
35
## Group: G03
46

5-
### Note:
6-
- You can choose to develop individual microservices within separate folders within this repository **OR** use individual repositories (all public) for each microservice.
7-
- In the latter scenario, you should enable sub-modules on this GitHub classroom repository to manage the development/deployment **AND** add your mentor to the individual repositories as a collaborator.
8-
- The teaching team should be given access to the repositories as we may require viewing the history of the repository in case of any disputes or disagreements.
7+
### Note:
8+
9+
- You can choose to develop individual microservices within separate folders within this repository **OR** use
10+
individual repositories (all public) for each microservice.
11+
- In the latter scenario, you should enable sub-modules on this GitHub classroom repository to manage the
12+
development/deployment **AND** add your mentor to the individual repositories as a collaborator.
13+
- The teaching team should be given access to the repositories as we may require viewing the history of the repository
14+
in case of any disputes or disagreements.
915

1016
## Pre-requisites
1117

1218
1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/)
1319
2. Clone the GitHub repository
20+
1421
```
1522
git clone https://github.com/CS3219-AY2425S1/cs3219-ay2425s1-project-g03.git
1623
```
@@ -19,7 +26,7 @@ git clone https://github.com/CS3219-AY2425S1/cs3219-ay2425s1-project-g03.git
1926

2027
**Step 1: Copy Environment Configuration File**
2128

22-
To get started, copy the contents of `.env.sample` into a new `.env` file located at the root level of the project.
29+
To get started, copy the contents of `.env.sample` into a new `.env` file located at the root level of the project.
2330

2431
**Step 2: Build the Docker containers**
2532

@@ -37,25 +44,26 @@ Once the build is complete, you can start the Docker containers.
3744
docker compose -f compose.yml up -d
3845
```
3946

40-
After spinning up the services, you may access the frontend client at `127.0.0.1:4200`. Specifically, you can navigate to the Question SPA at `127.0.0.1:4200/questions` and the login page at `127.0.0.1/account`.
47+
After spinning up the services, you may access the frontend client at `127.0.0.1:4200`. Specifically, you can navigate
48+
to the Question SPA at `127.0.0.1:4200/questions` and the login page at `127.0.0.1/account`.
4149

42-
If you would like to spin up the services in development mode, you may use the following command. This enables hot reloading and exposes the ports for all microservices.
50+
If you would like to spin up the services in development mode, you may use the following command. This enables hot
51+
reloading and exposes the ports for all microservices.
4352

4453
```bash
4554
docker compose -f compose.yml -f compose.dev.yml up -d
4655
```
4756

48-
| Service | Port |
49-
|-----------------------|------|
50-
| Frontend | 4200 |
51-
| API Gateway | 8080 |
52-
| Question Service | 8081 |
53-
| User Service | 8082 |
54-
| Match Service | 8083 |
55-
| Collaboration Service | 8084 |
56-
| Chat Service | 8085 |
57-
| History Service | 8086 |
58-
57+
| Service | Port |
58+
|------------------------------|------|
59+
| Frontend | 4200 |
60+
| API Gateway | 8080 |
61+
| Question Service | 8081 |
62+
| User Service | 8082 |
63+
| Match Service | 8083 |
64+
| Collaboration & Room Service | 8084 |
65+
| Chat Service | 8085 |
66+
| History Service | 8086 |
5967

6068
**Step 4: Stop the Docker containers**
6169

@@ -65,4 +73,6 @@ Once you are done, stop and remove the containers using:
6573
docker compose down -v
6674
```
6775

68-
Note that this will clear any data stored in volumes associated with the containers. If you would like to keep your data, you can run the command without the `-v` flag, which will remove the containers but retain the data in the volumes for future use.
76+
Note that this will clear any data stored in volumes associated with the containers. If you would like to keep your
77+
data, you can run the command without the `-v` flag, which will remove the containers but retain the data in the volumes
78+
for future use.

compose.dev.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ services:
4040
ports:
4141
- 27019:27017
4242

43-
match-broker:
43+
collaboration:
44+
command: npm run dev
45+
ports:
46+
- 8084:8084
47+
volumes:
48+
- /app/node_modules
49+
- ./services/collaboration:/app
50+
51+
broker:
4452
ports:
4553
- 5672:5672
54+
55+
dozzle:
56+
image: amir20/dozzle:latest
57+
volumes:
58+
- /var/run/docker.sock:/var/run/docker.sock
59+
ports:
60+
- 8000:8080
61+
restart: always

compose.yml

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
ports:
99
- 4200:4200
1010
restart: always
11-
11+
1212
gateway:
1313
container_name: gateway
1414
image: nginx:1.27
@@ -20,9 +20,11 @@ services:
2020
- question
2121
- user
2222
- match
23+
- collaboration
2324
networks:
2425
- gateway-network
25-
26+
restart: always
27+
2628
question:
2729
container_name: question
2830
image: question
@@ -34,6 +36,11 @@ services:
3436
DB_LOCAL_URI: ${QUESTION_DB_LOCAL_URI}
3537
DB_USERNAME: ${QUESTION_DB_USERNAME}
3638
DB_PASSWORD: ${QUESTION_DB_PASSWORD}
39+
BROKER_URL: ${BROKER_URL}
40+
JWT_SECRET: ${JWT_SECRET}
41+
depends_on:
42+
broker:
43+
condition: service_healthy
3744
networks:
3845
- gateway-network
3946
- question-db-network
@@ -69,7 +76,7 @@ services:
6976
- gateway-network
7077
- user-db-network
7178
restart: always
72-
79+
7380
user-db:
7481
container_name: user-db
7582
image: mongo:7.0.14
@@ -82,7 +89,7 @@ services:
8289
- user-db-network
8390
command: --quiet
8491
restart: always
85-
92+
8693
match:
8794
container_name: match
8895
image: match
@@ -94,8 +101,10 @@ services:
94101
DB_LOCAL_URI: ${MATCH_DB_LOCAL_URI}
95102
DB_USERNAME: ${MATCH_DB_USERNAME}
96103
DB_PASSWORD: ${MATCH_DB_PASSWORD}
104+
JWT_SECRET: ${JWT_SECRET}
105+
BROKER_URL: ${BROKER_URL}
97106
depends_on:
98-
match-broker:
107+
broker:
99108
condition: service_healthy
100109
networks:
101110
- gateway-network
@@ -113,25 +122,57 @@ services:
113122
networks:
114123
- match-db-network
115124
restart: always
116-
117-
match-broker:
118-
container_name: match-broker
119-
hostname: match-broker
125+
126+
broker:
127+
container_name: broker
128+
hostname: broker
120129
image: rabbitmq:4.0.2
121130
user: rabbitmq
122131
networks:
123-
- match-db-network
132+
- gateway-network
124133
healthcheck:
125134
test: rabbitmq-diagnostics check_port_connectivity
126135
interval: 30s
127136
timeout: 30s
128137
retries: 10
129138
start_period: 30s
139+
restart: always
140+
141+
collaboration:
142+
container_name: collaboration
143+
image: collaboration
144+
build:
145+
context: services/collaboration
146+
dockerfile: Dockerfile
147+
environment:
148+
COLLAB_DB_CLOUD_URI: ${COLLAB_DB_CLOUD_URI}
149+
COLLAB_DB_LOCAL_URI: ${COLLAB_DB_LOCAL_URI}
150+
YJS_DB_CLOUD_URI: ${YJS_DB_CLOUD_URI}
151+
YJS_DB_LOCAL_URI: ${YJS_DB_LOCAL_URI}
152+
BROKER_URL: ${BROKER_URL}
153+
JWT_SECRET: ${JWT_SECRET}
154+
depends_on:
155+
broker:
156+
condition: service_healthy
157+
networks:
158+
- gateway-network
159+
- collaboration-db-network
160+
restart: always
161+
162+
collaboration-db:
163+
container_name: collaboration-db
164+
image: mongo:7.0.14
165+
volumes:
166+
- collaboration-db:/data/db
167+
networks:
168+
- collaboration-db-network
169+
restart: always
130170

131171
volumes:
132172
question-db:
133173
user-db:
134174
match-db:
175+
collaboration-db:
135176

136177
networks:
137178
gateway-network:
@@ -142,3 +183,5 @@ networks:
142183
driver: bridge
143184
match-db-network:
144185
driver: bridge
186+
collaboration-db-network:
187+
driver: bridge

0 commit comments

Comments
 (0)