Skip to content

Commit 6df69b6

Browse files
authored
Merge pull request #152 from CS3219-AY2526Sem1/update-readme
Update readme
2 parents 3e825e8 + 58acfd7 commit 6df69b6

File tree

2 files changed

+223
-37
lines changed

2 files changed

+223
-37
lines changed

README.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,189 @@
22
# CS3219 Project (PeerPrep) - AY2526S1
33
## Group: G12
44

5+
## Services:
6+
7+
### Frontend
8+
9+
Folder: `PeerPrep`
10+
11+
Contains the project files for our frontend service built with Vite
12+
13+
#### Development:
14+
15+
Copy the `.env.template` to `.env` and update variables.
16+
17+
```
18+
npm install
19+
npm run dev
20+
```
21+
22+
### API Gateway
23+
24+
Folder: `api-gateway`
25+
26+
#### Functionality:
27+
28+
* Routes API traffic from users to the corresponding internal services
29+
* Handles the checking of access token cookies to enforce authentication and authorisation
30+
31+
#### Development:
32+
33+
Copy the `.env.template` to `.env` and update variables.
34+
35+
```
36+
uv sync
37+
uv run fastapi dev main.py
38+
```
39+
40+
### Collaboration Service
41+
42+
Folder: `collaboration-svc`
43+
44+
#### Functionality:
45+
46+
* Facilitate room/session creation
47+
* Coordinating users
48+
49+
#### Development:
50+
51+
Copy the `.env.template` to `.env` and update variables.
52+
53+
```
54+
uv sync
55+
uv run fastapi dev routes.py
56+
```
57+
58+
### Expire Observer Service
59+
60+
Folder: `expire-observer-svc`
61+
62+
#### Functionality:
63+
64+
* Handles TTL Matching Expire event from redis
65+
66+
#### Development:
67+
68+
Copy the `.env.template` to `.env` and update variables.
69+
70+
```
71+
uv sync
72+
uv run fastapi dev main.py
73+
```
74+
75+
### Matching Service
76+
77+
Folder: `matching-svc`
78+
79+
#### Functionality:
80+
81+
* Handles user matching requests
82+
* Corrdinating user acknowledgement for requests
83+
84+
#### Development:
85+
86+
Copy the `.env.template` to `.env` and update variables.
87+
88+
```
89+
uv sync
90+
uv run fastapi dev routes.py
91+
```
92+
93+
### Question History Service
94+
95+
Folder: `qns-hist-svc`
96+
97+
#### Functionality:
98+
99+
* Handles retrieval of users past attempts
100+
* Generate AI Summary Review on users past attempts
101+
102+
#### Development:
103+
104+
Copy the `.env.template` to `.env` and update variables.
105+
106+
```
107+
uv sync
108+
uv run fastapi dev routes.py
109+
```
110+
111+
### Question Service
112+
113+
Folder: `qns-svc`
114+
115+
#### Functionality:
116+
117+
* Handles retrieval of questions for users
118+
* Create, Update and Deletion of Question for admins
119+
120+
#### Development:
121+
122+
Copy the `.env.template` to `.env` and update variables.
123+
124+
```
125+
uv sync
126+
uv run fastapi dev routes.py
127+
```
128+
129+
#### Support:
130+
131+
Question Service has a supplimentary files for importing questions located under `support\qns-svc-import`
132+
133+
### Signaling Service
134+
135+
Folder: `signaling-svc`
136+
137+
#### Functionality:
138+
139+
* Coordinate WebRTC traffic between users
140+
141+
#### Development:
142+
143+
```
144+
npm install
145+
node server.js
146+
```
147+
148+
### User Service
149+
150+
Folder: `user-svc`
151+
152+
#### Functionality:
153+
154+
* Handles authentication of users
155+
* Retrieve profile information for users
156+
157+
#### Development:
158+
159+
Copy the `.env.template` to `.env` and update variables.
160+
161+
```
162+
uv sync
163+
uv run fastapi dev main.py
164+
```
165+
166+
## Running Locally
167+
168+
We support running our services as containers using docker compose
169+
170+
> Prerequisite
171+
> * Ensure that docker is installed
172+
> * Ensure 4 Redis instances and 3 PostgreSQL instance are setup for the various services
173+
174+
To startup the containers:
175+
176+
```
177+
docker compose up -d --build
178+
```
179+
180+
To tear everything down
181+
182+
```
183+
docker compose down
184+
```
185+
186+
187+
5188
### Note:
6189
- You are required to develop individual microservices within separate folders within this repository.
7190
- 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.

docker-compose.template.yml

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ services:
1111
env_file:
1212
- ./api-gateway/.env
1313
environment:
14-
- REDIS_URL=
15-
- FRONT_END_URL=http://0.0.0.0:5173
14+
- REDIS_URL=host:port
15+
- FRONT_END_URL=http://localhost:5173
1616
- HEARTBEAT_TTL=300
1717
volumes:
1818
- ./logs/api-gateway/:/app/logs/
@@ -35,12 +35,13 @@ services:
3535
env_file:
3636
- ./user-svc/.env
3737
environment:
38-
- DATABASE_URL=postgresql+asyncpg://
38+
- DATABASE_URL=postgresql+asyncpg://user_name:password@host:port/database_name
3939
- APIGATEWAY_URL=http://api-gateway
40-
- HOST_URL=user-svc
40+
- HOST_URL=http://user-svc
4141
- HEARTBEAT_PERIOD=270
42-
- VERIFY_EMAIL_BASE=http://0.0.0.0:5173/verify
43-
- PASSWORD_RESET_BASE=http://0.0.0.0:5173/reset-password
42+
- RR_TTL=3600
43+
- VERIFY_EMAIL_BASE=http://localhost:5173/verify
44+
- PASSWORD_RESET_BASE=http://localhost:5173/reset-password
4445
volumes:
4546
- ./logs/user-svc/:/app/logs/
4647
depends_on:
@@ -60,11 +61,11 @@ services:
6061
env_file:
6162
- ./qns-svc/.env
6263
environment:
63-
- DATABASE_URL=asyncpg://
64+
- DATABASE_URL=asyncpg://user_name:password@host:port/database_name
6465
- APIGATEWAY_URL=http://api-gateway
65-
- HOST_URL=qns-svc
66+
- HOST_URL=http://qns-svc
6667
- HEARTBEAT_PERIOD=270
67-
- FRONT_END_URL=http://0.0.0.0:5173
68+
- FRONT_END_URL=http://localhost:5173
6869
volumes:
6970
- ./logs/qns-svc/:/app/logs/
7071
depends_on:
@@ -84,15 +85,15 @@ services:
8485
env_file:
8586
- ./matching-svc/.env
8687
environment:
87-
- REDIS_HOST=
88-
- REDIS_PORT=
89-
- REDIS_EVENT_QUEUE_HOST=
90-
- REDIS_EVENT_QUEUE_PORT=
88+
- REDIS_HOST=host
89+
- REDIS_PORT=port
90+
- REDIS_EVENT_QUEUE_HOST=collaboration_svc_redis_host
91+
- REDIS_EVENT_QUEUE_PORT=collaboration_svc_redis_port
9192
- USER_SERVICE_GET_USER_DETAILS_URL=http://user-svc/users/me
9293
- APIGATEWAY_URL=http://api-gateway
93-
- HOST_URL=matching-svc
94+
- HOST_URL=http://matching-svc
9495
- HEARTBEAT_PERIOD=270
95-
- FRONT_END_URL=http://0.0.0.0:5173
96+
- FRONT_END_URL=http://localhost:5173
9697
volumes:
9798
- ./logs/matching-svc/:/app/logs/
9899
depends_on:
@@ -112,10 +113,10 @@ services:
112113
env_file:
113114
- ./qns-hist-svc/.env
114115
environment:
115-
- DATABASE_URL=asyncpg://
116-
- REDIS_QUEUE_URL=redis://
116+
- DATABASE_URL=asyncpg://user_name:password@host:port/database_name
117+
- REDIS_QUEUE_URL=host:port/database_number
117118
- APIGATEWAY_URL=http://api-gateway
118-
- HOST_URL=qns-hist-svc
119+
- HOST_URL=http://qns-hist-svc
119120
- HEARTBEAT_PERIOD=270
120121
- EVALUATION_MODEL_NAME=
121122
- OPENAI_COMPAT_API_ENDPOINT=
@@ -139,17 +140,17 @@ services:
139140
env_file:
140141
- ./collaboration-svc/.env
141142
environment:
142-
- REDIS_HOST=
143-
- REDIS_PORT=
144-
- REDIS_STREAM_KEY=
143+
- REDIS_HOST=host
144+
- REDIS_PORT=port
145+
- REDIS_STREAM_KEY=expired_ttl
145146
- REDIS_GROUP=cs_consumers
146-
- QUESTION_SERVICE_POOL_URL=
147-
- QUESTION_SERVICE_HISTORY_URL=
148-
- GATEWAY_WEBSOCKET_URL=
147+
- QUESTION_SERVICE_POOL_URL=http://qns-svc/pool
148+
- QUESTION_SERVICE_HISTORY_URL=http://qns-hist-svc/attempts
149+
- GATEWAY_WEBSOCKET_URL=ws://api-gateway/ws/collab
149150
- APIGATEWAY_URL=http://api-gateway
150-
- HOST_URL=collaboration-svc
151+
- HOST_URL=http://collaboration-svc
151152
- HEARTBEAT_PERIOD=270
152-
- FRONT_END_URL=http://0.0.0.0:5173
153+
- FRONT_END_URL=http://localhost:5173
153154
volumes:
154155
- ./logs/collaboration-svc/:/app/logs/
155156
depends_on:
@@ -167,8 +168,8 @@ services:
167168
env_file:
168169
- ./expire-observer-svc/.env
169170
environment:
170-
- REDIS_HOST=
171-
- REDIS_PORT=
171+
- REDIS_HOST=collaboration_svc_redis_port
172+
- REDIS_PORT=collaboration_svc_redis_host
172173
volumes:
173174
- ./logs/expire-observer-svc/:/app/logs/
174175
depends_on:
@@ -187,15 +188,17 @@ services:
187188
- pp-network
188189
restart: always
189190

190-
# frontend:
191-
# build:
192-
# context: ./PeerPrep
193-
# dockerfile: Dockerfile
194-
# container_name: pp-frontend
195-
# ports:
196-
# - "80:80"
197-
# networks:
198-
# - pp-network
191+
frontend:
192+
build:
193+
context: ./PeerPrep
194+
dockerfile: Dockerfile
195+
container_name: pp-frontend
196+
ports:
197+
- "5173:80"
198+
networks:
199+
- pp-network
200+
env_file:
201+
- ./PeerPrep/.env
199202

200203
networks:
201204
pp-network:

0 commit comments

Comments
 (0)