Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 256 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
256 commits
Select commit Hold shift + click to select a range
f53b4cf
Add .gitignore
Sep 20, 2024
5813fc6
Add question service structure
Sep 20, 2024
69161c7
Merge remote-tracking branch 'upstream/question-service' into questio…
Sep 20, 2024
0904bd9
Set up user-service and added .env file
tienyu2000 Sep 21, 2024
a1c3368
Add password reset function
tienyu2000 Sep 21, 2024
cda1fae
init npm
Sep 22, 2024
503a584
Add mock database
Sep 22, 2024
e4f355b
add mock models
Sep 22, 2024
236596e
add mock controllers
Sep 22, 2024
610d6fb
add routes and server
Sep 22, 2024
8180351
Merge pull request #3 from DanLinhHuynh-Niwashi/question-service
DanLinhHuynh-Niwashi Sep 22, 2024
97f4726
Add password strength check feature
tienyu2000 Sep 22, 2024
1978a42
Add password requirements to README
tienyu2000 Sep 22, 2024
9a26463
Renamed database name to user-accounts
tienyu2000 Sep 22, 2024
de984db
Set up new user profile database and user profile functionality.
tienyu2000 Sep 23, 2024
bf42dc0
Adapt model to mongoclouddb
Sep 24, 2024
f7ee8ba
Update controllers and routes
Sep 24, 2024
fc2d948
Update server
Sep 24, 2024
644e6b8
Merge pull request #2 from tienyu2000/user-service
songivan00 Sep 24, 2024
d3457fb
Merge repository
Sep 24, 2024
010e532
Move server files into src folder
Sep 24, 2024
f529292
feat: Implement Questions CRUD UI and Integrate with Services API
Sep 26, 2024
1af7a3f
Merge pull request #5 from alexandermula/question-service-frontend
DanLinhHuynh-Niwashi Sep 26, 2024
6a41fdf
Merge branch 'question-service-frontend' into question-service
alexandermula Sep 27, 2024
dbe4893
Merge pull request #1 from DanLinhHuynh-Niwashi/question-service
alexandermula Sep 27, 2024
abd8023
updated frontend to use data from mongo
Sep 27, 2024
71c7ea1
Merge pull request #1 from alexandermula/question-service-frontend
DanLinhHuynh-Niwashi Sep 27, 2024
89707d7
Adapt to category id as objectid
Sep 27, 2024
ece9c6b
Fix bug adding wrong args
Sep 27, 2024
9a9e094
Merge pull request #2 from DanLinhHuynh-Niwashi/question-service
alexandermula Sep 27, 2024
1591896
Add format to question display page
Sep 27, 2024
95d7445
Merge pull request #6 from DanLinhHuynh-Niwashi/question-service
DanLinhHuynh-Niwashi Sep 27, 2024
8bf5bfe
Fix bug on finding category
Sep 27, 2024
c6f9ca2
Merge pull request #7 from DanLinhHuynh-Niwashi/question-service
DanLinhHuynh-Niwashi Sep 27, 2024
266de72
Update concurrent npm start
Sep 28, 2024
e9eb05d
Update message show
Sep 28, 2024
09b7b75
Handle duplicate question error
Sep 28, 2024
faed4e8
Merge pull request #8 from DanLinhHuynh-Niwashi/question-service
DanLinhHuynh-Niwashi Sep 28, 2024
6f83943
Merge pull request #9 from CS3219-AY2425S1/question-service
DanLinhHuynh-Niwashi Sep 28, 2024
9b4c047
Update README.md
DanLinhHuynh-Niwashi Sep 28, 2024
7476d02
Update README.md
DanLinhHuynh-Niwashi Sep 28, 2024
75ad961
Update README.md
DanLinhHuynh-Niwashi Sep 28, 2024
67e0b05
Change base url name
Sep 28, 2024
a3814a3
Update README.md
DanLinhHuynh-Niwashi Sep 28, 2024
dd2e424
Create README.md
DanLinhHuynh-Niwashi Sep 28, 2024
9e2ac6c
Merge pull request #10 from DanLinhHuynh-Niwashi/question-service
DanLinhHuynh-Niwashi Sep 28, 2024
5024df7
Merge pull request #11 from CS3219-AY2425S1/question-service
DanLinhHuynh-Niwashi Sep 28, 2024
76cc773
-fixed edit question category id display
Sep 29, 2024
88120e2
Merge branch 'question-service' into question-service-frontend
DanLinhHuynh-Niwashi Sep 29, 2024
5d9fd7c
Merge pull request #12 from alexandermula/question-service-frontend
DanLinhHuynh-Niwashi Sep 29, 2024
c60f1d3
Fix check duplicate bug
Sep 29, 2024
821c59b
Add disable form on submitting
Sep 29, 2024
230c127
Merge pull request #13 from DanLinhHuynh-Niwashi/question-service
DanLinhHuynh-Niwashi Sep 29, 2024
1701ce3
Merge pull request #14 from CS3219-AY2425S1/question-service
DanLinhHuynh-Niwashi Sep 29, 2024
8193352
Fix display capitalization
Sep 29, 2024
0459044
Set /questions as landing page
Sep 29, 2024
d52f7aa
Merge pull request #15 from DanLinhHuynh-Niwashi/question-service
DanLinhHuynh-Niwashi Sep 29, 2024
1b7926b
Merge pull request #16 from CS3219-AY2425S1/question-service
DanLinhHuynh-Niwashi Sep 29, 2024
6ed3c67
Merge pull request #17 from CS3219-AY2425S1/user-service
songivan00 Oct 3, 2024
91f780d
complete frontend
songivan00 Oct 4, 2024
5c612d0
add docker files for containerisation
songivan00 Oct 4, 2024
5119b4b
use variables for port
songivan00 Oct 4, 2024
f838f21
Merge pull request #18 from songivan00/add-containerisation
songivan00 Oct 4, 2024
c5a77c3
minor changes
songivan00 Oct 5, 2024
d4e2338
Merge pull request #20 from songivan00/add-containerisation
songivan00 Oct 5, 2024
1230c39
Added get api call for user profile
tienyu2000 Oct 5, 2024
d383f8b
Merge changes from upstream
tienyu2000 Oct 5, 2024
4efc366
Handle database not connected case
Oct 6, 2024
57555d3
Merge pull request #22 from DanLinhHuynh-Niwashi/question-service
DanLinhHuynh-Niwashi Oct 6, 2024
e91ff0c
Merge pull request #23 from CS3219-AY2425S1/question-service
DanLinhHuynh-Niwashi Oct 6, 2024
7f39880
Merge pull request #21 from tienyu2000/user-service
DanLinhHuynh-Niwashi Oct 6, 2024
18d0cf7
Merge branch 'main' into add-containerisation
DanLinhHuynh-Niwashi Oct 6, 2024
e1d40b7
Merge pull request #19 from CS3219-AY2425S1/add-containerisation
DanLinhHuynh-Niwashi Oct 6, 2024
6f2c418
Handle database not connected case
Oct 6, 2024
e727e38
Merge pull request #24 from DanLinhHuynh-Niwashi/user-service-Linh
DanLinhHuynh-Niwashi Oct 6, 2024
58e3f87
Merge pull request #25 from CS3219-AY2425S1/user-service
DanLinhHuynh-Niwashi Oct 6, 2024
57c2d23
Add gitignore for matching service
Oct 10, 2024
e7c08a9
Add matching service mock backend
Oct 10, 2024
d9157e7
Add unit tests
Oct 10, 2024
e60e257
Merge pull request #26 from DanLinhHuynh-Niwashi/matching-service
DanLinhHuynh-Niwashi Oct 10, 2024
90f10c5
Refractor code to use websocket
Oct 10, 2024
1aca139
Merge pull request #27 from DanLinhHuynh-Niwashi/matching-service
DanLinhHuynh-Niwashi Oct 10, 2024
ea35aaa
Merge pull request #1 from songivan00/add-containerisation
songivan00 Oct 13, 2024
d27c800
Merge branch 'main' into user-service
songivan00 Oct 13, 2024
e619b5b
Merge branch 'CS3219-AY2425S1:main' into main
songivan00 Oct 14, 2024
12eaff1
Integrate backend into frontend
songivan00 Oct 14, 2024
39f84b1
Merge branch 'main' into user-service
songivan00 Oct 14, 2024
2ea1b78
Add Redis package
Oct 16, 2024
5a0a769
Adapt to redis
Oct 16, 2024
02ac072
Adapt to Redis
Oct 16, 2024
d5dcf6b
Containerize the service
Oct 16, 2024
ec48134
Merge pull request #28 from DanLinhHuynh-Niwashi/matching-service
DanLinhHuynh-Niwashi Oct 16, 2024
3a8775b
Merge pull request #29 from DanLinhHuynh-Niwashi/matching-service
DanLinhHuynh-Niwashi Oct 16, 2024
2c828f5
Merge pull request #30 from CS3219-AY2425S1/matching-service
DanLinhHuynh-Niwashi Oct 16, 2024
be17627
Integrated backend with frontend
songivan00 Oct 16, 2024
283c9b1
Merge pull request #31 from songivan00/user-service
songivan00 Oct 16, 2024
b526911
Bind websocket service to http server
Oct 17, 2024
2d363a4
Add package
Oct 17, 2024
76cbb7b
Containerize the service
Oct 17, 2024
7959ed9
Merge pull request #33 from DanLinhHuynh-Niwashi/matching-service
DanLinhHuynh-Niwashi Oct 17, 2024
540209b
Merge pull request #34 from CS3219-AY2425S1/matching-service
DanLinhHuynh-Niwashi Oct 17, 2024
7a588f4
Merge pull request #32 from CS3219-AY2425S1/user-service
DanLinhHuynh-Niwashi Oct 17, 2024
2388f23
Merge pull request #35 from CS3219-AY2425S1/main
DanLinhHuynh-Niwashi Oct 17, 2024
6ae1c2b
add required fields and admin privileges
songivan00 Oct 17, 2024
275b621
Merge pull request #36 from songivan00/user-service
songivan00 Oct 17, 2024
c2e9cbc
Merge branch 'main' of https://github.com/CS3219-AY2425S1/cs3219-ay24…
Oct 18, 2024
6038e04
Update matching service
Oct 18, 2024
093b8c8
Merge pull request #37 from DanLinhHuynh-Niwashi/matching-service
DanLinhHuynh-Niwashi Oct 18, 2024
482d16b
UI for start session done, websockets not connecting
Oct 19, 2024
8ebe38b
Merge pull request #1 from CS3219-AY2425S1/main
emiwooo Oct 19, 2024
4d1c711
Merge pull request #4 from emiwooo/matching-service
DanLinhHuynh-Niwashi Oct 19, 2024
69e9cfa
Fix websocket bug
Oct 19, 2024
a2ff7e8
Fix matching bug
Oct 19, 2024
6b22887
Modify to allow connection from other devices
Oct 19, 2024
897006b
Merge pull request #2 from DanLinhHuynh-Niwashi/matching-service-FE
emiwooo Oct 20, 2024
39912d3
started to add extra queue options and functionality
Oct 20, 2024
366b70d
stay in queue button functionality
Oct 20, 2024
9484064
Add redirect route if user already logged in
Oct 20, 2024
b7c9a80
Update ws version
Oct 20, 2024
7cce56f
Change status code
Oct 20, 2024
f91f2a8
Add try catch to handle fetch error
Oct 20, 2024
b36aa12
Finalize frontend
Oct 20, 2024
6bea70c
Merge branch 'matching-service' of https://github.com/emiwooo/cs3219-…
Oct 20, 2024
87cb934
Merge pull request #39 from emiwooo/matching-service
DanLinhHuynh-Niwashi Oct 20, 2024
05fb223
Update service to handle timeout
Oct 20, 2024
9dc7f29
Merge pull request #40 from DanLinhHuynh-Niwashi/matching-service
DanLinhHuynh-Niwashi Oct 20, 2024
929afd2
Move queue controller to controller folder
Oct 20, 2024
135c23c
Move back queue to model
Oct 20, 2024
25f65ee
Update log
Oct 20, 2024
168160d
Merge pull request #41 from DanLinhHuynh-Niwashi/matching-service
DanLinhHuynh-Niwashi Oct 20, 2024
72fd0b1
Merge pull request #42 from CS3219-AY2425S1/matching-service
DanLinhHuynh-Niwashi Oct 20, 2024
4c72e6d
add basic collab backend ws setup and created a collab page to go to …
songivan00 Oct 28, 2024
816a4e0
Merge pull request #43 from songivan00/collab-service
songivan00 Oct 28, 2024
2f70dd3
add missing collab files
songivan00 Oct 29, 2024
d0d19f6
Merge pull request #44 from songivan00/collab-service
songivan00 Oct 29, 2024
bcd19a6
Add api gateway
Nov 1, 2024
f469b38
Docker compose
Nov 1, 2024
53b63d0
Adapt to API gateway
Nov 1, 2024
540c31f
Modify to avoid storing user info on the ws itself
Nov 1, 2024
4faa378
added k8 files for deployment, service, stateful set and hpa; docker-…
Nov 3, 2024
521cb73
Implemented collaboration service database and frontend for session s…
tienyu2000 Nov 3, 2024
ddc2973
Added the frontend session summary page
tienyu2000 Nov 3, 2024
d278aed
Merge pull request #45 from tienyu2000/collaboration-service
songivan00 Nov 4, 2024
27aeaa1
added resource limits to deployments
Nov 4, 2024
db3249b
get random question
songivan00 Nov 4, 2024
68f1480
Merge branch 'collaboration-service' of https://github.com/CS3219-AY2…
Nov 4, 2024
029b1a4
Add new fields in session summary
songivan00 Nov 4, 2024
ce42d1d
refactor ws routing and handle refresh and back navigation
songivan00 Nov 4, 2024
3f3a1a3
Merge branch 'collaboration-service' of https://github.com/CS3219-AY2…
Nov 4, 2024
983f6c6
minor change
songivan00 Nov 4, 2024
e98c854
Update docker compose
Nov 4, 2024
c315e56
Update npm start
Nov 4, 2024
39d37ef
Add navigate
Nov 4, 2024
0536af3
Update gateway dockerfile
Nov 4, 2024
d2e43fb
Update api routes
Nov 4, 2024
3cbe5bc
Merge pull request #3 from CS3219-AY2425S1/collaboration-service
alexandermula Nov 4, 2024
dd70a6e
Change some collab routes to api gateway
Nov 4, 2024
906bfe1
Merge branch 'collaboration-service' of https://github.com/CS3219-AY2…
Nov 4, 2024
8b61394
Merge pull request #46 from DanLinhHuynh-Niwashi/api-gateway
DanLinhHuynh-Niwashi Nov 4, 2024
67d13f4
Add backbone for history service
tienyu2000 Nov 4, 2024
a4bc7a0
Merge pull request #47 from tienyu2000/history-service
tienyu2000 Nov 4, 2024
efd3281
merge
tienyu2000 Nov 4, 2024
23ee6f2
Merge branch 'main' into api-gateway
DanLinhHuynh-Niwashi Nov 5, 2024
7dd3ac7
Merge pull request #48 from CS3219-AY2425S1/api-gateway
DanLinhHuynh-Niwashi Nov 5, 2024
dcdec83
Merge branch 'kubernetes-hpa' into kubernetes-hpa
emiwooo Nov 5, 2024
b2d3b55
Merge pull request #49 from emiwooo/kubernetes-hpa
emiwooo Nov 5, 2024
96b7809
-Added frontend for code editor
Nov 5, 2024
79cd50f
Display username on session summary page instead of userId
tienyu2000 Nov 5, 2024
8e305aa
added app-config file, api-gateway .yaml files
Nov 5, 2024
8ad5340
Merge pull request #50 from tienyu2000/collaboration-service
tienyu2000 Nov 5, 2024
0343ae4
Merge pull request #52 from emiwooo/kubernetes-hpa
emiwooo Nov 5, 2024
d242dd8
delete obsolete file
Nov 5, 2024
c664704
Udpate docker-compose.yml file
tienyu2000 Nov 5, 2024
7b8f1d6
Merge pull request #53 from tienyu2000/main
tienyu2000 Nov 5, 2024
56e86cc
-add chatgpt section placeholder
Nov 5, 2024
d30f099
Merge branch 'collaboration-service' into collab-service-frontend
alexandermula Nov 5, 2024
c366040
Merge pull request #54 from alexandermula/collab-service-frontend
tienyu2000 Nov 5, 2024
2f7a93d
-updated css
Nov 5, 2024
a46e76d
Merge branch 'collab-service-frontend' of https://github.com/alexande…
Nov 5, 2024
210ce48
-added timer to track session duration
Nov 5, 2024
6c2839c
Merge branch 'collaboration-service' of https://github.com/CS3219-AY2…
Nov 5, 2024
5c34e6e
Merge pull request #4 from alexandermula/collab-service-frontend
alexandermula Nov 5, 2024
baa5220
Merge https://github.com/alexandermula/cs3219-ay2425s1-project-g23 in…
Nov 5, 2024
e9d0f2d
Merge pull request #55 from alexandermula/collab-service-frontend
DanLinhHuynh-Niwashi Nov 5, 2024
0631694
Merge branch 'main' into collaboration-service
DanLinhHuynh-Niwashi Nov 5, 2024
67aba6b
Merge pull request #56 from CS3219-AY2425S1/collaboration-service
DanLinhHuynh-Niwashi Nov 5, 2024
d8b1a87
Merge branch 'main' into Test
DanLinhHuynh-Niwashi Nov 5, 2024
6e98f64
Merge pull request #57 from CS3219-AY2425S1/Test
DanLinhHuynh-Niwashi Nov 5, 2024
e28a4dc
Update some user routes in api gateway
Nov 5, 2024
d3cf9fd
Fix route
Nov 5, 2024
629b5d2
Change routing
Nov 5, 2024
23f25b4
add nice to have communication
songivan00 Nov 6, 2024
13c98d6
Merge pull request #58 from CS3219-AY2425S1/add-chat
songivan00 Nov 6, 2024
50b199c
added history service kubernetes implementations; updated config file…
Nov 7, 2024
70a9bbe
Merge branch 'CS3219-AY2425S1:kubernetes-hpa' into kubernetes-hpa
emiwooo Nov 8, 2024
d135e19
Merge pull request #59 from emiwooo/kubernetes-hpa
emiwooo Nov 8, 2024
39dc79b
Add fulltext search for question listing
Nov 8, 2024
880fd0a
Add file upload for adding new question
Nov 8, 2024
ee84b4b
Merge pull request #60 from DanLinhHuynh-Niwashi/Question_Add
DanLinhHuynh-Niwashi Nov 8, 2024
789e1f8
Add reconnect logic
Nov 8, 2024
041368b
Add restart logic
Nov 8, 2024
ef4b32e
Add load limit
Nov 8, 2024
2281122
Remove collab socket
Nov 8, 2024
ed7f2c4
Add connection refused message response
Nov 8, 2024
ab5ec06
Add load test
Nov 8, 2024
a19eae5
Merge pull request #61 from DanLinhHuynh-Niwashi/Question_Add
DanLinhHuynh-Niwashi Nov 8, 2024
5482af6
Add misisng route
Nov 9, 2024
1ec3db1
Merge branch 'main' of https://github.com/CS3219-AY2425S1/cs3219-ay24…
Nov 9, 2024
9e4b986
Merge pull request #62 from DanLinhHuynh-Niwashi/Question_Add
DanLinhHuynh-Niwashi Nov 9, 2024
89d47ea
Handle disconnection from api gateway side
Nov 9, 2024
9367b3f
Implement history service
tienyu2000 Nov 9, 2024
6bf06fc
Update history service with compleixty filter and full text search
tienyu2000 Nov 9, 2024
5740914
Merge pull request #63 from tienyu2000/collaboration-service
tienyu2000 Nov 9, 2024
8f72482
add password recovery
songivan00 Nov 9, 2024
625ac76
Merge pull request #64 from CS3219-AY2425S1/add-pw-recovery
songivan00 Nov 9, 2024
c509cff
Remove matching service from API gateway
Nov 10, 2024
7d9a8ab
Remove matching service from gateway
Nov 10, 2024
451d4a8
Remove matching service from gateway
Nov 10, 2024
e8dfdae
Change matching service to pubsub pattern
Nov 10, 2024
2b5784a
Merge branch 'main' of https://github.com/CS3219-AY2425S1/cs3219-ay24…
Nov 10, 2024
b13cf98
Fix bug in saving attempted code
tienyu2000 Nov 10, 2024
8e6cb38
Fix bug for Collaboration frontend
tienyu2000 Nov 10, 2024
aec7336
Merge pull request #65 from tienyu2000/main
tienyu2000 Nov 10, 2024
2a40cd5
Merge branch 'main' of https://github.com/CS3219-AY2425S1/cs3219-ay24…
Nov 10, 2024
8eac45e
Update match controller to avoid broadcast
Nov 10, 2024
00006e0
Update dynamic port binding
Nov 10, 2024
ba96c8e
Add routes for reset password and attempt detail
Nov 10, 2024
7db7efc
Update front end to match with the gateway
Nov 10, 2024
7a3a769
Merge pull request #66 from DanLinhHuynh-Niwashi/PubSubWs
DanLinhHuynh-Niwashi Nov 10, 2024
418b095
added hpa set up instructions file
Nov 12, 2024
b6490f8
Merge branch 'kubernetes-hpa' of https://github.com/emiwooo/cs3219-ay…
Nov 12, 2024
fc61387
Merge branch 'kubernetes-hpa' into main
emiwooo Nov 12, 2024
5f75a36
Merge pull request #3 from emiwooo/main
emiwooo Nov 12, 2024
90e70a2
Add retry logic
Nov 12, 2024
92413dc
Use dynamic port for history service
Nov 12, 2024
c1beaa5
Add query models
Nov 12, 2024
137b75e
Add link to database query model
Nov 12, 2024
8a1e46d
Merge pull request #67 from DanLinhHuynh-Niwashi/PubSubWs
DanLinhHuynh-Niwashi Nov 12, 2024
1980ac4
Update default port
Nov 12, 2024
9eafbbb
Update server name
Nov 12, 2024
7749bf5
Merge pull request #68 from DanLinhHuynh-Niwashi/PubSubWs
DanLinhHuynh-Niwashi Nov 12, 2024
27d4f54
stateful sets for collab and history db
Nov 12, 2024
0988d58
Merge pull request #69 from emiwooo/kubernetes-hpa
emiwooo Nov 12, 2024
56db128
Merge branch 'main' into kubernetes-hpa
emiwooo Nov 12, 2024
b95f83c
Merge pull request #70 from CS3219-AY2425S1/kubernetes-hpa
emiwooo Nov 12, 2024
dd413f3
change to redis flushall
songivan00 Nov 12, 2024
7fcd212
updated README and HPA-SETUP files
emiwooo Nov 12, 2024
5f85f50
Merge pull request #72 from emiwooo/main
emiwooo Nov 12, 2024
00cb416
Merge pull request #71 from CS3219-AY2425S1/minor-final-changes
songivan00 Nov 12, 2024
f55bc7c
added env sample files, updated read me
emiwooo Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Docker Hub username to push images to
DOCKER_USERNAME=wuemily

# Database URIs
QUESTION_DB_CLOUD_URI={question-db-cloud-uri}
QUESTION_DB_LOCAL_URI={question-db-local-uri}

USER_DB_CLOUD_URI={user-db-cloud-uri}
USER_DB_LOCAL_URI={user-db-local-uri}

COLLAB_DB_CLOUD_URI={collab-db-cloud-uri}
COLLAB_DB_LOCAL_URI={collab-db-local-uri}

HISTORY_DB_CLOUD_URI={history-db-cloud-uri}
HISTORY_DB_LOCAL_URI={history-db-local-uri}

# Services ports (set to default ports)
QUESTION_PORT=3001
USER_PORT=3002
MATCHING_PORT=8080
COLLAB_PORT=8081
GATEWAY_PORT=4000
HISTORY_PORT=8082

JWT_SECRET={jwt-secret}

ENV=PROD

# Email account for sending password reset emails
EMAIL_USER={email-user}
EMAIL_PASSWORD={email-pass}

# Set to default port
FRONTEND_URL=http://localhost:3000
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Global ignores
.vscode/
.idea/
.DS_Store
*.log
*node_modules/

# Exclude environment files
*.env

# Exclude secret deployment file
*secret.yaml


# Node.js dependencies
node_modules/

# Build directories
build/
dist/

# Temporary files
tmp/
temp/
*.tmp
*.swp

# Output of npm pack
*.tgz
46 changes: 46 additions & 0 deletions HPA-SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
N8: Scalability
## Kubernetes and Horizontal Pod Auto-scaler (HPA)
The application uses Horizontal Pod Autoscalers (HPAs) to manage scalability based on CPU utilization. The HPAs automatically adjust the number of pods for each service based on the load.

### Configuration Infomation
Each microservice has its own HPA configuration file located in the `./k8` directory.
- The HPA settings by default are:
- Min Replicas: The minimum number of pod replicas (e.g., 1).
- Max Replicas: The maximum number of pod replicas (e.g., 10).
- Target CPU Utilization: The desired average CPU utilization (e.g., 50%).
- The HPA configuration files for each service are:
- Frontend: `k8/hpas/frontend-hpa.yaml`
- Collaboration Service: `k8/hpas/collaboration-service-hpa.yaml`
- Matching Service: `k8/hpas/matching-service-hpa.yaml`
- Question Service: `k8/hpas/question-service-hpa.yaml`
- User Service: `k8/hpas/user-service-hpa.yaml`
- History Service: `k8/hpas/history-service-hpa.yaml`

### Setup Instructions
- **Step 1: Setting up Docker Images.**
Ensure repository is cloned, and `.env` file is added. **Note:** `./k8/app-config.yaml` should hold the same ports and urls variables as the .env file. If there are discrepencies, update them to match. If you would like to change the ports for the services, you need to update ports in the app-config, and the relevant deployment and service `.yaml` files.
- If you want to use your own Docker Hub repository (where you will need to then push to), specify your Docker Hub ID in the .env **and** change image names in `.yaml`s in `./k8/deployments` for the microservices (so excluding redis and metrics-server deployments) to replace `wuemily` with your docker hub ID.
- After building the Docker images (steps 3 and 4 in `README.md`), push them with:
`docker push dockerhubid/question-service:latest`
`docker push dockerhubid/user-service:latest`
`docker push dockerhubid/matching-service:latest`
`docker push dockerhubid/collaboration-service:latest`
`docker push dockerhubid/frontend:latest`
`docker push dockerhubid/api-gateway:latest`
`docker push dockerhubid/history-service:latest`
- Alternatively, you can also use existing public reposity by setting the Docker Hub ID to wuemily; no need to push images or make changes in `.yaml` files.
- **Step 2: Setting up Minikube and Kubernetes.**
This assumes some basic understanding of Minikube and Kubernetes and they are both installed.
- Start Minikube with: ``minikube start --driver=docker``
- To apply the HPA configurations to your Kubernetes cluster, use the following commands (from root folder):
`kubectl apply -f ./k8`
`kubectl apply -f ./k8/deployments`
`kubectl apply -f ./k8/services`
`kubectl apply -f ./k8/statefulsets`
`kubectl apply -f ./k8/hpas`
- If load balancers appear to be not working, it may be because of the local hosting. Make sure `minikube tunnel` is running.
- **Step 3: Monitoring**
You can monitor the scaling behavior using `kubectl` commands.
- `kubectl get hpa`displays the current status of all HPAs in the cluster, including the current and desired number of replicas based on CPU usage.
- If CPU usage is `unknown`, check if Minikube metrics server addon is enabled with `minikube adddons list`, if it isn't, enable with `minikube addons enable metrics-server`.
- Can also observe pods and their status with `kubectl get pods` and `minikube dashboard`, depending on your preference.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/bzPrOe11)
# CS3219 Project (PeerPrep) - AY2425S1
## Group: Gxx
## Group: G23

### Note:
- You can choose to develop individual microservices within separate folders within this repository **OR** use individual repositories (all public) for each microservice.
- 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.
- 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.

### Run
- **Step 1:** Clone the repository.
- **Step 2:** Setup the necessary .env files in the /frontend and root folder using the .env.sample templates in both folders.
- Fill in the necessary information enclosed by curly brackets {}.
- The default ports are given by defefault as:
- GATEWAY_PORT=4000
- QUESTION_PORT=3001
- USER_PORT=3002
- MATCHING_PORT=8080
- COLLAB_PORT=8081
- HISTORY_PORT=8082
- If setting custom ports:
- Avoid using port 3000, as the React app runs on that port.
- For instructions on using Kubernetes, refer to the `HPA-SETUP.md` file. You may have to edit additional files for custom ports to work.
- **Step 3:** Run `docker --version` to check if docker is correctly installed. If not, ensure it is.
- **Step 4:** Run `docker-compose up --build -d ` command in terminal to build and run the app.
- **Step 5:** Go to http://localhost:3000 to see the application and services running.
- **Step 6:** Run `docker compose down` to stop running Docker containers.
- You can also run `docker compose down`, then `docker compose up -d` again to restart backend services.
- If using Kubernetes, please refer to `HPA-SETUP.md`.
190 changes: 190 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
version: '3.9'

services:
question-service:
container_name: question-service
restart: on-failure
build:
context: ./services/question-service
args:
- PORT=${QUESTION_PORT}
image: ${DOCKER_USERNAME}/question-service:latest
ports:
- "${QUESTION_PORT}:${QUESTION_PORT}"
environment:
PORT: ${QUESTION_PORT}
DB_CLOUD_URI: ${QUESTION_DB_CLOUD_URI}
DB_LOCAL_URI: ${QUESTION_DB_LOCAL_URI}
ENV: ${ENV}
depends_on:
- question-db
networks:
- app-network

question-db:
image: mongodb/mongodb-atlas-local
ports:
- "27018:27018"
networks:
- app-network

user-service:
container_name: user-service
restart: on-failure
build:
context: ./services/user-service
args:
- PORT=${USER_PORT}
image: ${DOCKER_USERNAME}/user-service:latest
ports:
- "${USER_PORT}:${USER_PORT}"
environment:
PORT: ${USER_PORT}
DB_CLOUD_URI: ${USER_DB_CLOUD_URI}
DB_LOCAL_URI: ${USER_DB_LOCAL_URI}
ENV: ${ENV}
JWT_SECRET: ${JWT_SECRET}
EMAIL_USER: ${EMAIL_USER}
EMAIL_PASSWORD: ${EMAIL_PASSWORD}
FRONTEND_URL: ${FRONTEND_URL}
depends_on:
- user-db
networks:
- app-network

user-db:
image: mongodb/mongodb-atlas-local
ports:
- "27019:27019"
networks:
- app-network

matching-service:
container_name: matching-service
restart: on-failure
build:
context: ./services/matching-service
args:
- PORT=${MATCHING_PORT}
- REDIS_HOST=redis
- REDIS_PORT=6379
ports:
- "${MATCHING_PORT}:${MATCHING_PORT}"
image: ${DOCKER_USERNAME}/matching-service:latest
environment:
PORT: ${MATCHING_PORT}
REDIS_HOST: redis
REDIS_PORT: 6379
ENV: ${ENV}
depends_on:
- redis
networks:
- app-network

collaboration-service:
container_name: collaboration-service
restart: on-failure
build:
context: ./services/collaboration-service
args:
- PORT=${COLLAB_PORT}
image: ${DOCKER_USERNAME}/collaboration-service:latest
ports:
- "${COLLAB_PORT}:${COLLAB_PORT}"
environment:
PORT: ${COLLAB_PORT}
HISTORY_PORT: ${HISTORY_PORT}
ENV: ${ENV}
DB_CLOUD_URI: ${COLLAB_DB_CLOUD_URI}
DB_LOCAL_URI: ${COLLAB_DB_LOCAL_URI}
networks:
- app-network

redis:
image: redis:alpine
restart: on-failure
ports:
- "6379:6379"
networks:
- app-network

api-gateway:
container_name: api-gateway
restart: on-failure
build:
context: ./services/api-gateway
args:
- PORT=${GATEWAY_PORT}
- QUESTION_PORT=${QUESTION_PORT}
- USER_PORT=${USER_PORT}
- COLLAB_PORT=${COLLAB_PORT}
- HISTORY_PORT=${HISTORY_PORT}
- HISTORY_URL=http://history-service
- USER_URL=http://user-service
- QUESTION_URL=http://question-service
- COLLAB_URL=http://collaboration-service
image: ${DOCKER_USERNAME}/api-gateway:latest
ports:
- "${GATEWAY_PORT}:${GATEWAY_PORT}"
environment:
PORT: ${GATEWAY_PORT}
QUESTION_PORT: ${QUESTION_PORT}
USER_PORT: ${USER_PORT}
COLLAB_PORT: ${COLLAB_PORT}
HISTORY_PORT: ${HISTORY_PORT}
HISTORY_URL: http://history-service
USER_URL: http://user-service
QUESTION_URL: http://question-service
COLLAB_URL: http://collaboration-service
depends_on:
- question-service
- user-service
- history-service
- collaboration-service
networks:
- app-network

frontend:
build: ./frontend
image: ${DOCKER_USERNAME}/frontend:latest
ports:
- "3000:3000"
volumes:
- ./frontend:/app
- /app/node_modules
depends_on:
- api-gateway
networks:
- app-network

history-service:
container_name: history-service
restart: on-failure
build:
context: ./services/history-service
args:
- PORT=${HISTORY_PORT}
image: ${DOCKER_USERNAME}/history-service:latest
ports:
- "${HISTORY_PORT}:${HISTORY_PORT}"
environment:
PORT: ${HISTORY_PORT}
QUESTION_PORT: ${QUESTION_PORT}
DB_CLOUD_URI: ${HISTORY_DB_CLOUD_URI}
DB_LOCAL_URI: ${HISTORY_DB_LOCAL_URI}
ENV: ${ENV}
depends_on:
- history-db
networks:
- app-network

history-db:
image: mongodb/mongodb-atlas-local
ports:
- "27020:27020"
networks:
- app-network

networks:
app-network:
driver: bridge
6 changes: 6 additions & 0 deletions frontend/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Set to default ports
REACT_APP_QUESTION_API_URL=http://localhost:3001
REACT_APP_USER_API_URL=http://localhost:3002
REACT_APP_MATCHING_API_URL=http://localhost:8080
REACT_APP_COLLAB_WS_URL=ws://localhost:8081
REACT_APP_COLLAB_API_URL=http://localhost:8081
37 changes: 37 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# React related
node_modules/
build/
.env

# Logs
npm-debug.log
yarn-error.log

# Miscellaneous
.DS_Store
*.log
*.swp
*.tmp
*.bak# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Loading