Skip to content

Commit d4358d4

Browse files
committed
Merge branch 'main' into ci-cd-aws-deploy
2 parents c0b9e6d + 097b6b7 commit d4358d4

File tree

115 files changed

+9197
-369
lines changed

Some content is hidden

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

115 files changed

+9197
-369
lines changed

.env.sample

Lines changed: 13 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,10 +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+
2230
# Broker
2331
BROKER_URL=amqp://broker:5672
2432

2533
# Secret for creating JWT signature
2634
JWT_SECRET=you-can-replace-this-with-your-own-secret
2735

28-
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ services:
4040
ports:
4141
- 27019:27017
4242

43+
collaboration:
44+
command: npm run dev
45+
ports:
46+
- 8084:8084
47+
volumes:
48+
- /app/node_modules
49+
- ./services/collaboration:/app
50+
4351
broker:
4452
ports:
4553
- 5672:5672
@@ -50,3 +58,4 @@ services:
5058
- /var/run/docker.sock:/var/run/docker.sock
5159
ports:
5260
- 8000:8080
61+
restart: always

compose.yml

Lines changed: 55 additions & 15 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,26 @@ services:
2020
- question
2121
- user
2222
- match
23+
- collaboration
2324
networks:
2425
- gateway-network
26+
restart: always
2527

28+
broker:
29+
container_name: broker
30+
hostname: broker
31+
image: rabbitmq:4.0.2
32+
user: rabbitmq
33+
networks:
34+
- gateway-network
35+
healthcheck:
36+
test: rabbitmq-diagnostics check_port_connectivity
37+
interval: 30s
38+
timeout: 30s
39+
retries: 10
40+
start_period: 30s
41+
restart: always
42+
2643
question:
2744
container_name: question
2845
image: question
@@ -34,7 +51,11 @@ services:
3451
DB_LOCAL_URI: ${QUESTION_DB_LOCAL_URI}
3552
DB_USERNAME: ${QUESTION_DB_USERNAME}
3653
DB_PASSWORD: ${QUESTION_DB_PASSWORD}
54+
BROKER_URL: ${BROKER_URL}
3755
JWT_SECRET: ${JWT_SECRET}
56+
depends_on:
57+
broker:
58+
condition: service_healthy
3859
networks:
3960
- gateway-network
4061
- question-db-network
@@ -70,7 +91,7 @@ services:
7091
- gateway-network
7192
- user-db-network
7293
restart: always
73-
94+
7495
user-db:
7596
container_name: user-db
7697
image: mongo:7.0.14
@@ -83,7 +104,7 @@ services:
83104
- user-db-network
84105
command: --quiet
85106
restart: always
86-
107+
87108
match:
88109
container_name: match
89110
image: match
@@ -116,25 +137,42 @@ services:
116137
networks:
117138
- match-db-network
118139
restart: always
119-
120-
broker:
121-
container_name: broker
122-
hostname: broker
123-
image: rabbitmq:4.0.2
124-
user: rabbitmq
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
125157
networks:
126158
- gateway-network
127-
healthcheck:
128-
test: rabbitmq-diagnostics check_port_connectivity
129-
interval: 30s
130-
timeout: 30s
131-
retries: 10
132-
start_period: 30s
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
133170

134171
volumes:
135172
question-db:
136173
user-db:
137174
match-db:
175+
collaboration-db:
138176

139177
networks:
140178
gateway-network:
@@ -145,3 +183,5 @@ networks:
145183
driver: bridge
146184
match-db-network:
147185
driver: bridge
186+
collaboration-db-network:
187+
driver: bridge

frontend/angular.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@
5151
"development": {
5252
"optimization": false,
5353
"extractLicenses": false,
54-
"sourceMap": true
54+
"sourceMap": true,
55+
"fileReplacements": [
56+
{
57+
"replace": "src/environments/environment.ts",
58+
"with": "src/environments/environment.development.ts"
59+
}
60+
]
5561
}
5662
},
5763
"defaultConfiguration": "production"

0 commit comments

Comments
 (0)