Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
592 commits
Select commit Hold shift + click to select a range
402ecc3
Move Api to infrastructure
SPWwj Oct 19, 2024
1e5ae44
complete question selection page
SPWwj Oct 20, 2024
e63fc76
Fix question management routing
SPWwj Oct 20, 2024
244a06e
Add error match fail callback
SPWwj Oct 20, 2024
9ea3ed3
Fix retry not working
SPWwj Oct 20, 2024
0144caf
Use local db for user-service
njxue Oct 20, 2024
d01bb4c
Merge pull request #62 from CS3219-AY2425S1/matching-timing-based-rel…
rjkoh Oct 20, 2024
00ff97c
Merge pull request #64 from njxue/user-service-local-db
SilasTSL Oct 20, 2024
becb48a
Merge branch 'main' into br-select-question
SPWwj Oct 20, 2024
86b2812
fix matching no data issue
SPWwj Oct 20, 2024
044f87e
Merge pull request #63 from SPWwj/br-select-question
rjkoh Oct 20, 2024
a571378
Add logging of queues
Nephelite Oct 20, 2024
1a692dd
Fix matching logic
Nephelite Oct 20, 2024
13a0dfb
Remove debug console log statements
Nephelite Oct 20, 2024
8fbc6b6
Merge pull request #65 from CS3219-AY2425S1/matching-logging-and-bug-…
SPWwj Oct 20, 2024
c884ca3
Remove comments and edit README files
Nephelite Oct 20, 2024
8981808
Merge pull request #66 from CS3219-AY2425S1/matching-logging-and-bug-…
SPWwj Oct 20, 2024
a304a33
Adjust Debug Logs
Nephelite Oct 20, 2024
5a26a30
Merge pull request #67 from CS3219-AY2425S1/debug-adjustment
rjkoh Oct 20, 2024
cf549c5
Update README.md
Nephelite Oct 20, 2024
e2db608
Update README.md
Nephelite Oct 20, 2024
1d178fe
Merge pull request #68 from CS3219-AY2425S1/Nephelite-patch-1
rjkoh Oct 20, 2024
0497ffd
Add ui for collaboration room
njxue Oct 21, 2024
c8ae1fc
Merge branch 'main' into monaco-editor
njxue Oct 21, 2024
2a22d22
Sync selected programming language
njxue Oct 21, 2024
db56032
Redirect user to page on login
njxue Oct 21, 2024
ef753fa
Use CollaborationContext
njxue Oct 21, 2024
fc45659
Fix logo in nav occupying too much space
njxue Oct 21, 2024
5a2a59f
Make width of editor adjustable
njxue Oct 21, 2024
9458640
Move buttons to toolbar
njxue Oct 21, 2024
d2873e1
Add output box
njxue Oct 21, 2024
000e383
Clean up
njxue Oct 21, 2024
145459f
Add toggle theme
njxue Oct 21, 2024
efab33b
Fix initial language not set
njxue Oct 21, 2024
d5412fb
Clean up
njxue Oct 21, 2024
45cbf1e
Remove unused styles
njxue Oct 21, 2024
85464a9
Use ymap to observe language changes
njxue Oct 22, 2024
6eba964
Add provider awareness
njxue Oct 22, 2024
df3484b
Fetch language versions
njxue Oct 25, 2024
f722f6a
Add code execution with piston and fix initial language bug
njxue Oct 26, 2024
bc81e33
Refactor code execution and change output box ui
njxue Oct 26, 2024
c230c92
Fix missing version for initial language
njxue Oct 26, 2024
d137db9
Add admin user management page and implement delete user
njxue Oct 26, 2024
5468a0b
set up
rjkoh Oct 28, 2024
6013d4e
Use useEffect to perform initialisation
njxue Oct 29, 2024
42c812c
Add connection status of users
njxue Oct 29, 2024
4edb626
update matching-service logic to use kafka
rjkoh Oct 29, 2024
7c3a5a9
style fixes
rjkoh Oct 29, 2024
0b061ea
create kafka skeleton for question and collab
rjkoh Oct 29, 2024
b164317
Add user question history
Nephelite Oct 29, 2024
817c6ce
Fix History Data Population
Nephelite Oct 30, 2024
118aa6f
add explanations for collab-service
rjkoh Oct 30, 2024
7c8c292
Merge pull request #69 from njxue/monaco-editor
SPWwj Oct 30, 2024
45c2276
add env and update question-match logic
rjkoh Oct 30, 2024
afb1530
add collab into init-mongo
rjkoh Oct 30, 2024
2151ae3
update env examples
rjkoh Oct 30, 2024
8c9bfa5
update docker-compose
rjkoh Oct 30, 2024
d100878
update docker and dependencies
rjkoh Oct 30, 2024
3da6939
reset timer
SPWwj Oct 30, 2024
c129c61
Update Session schema
SilasTSL Oct 30, 2024
6202d3d
update docker to use kafka and zookeeper
rjkoh Oct 30, 2024
46866cf
Create YDocManager class and rename functions in client/controller
SilasTSL Oct 30, 2024
ac46445
Add controller functionality to handle match event
SilasTSL Oct 30, 2024
1e3d51e
update kafka logic
rjkoh Oct 30, 2024
bc2bc35
Controller functions to handle match event and create session
SilasTSL Oct 30, 2024
2e754a6
Merge branch 'collab-backend' into silas-ywebsocket-and-persist-data
SilasTSL Oct 30, 2024
b74c313
Merge pull request #71 from CS3219-AY2425S1/silas-ywebsocket-and-pers…
SilasTSL Oct 30, 2024
c4475aa
update imports and qn logic
rjkoh Oct 30, 2024
4cdac42
Add chat panel
SPWwj Oct 30, 2024
36e16de
Remove Excess Semicolon
Nephelite Oct 30, 2024
a6dee87
fix username not unique
SPWwj Oct 30, 2024
dde268d
Add promote user
njxue Oct 31, 2024
dfa2313
Resolve merge conflicts
njxue Oct 31, 2024
302c30c
Merge branch 'main' into collab-backend
SilasTSL Oct 31, 2024
8e6cfe6
Change error message
njxue Oct 31, 2024
3a1e630
Add filter users
njxue Oct 31, 2024
28406a8
Update collaboration service port in readme
SilasTSL Oct 31, 2024
2b5eac0
Show filtered user count
njxue Oct 31, 2024
e4603cd
Fix buttons not occupying full width
njxue Oct 31, 2024
010aca1
Manage update events upon websocket connection
SilasTSL Oct 31, 2024
dbae460
Change frontend to use collaboration service
SilasTSL Oct 31, 2024
d283468
update topics
rjkoh Oct 31, 2024
dbf2023
update logic upon return from qn and collab
rjkoh Oct 31, 2024
a75a455
update matching context to 60s
rjkoh Oct 31, 2024
cb3300c
update question logic to handle "all" difficulties and/or categories
rjkoh Oct 31, 2024
642e1d5
Add send email to get placeholder reset password page
njxue Oct 31, 2024
ea987f1
Change collaboration socket to use y-websocket default encoder
SilasTSL Oct 31, 2024
a70498f
Fix resizeObserver
SPWwj Oct 31, 2024
ad4be0d
Merge pull request #72 from SPWwj/br-collab
SPWwj Oct 31, 2024
5c092ef
Merge branch 'CS3219-AY2425S1:main' into main
SPWwj Oct 31, 2024
84ba7cc
Add username to token
SPWwj Oct 31, 2024
7286534
Merge pull request #74 from SPWwj/main
njxue Nov 1, 2024
4b01fb3
Revert "Collab Service"
rjkoh Nov 1, 2024
0ecbfce
Merge pull request #75 from CS3219-AY2425S1/revert-74-main
njxue Nov 1, 2024
e247634
update readme
rjkoh Nov 1, 2024
ce695cc
update readme
rjkoh Nov 1, 2024
82c5c6d
Fix editor disable
SPWwj Nov 1, 2024
c1df768
Merge branch 'main' into main
SPWwj Nov 1, 2024
4eb4ccd
reenble formatOnPaste
SPWwj Nov 1, 2024
355c953
Add chat panel
SPWwj Oct 30, 2024
aca198b
fix username not unique
SPWwj Oct 30, 2024
f4b4745
Fix resizeObserver
SPWwj Oct 31, 2024
742aa13
Add username to token
SPWwj Oct 31, 2024
eb7620b
Fix edit disabled
SPWwj Nov 1, 2024
c0c3fc2
Merge pull request #70 from CS3219-AY2425S1/collab-backend
SPWwj Nov 1, 2024
853a725
Merge branch 'main' into br-collab-fix
SPWwj Nov 1, 2024
005507a
Merge pull request #77 from SPWwj/br-collab-fix
SPWwj Nov 1, 2024
bfe99ed
Fix merge conflict
SPWwj Nov 1, 2024
556c2ce
Merge pull request #78 from SPWwj/main
SPWwj Nov 1, 2024
75964a9
skeleton yaml
rjkoh Nov 1, 2024
6873505
add kafka to dev dependencies
rjkoh Nov 1, 2024
09da01f
Merge pull request #79 from CS3219-AY2425S1/collab-backend
rjkoh Nov 1, 2024
71ba1a9
Merge branch 'main' into N8-KubernetesAutoScale
rjkoh Nov 1, 2024
815f7b5
remaining yaml
rjkoh Nov 1, 2024
bca615f
add script to run kubectl and add hpa files
rjkoh Nov 1, 2024
5848eb3
add docker username
rjkoh Nov 1, 2024
1b11523
Add reset password
njxue Nov 1, 2024
fe8c440
Add link to forgot password in login page
njxue Nov 1, 2024
c7fe0da
Merge branch 'main' into n2-user-question-history
Nephelite Nov 1, 2024
f22631d
Add End Collaboration Button
Nephelite Nov 1, 2024
55ad1ef
Propagate Match Details to Room Page
Nephelite Nov 1, 2024
b36edeb
Implement Question Retrieval in Room Page
Nephelite Nov 1, 2024
d16b0d7
Complete Attempt Saving and Updating
Nephelite Nov 1, 2024
b161602
Shift All History API Calls to UseCase Files
Nephelite Nov 1, 2024
b3ec91d
Add Code Viewing Components
Nephelite Nov 1, 2024
e10ef3b
Fix Routing Issues
Nephelite Nov 1, 2024
1cd8dd0
Fix Improper Error Catching and Incorrect Uniqueness Check
Nephelite Nov 2, 2024
43e37bc
Fix Incorrect API Calling Functions
Nephelite Nov 2, 2024
e9b16ec
Change Button Label
Nephelite Nov 2, 2024
4369820
Add email template and add email config file
njxue Nov 2, 2024
b779ab5
Use ejs and html file for templating
njxue Nov 2, 2024
90ae765
Clean up
njxue Nov 2, 2024
2bf6324
Simplify UserId Extraction
Nephelite Nov 2, 2024
ff0377f
Remove Temporary Code
Nephelite Nov 2, 2024
97f53e6
Add Chat
SPWwj Nov 2, 2024
0a18787
Prevent re-render chat
SPWwj Nov 2, 2024
04ca41b
Remove AI and MongoDb
SPWwj Nov 3, 2024
333c98c
Merge pull request #85 from SPWwj/br-n1
SPWwj Nov 3, 2024
66f8ceb
Merge pull request #84 from njxue/forgot-password
SPWwj Nov 3, 2024
f870bbe
Add setup bash file
SPWwj Nov 3, 2024
5b63b1e
Add bash file for setup
SPWwj Nov 3, 2024
2a52d5e
Merge pull request #86 from SPWwj/br-config
SPWwj Nov 3, 2024
e1733f1
Merge branch 'main' into n2-user-question-history
Nephelite Nov 3, 2024
ad47495
Merge pull request #73 from CS3219-AY2425S1/n2-user-question-history
Nephelite Nov 3, 2024
b318307
Fix Merge Conflict
Nephelite Nov 3, 2024
02446a3
Merge pull request #87 from CS3219-AY2425S1/Nephelite-patch-2
Nephelite Nov 3, 2024
c807128
Add Submit Button Functionality
Nephelite Nov 3, 2024
0ba9a76
Add Room Fetching Based on Rest
Nephelite Nov 3, 2024
93e0c52
Merge pull request #88 from CS3219-AY2425S1/submit-button
Nephelite Nov 3, 2024
1495bb1
Fix CORS Issue
Nephelite Nov 3, 2024
e923f8a
Fix duplicate username
njxue Nov 3, 2024
eac3c94
Fix bugs
njxue Nov 3, 2024
3426cbd
Merge branch 'room-fetching-rest' of https://github.com/CS3219-AY2425…
njxue Nov 3, 2024
df68358
Resolve conflicts
njxue Nov 3, 2024
5c5ba3d
Merge pull request #89 from CS3219-AY2425S1/room-fetching-rest
Nephelite Nov 3, 2024
0e06bd5
add test routes, update kafka connection, update resources
rjkoh Nov 4, 2024
8dff2b1
Merge branch 'main' into N8-KubernetesAutoScale
rjkoh Nov 4, 2024
9846cc7
add user-service listening
rjkoh Nov 4, 2024
e559115
fix user-service nodemailer import, get random question, fix matching…
rjkoh Nov 4, 2024
732c979
Merge pull request #90 from rjkoh/random-question
Nephelite Nov 5, 2024
61529dc
change nginx conf and docker-compose to service names
SilasTSL Nov 5, 2024
7667bcb
add proxy params for api-gateway
SilasTSL Nov 5, 2024
9c1d78f
Rename proxy_params
SilasTSL Nov 5, 2024
b1cb526
Update nginx to include map directive and change proxy_params path
SilasTSL Nov 5, 2024
55c0afa
Update docker-compose to use elastic ip
SilasTSL Nov 5, 2024
b857c18
Merge branch 'main' into ecs-deployment
SilasTSL Nov 5, 2024
4fa3040
Change nginx to not cut off trailing route requests
SilasTSL Nov 5, 2024
f6ca490
Make api and socket url dynamic on env
SilasTSL Nov 5, 2024
4c86c41
Merge pull request #91 from CS3219-AY2425S1/ecs-deployment
SPWwj Nov 5, 2024
90f7712
Use hosted chat at vercel and azure
SPWwj Nov 5, 2024
b7d31f4
Merge pull request #92 from SPWwj/br-use-hosted-chat
SPWwj Nov 5, 2024
7f7aa43
Add unit test
SPWwj Nov 5, 2024
f10b704
Merge pull request #93 from SPWwj/br-collab-test
SPWwj Nov 5, 2024
22f1e4c
Merge pull request #82 from rjkoh/N8-KubernetesAutoScale
SPWwj Nov 5, 2024
b939f15
change ws url in collaboration context to dynamic
SilasTSL Nov 6, 2024
95a8a9b
Change to not set frontend env variables from docker-compose
SilasTSL Nov 6, 2024
8669766
Implement Various UI Changes
Nephelite Nov 6, 2024
75b362f
Add On Unexpected Leave Code Saving
Nephelite Nov 6, 2024
e207858
Merge pull request #96 from CS3219-AY2425S1/ecs-deployment
SilasTSL Nov 6, 2024
9ae0f15
Merge pull request #94 from CS3219-AY2425S1/nephelite-patch-3
Nephelite Nov 6, 2024
6171c8f
Fix resize observer error
njxue Nov 6, 2024
a13ebed
Merge pull request #97 from njxue/fix-resize-observer
njxue Nov 6, 2024
579dc52
Fix redundant listen
njxue Nov 6, 2024
36a2255
Merge pull request #98 from njxue/fix-user-service-port
njxue Nov 6, 2024
3627798
Fix homep age layout issue and start.sh not overwrite .env
SPWwj Nov 6, 2024
2ff44fd
Merge pull request #99 from SPWwj/main
SPWwj Nov 6, 2024
62fd787
Merge pull request #95 from CS3219-AY2425S1/add-on-leave-saving-attempt
SPWwj Nov 6, 2024
016db3e
Resolve conflicts
njxue Nov 6, 2024
852cdc5
Fix containers from overflowing
njxue Nov 6, 2024
1129167
Fix overflowing username
njxue Nov 6, 2024
366d394
Merge pull request #83 from njxue/admin-user-controls
njxue Nov 6, 2024
bdc875a
Add jwt reset token to env.example
njxue Nov 6, 2024
d846c8c
Merge pull request #100 from njxue/user-service-jwt-env
njxue Nov 6, 2024
1ef8c00
Merge branch 'main' into nephelite-patch-3
Nephelite Nov 6, 2024
bdad8b0
Use verifyAccessToken instead of authenticateToken
njxue Nov 6, 2024
44e4390
Merge pull request #102 from njxue/history-403
Nephelite Nov 6, 2024
309580b
Add Default JWT Secret Strings
Nephelite Nov 6, 2024
df2a97a
Merge pull request #103 from CS3219-AY2425S1/main
Nephelite Nov 6, 2024
abf1cdf
Fix incorrect nginx route
Nephelite Nov 6, 2024
599990b
Merge pull request #104 from CS3219-AY2425S1/fix-nginx
Nephelite Nov 6, 2024
d5c32ff
Merge pull request #105 from CS3219-AY2425S1/main
Nephelite Nov 6, 2024
05569ac
Revert Attempt at Using ImperativeHandle
Nephelite Nov 6, 2024
cf0f017
Change Approach to Create Attempt on Entering Room
Nephelite Nov 6, 2024
985f6f6
Break text in output box to multiple lines
njxue Nov 7, 2024
38a3937
Merge pull request #106 from njxue/output-breakword
njxue Nov 7, 2024
3613e67
kubernetes validate false
rjkoh Nov 7, 2024
4552147
Merge pull request #107 from rjkoh/N8-KubernetesAutoScale
rjkoh Nov 7, 2024
bd308be
update instructions
rjkoh Nov 7, 2024
96f3d3d
update container naming
rjkoh Nov 7, 2024
2f21637
edit memory, add mongo kubernetes, edit readme and fix init-mongo
rjkoh Nov 7, 2024
2b9bcff
Merge pull request #108 from rjkoh/N8-KubernetesAutoScale
rjkoh Nov 7, 2024
513d361
add further instructions
rjkoh Nov 7, 2024
2ffd2ff
Merge pull request #109 from rjkoh/N8-KubernetesAutoScale
rjkoh Nov 7, 2024
2198396
Add gh actions for collab service
njxue Nov 9, 2024
7766089
Fix some eslint warnings
njxue Nov 9, 2024
24827fb
Add eslint to gh workflow
njxue Nov 9, 2024
155e50c
Run collab ci on pr
njxue Nov 9, 2024
119e2a3
Rename jobs
njxue Nov 9, 2024
2606618
Fix typo
njxue Nov 9, 2024
3689380
Merge pull request #111 from njxue/gh-actions
njxue Nov 9, 2024
fdae437
Add Room Expiry
Nephelite Nov 9, 2024
2d4f2be
Enforce Strict (userId, roomId) Uniqueness in HistoryEntries
Nephelite Nov 9, 2024
9b16f1a
Rename attemptCompletedAt field to lastSubmittedAttemptAt
Nephelite Nov 9, 2024
4ff8f4a
Merge pull request #112 from CS3219-AY2425S1/add-room-expiry
njxue Nov 9, 2024
4d6f6ec
Merge pull request #101 from CS3219-AY2425S1/nephelite-patch-3
njxue Nov 9, 2024
6f7737b
Add Authentication Check to Ensure only Matched Users can Enter a Room
Nephelite Nov 9, 2024
f0b78f9
Add Disabling of Rejoin Room if Room is Expired
Nephelite Nov 9, 2024
1bbb7d1
Add Question Description Modal in User History
Nephelite Nov 9, 2024
5fa2271
Add History Deletion on Question Deletion
Nephelite Nov 9, 2024
9fc3096
Move Responsibility of Checking Room Expiry to Question Service
Nephelite Nov 10, 2024
8f7d998
Resolve conflicts
njxue Nov 10, 2024
e940674
Merge pull request #116 from CS3219-AY2425S1/delete-history-entries-o…
njxue Nov 10, 2024
60dcd7d
Merge pull request #115 from CS3219-AY2425S1/add-question-description…
njxue Nov 10, 2024
b2a0969
Merge pull request #113 from CS3219-AY2425S1/room-fetch-authentication
njxue Nov 10, 2024
0c4a8f8
Resolve conflicts
njxue Nov 10, 2024
48fa42c
Merge branch 'main' into disable-rejoin-room-frontend
Nephelite Nov 10, 2024
dae472d
Merge pull request #114 from CS3219-AY2425S1/disable-rejoin-room-fron…
njxue Nov 10, 2024
9b24c18
Merge branch 'main' of https://github.com/CS3219-AY2425S1/cs3219-ay24…
njxue Nov 10, 2024
acc79b8
Merge pull request #117 from njxue/restructure-fe
njxue Nov 10, 2024
23e41d4
Fix Room Schema Mapping
Nephelite Nov 10, 2024
5421e89
Remove Comments
Nephelite Nov 10, 2024
a8d0d74
Merge pull request #118 from CS3219-AY2425S1/fix-incorrect-room-schema
Nephelite Nov 10, 2024
5748f64
Default user as admin on register
njxue Nov 12, 2024
90c93a9
Merge pull request #119 from njxue/default-admin-on-register
njxue Nov 12, 2024
cfb09f9
Fix auth
njxue Nov 12, 2024
63646a5
Merge pull request #120 from njxue/fix-auth
njxue Nov 12, 2024
9e9f2be
update kubernetes readme
rjkoh Nov 12, 2024
a09f6b0
Merge pull request #121 from rjkoh/main
rjkoh Nov 12, 2024
d309343
update kubernetes readme
rjkoh Nov 12, 2024
d28daa3
Merge pull request #122 from rjkoh/main
rjkoh Nov 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 18 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# If using mongoDB containerization, set to true. Else set to false (i.e local testing)
DB_REQUIRE_AUTH=true

# mongoDB auth variables
MONGO_USER=user
MONGO_PASSWORD=password
MONGO_INITDB_ROOT_USERNAME=admin # must match docker-compose.yml and init-mongo.js
MONGO_INITDB_ROOT_PASSWORD=password # must match docker-compose.yml and init-mongo.js

# mongoDB connection string variables
DB_HOST=localhost
DB_PORT=27017

# Service database names
PEERPREP_QUESTION_INITDB_NAME=peerprepQuestionServiceDB # must match question service .env file and init-mongo.js
PEERPREP_USER_INITDB_NAME=peerprepUserServiceDB # must match user service .env file and init-mongo.js
PEERPREP_MATCHING_INITDB_NAME=peerprepMatchingServiceDB # must match user service .env file and init-mongo.js
PEERPREP_COLLABORATION_INITDB_NAME=peerprepCollaborationServiceDB # must match collab service .env file and init-mongo.js
34 changes: 34 additions & 0 deletions .github/workflows/collab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Collaboration Service CI

on:
push:
branches:
- main
paths:
- "backend/collaboration-service/**"
pull_request:
branches:
- main
paths:
- "backend/collaboration-service/**"

jobs:
run-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"

- name: Install dependencies
run: npm ci
working-directory: backend/collaboration-service

- name: Run Tests
run: npm test
working-directory: backend/collaboration-service
34 changes: 34 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Frontend CI

on:
push:
branches:
- main
paths:
- "frontend/**"
pull_request:
branches:
- main
paths:
- "frontend/**"

jobs:
run-eslint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"

- name: Install dependencies
run: npm ci
working-directory: frontend

- name: Run ESLint
run: npm run lint
working-directory: frontend
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# General
node_modules/
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
.DS_Store
Thumbs.db
*.log
*.log.*
npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.http

# Backend
/backend/node_modules/
/backend/dist/
/backend/.env
/backend/*.log

# Docker database files
/data

# Production
/build
/dist

# Optional: Exclude specific files that might contain sensitive data or are specific to your IDE
/.vscode/
/.idea/
*.swp
*.swo

# Optional: MacOS and Windows system files
.AppleDouble
.LSOverride
Icon
._*
.Spotlight-V100
.Trashes
ehthumbs.db
/user-service/user-service/.env
/backend/user-service/.env
/frontend/.env
/addon/chat/Chatio/obj
/addon/chat/Chatio/Properties/PublishProfiles
/addon/chat/Chatio/Properties/ServiceDependencies/Chatiox - Web Deploy
/addon/chat/Chatio/.vs/Chatio
/addon/chat/Chatio/bin
/backend/collaboration-service/coverage
31 changes: 31 additions & 0 deletions MongoDockerGuide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Yo, this is Kevin/Nephelite and this file is an informal guide into using docker for MongoDB.

Set-up:
1. Install mongoDB (https://www.mongodb.com/docs/manual/installation/) and Docker (https://docs.docker.com/engine/install/)
2. Set up .env files (you can just rename the .env.example to .env). If you make any changes to the .env file in the root such
that it's different from .env.example, copy and paste the root .env into the other .env files in each microservice.
3. Ensure the .env variables match the docker-compose.yml and init-mongo.js files because apparently they can't read the .env files?
4. In the project root folder, run `docker-compose build --no-cache` to build the mongoDB service.
5. Run `docker-compose up -d` to initialize and run the mongoDB service (and everything else).

And everything should work in a bit. Give it a few seconds, maybe a minute at most, and everything should be up.
Note: The green ticks that appear are just for indicating that the start up is successful.
The databases might not be set up yet, even if the terminal claims everything is set up and running.

Stop running:
1. Run `docker-compose down -v` to stop the services.
2. If you want to do a full complete reset on the databases, delete the data folder with `rm -rf ./data/db`,
or just delete the data folder in the root directory manually if you despise the `rm -rf` command.

View databases:
1. Verify that you have access to `mongosh`. If you installed the latest mongoDB version, you *should* have it.
2. Run `docker exec -it <mongo container name> mongosh --host <DB host> -u <mongodb root user username> -p <mongodb root user password> --authenticationDatabase admin`. By the project's default values, the command will be `docker exec -it peerprep-mongo-container mongosh --host localhost -u admin -p password --authenticationDatabase admin`.
3. In the mongosh:
1. View all databases with `show dbs`.
2. Navigate into a database with `use <databaseName>`.
3. View all collections in the database with `show collections`.
4. Use `db.<collection name>.find().pretty()` to view all entries in the collection.

Another warning about viewing databases: If you immediately try to run `docker exec` after doing `docker-compose up -d`,
mongoDB will refuse the connection because it's still running setup operations from init-mongo.js.
Just wait for awhile before running the command again.
103 changes: 98 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,100 @@
# CS3219 Project (PeerPrep) - AY2425S1
## Group: Gxx
## Group: G25

### 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.
### Overview
This project follows a microservices architecture with the following services:
1. **Frontend** - Port `3000`
2. **User Service** - Port `3001`
3. **Question Service** - Port `3002`
4. **Matching Service** - Port `3003`
5. **Collaboration Service** - Port `3004`
6. **MongoDB** - Port `27017` (Database)
7. **Nginx API Gateway** - Port `80`
8. **Redis** - Port `6379`
9. **Zookeeper** - Port `2181`
10. **Kafka** - Port `9092`, Port `29092`
11. **Chat Service** (Located in addon/chat)

### Setting up the Project

### Running the Project with `start.sh`

A `start.sh` script is provided in the root directory to simplify setup. This script will start all services, check for any `.env.example` files, and create the required `.env` files if they don’t already exist.

To run the project, open a terminal in the `cs3219-ay2425s1-project-g25` directory and execute:

./start.sh

This script can be run on **Linux**, **macOS**, and **Windows** (with Git Bash or WSL). It will initialize all services and ensure the environment files are set up as needed.

Ensure the script has execute permissions. If needed, set them by running:

chmod +x start.sh


This will initialize all services and ensure the environment files are set up as needed. Note that running `start.sh` requires Git Bash, WSL, or a similar terminal environment capable of executing Bash scripts.

### Manual Setup
Copy and paste the .env.example files in each service. Rename them as .env files.
Files to do this in:
1. ./
2. /frontend
3. /backend/user-service
4. /backend/question-service
5. /backend/matching-service
6. /backend/collaboration-service

Then, run `node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"` twice to generate
your 2 JWT token secrets. For the first one, paste it into the JWT_ACCESS_TOKEN_SECRET variable of
the .env files in question-service and user-service. Then, copy the second into the
JWT_REFRESH_TOKEN_SECRET of the .env file in user-service.

Further note: The DB_CLOUD_URI .env variable in user-service doesn't need to be filled in. A local
database will be created in the mongoDB service.

Consult the readme files in each service if there are further configurations needed.

### Running the Project

To run the main services, execute the following command in the root directory:

`docker-compose up --build`

To run the chat service, navigate to the addon/chat directory and run:

`docker-compose up --build`

Once the containers are up:
- Frontend: [http://localhost:3000](http://localhost:3000)
- User Service: [http://localhost:3001](http://localhost:3001)
- Question Service: [http://localhost:3002](http://localhost:3002)
- Matching Service: [http://localhost:3003](http://localhost:3003)
- Collaboration Service: [http://localhost:3004](http://localhost:3004)
- MongoDB: [http://localhost:27017](http://localhost:27017)
- Nginx API Gateway: [http://localhost:80](http://localhost:80)
- Redis: [http://localhost:6379](http://localhost:6379)
- Zookeeper: [http://localhost:2181](http://localhost:2181)
- Kafka: [http://localhost:9092](http://localhost:9092)
- Chat Service: Available through the main application

Note that even after docker says that everything is up and running, there is a risk that they aren't when you load the frontend. Wait for the frontend logs to show up in the docker logs.
In this event, wait for about a minute before trying again. If that still doesn't work and there are network errors, try
rebuilding the services by running `docker-compose up --build` again.

### MongoDB Configuration

- MongoDB runs on port `27017` inside a container named `peerprep-mongo-container`.
- It is initialized with:
- **Username**: `admin`
- **Password**: `password`
- Data is persisted in the `./data/db` directory, and the `init-mongo.js` script initializes the database on startup.

### Nginx API Gateway

- Nginx runs on port `80` and acts as the API gateway for routing requests to the respective services.

### Kubernetes Auto Pod Scaling

All files for Kubernetes deployment and auto scaling of services can be found in the `/kubernetes/` folder.

Refer to the [README](/kubernetes/README.md) in the kubernetes folder for more information.
Binary file not shown.
Binary file not shown.
21 changes: 21 additions & 0 deletions addon/chat/Chatio/Chatio.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>ebee6fc2-2cd0-4bfd-8580-ad97b28e9c5c</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
<PackageReference Include="OpenAI" Version="2.0.0" />
<PackageReference Include="StackExchange.Redis" Version="2.8.16" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions addon/chat/Chatio/Chatio.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>http</ActiveDebugProfile>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
<NameOfLastUsedPublishProfile>C:\Users\Wwj\source\repos\project_ai\Chatio\Properties\PublishProfiles\Chatiox - Web Deploy.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
25 changes: 25 additions & 0 deletions addon/chat/Chatio/Chatio.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34723.18
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chatio", "Chatio.csproj", "{03BC4C39-81A2-4440-A442-2B93B0C68BFA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{03BC4C39-81A2-4440-A442-2B93B0C68BFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03BC4C39-81A2-4440-A442-2B93B0C68BFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03BC4C39-81A2-4440-A442-2B93B0C68BFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03BC4C39-81A2-4440-A442-2B93B0C68BFA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {73C44709-CDEF-4DF9-8E10-62DE730AA6DE}
EndGlobalSection
EndGlobal
7 changes: 7 additions & 0 deletions addon/chat/Chatio/Configurations/MongoDbSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Chatio.Configurations;

public class MongoDbSettings
{
public string ConnectionString { get; set; } = null!;
public string DatabaseName { get; set; } = null!;
}
13 changes: 13 additions & 0 deletions addon/chat/Chatio/Configurations/OpenAiSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Chatio.Configurations;

public class OpenAiSettings
{
public required string ApiKey { get; set; }
public required string DefaultChatModel { get; set; }
public required string DefaultEmbeddingModel { get; set; }
public double DefaultTemperature { get; set; }
public double DefaultTopP { get; set; }
public double DefaultFrequencyPenalty { get; set; }
public double DefaultPresencePenalty { get; set; }
public int DefaultMaxTokens { get; set; }
}
Loading