Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
500 commits
Select commit Hold shift + click to select a range
9e6e5bc
Remove button from question title in question list page
bensohh Oct 24, 2024
0fe7a7c
feat: update models
tituschewxj Oct 24, 2024
06eeb1d
feat: validate not duplicate user
tituschewxj Oct 24, 2024
9d3bda7
Merge branch 'staging' into fix-timer
chiaryan Oct 24, 2024
f982120
Setup the template for collaboration editor page
bensohh Oct 24, 2024
5f10257
feat: update matching algorithm
tituschewxj Oct 24, 2024
7f767b0
fix json name
tituschewxj Oct 24, 2024
f285352
Add skeletal template for chat function and testcases
bensohh Oct 24, 2024
816f398
feat: add grpc proto files
tituschewxj Oct 24, 2024
ba57e31
chore: update go dependencies
tituschewxj Oct 24, 2024
c1f98ee
chore: clean up dependencies
tituschewxj Oct 24, 2024
6696635
fix: grpc server
tituschewxj Oct 24, 2024
0cd12f8
refactor: move to main.go
tituschewxj Oct 24, 2024
e9b5afe
Setup linkage with yjs codemirror and webrtc signalling server
bensohh Oct 25, 2024
f21e9c1
Create signalling service based on yjs example
bensohh Oct 25, 2024
d32a601
Lift form state to Modal, add retry button
chiaryan Oct 25, 2024
4b4f805
Merge branch 'fix-timer' into frontend-changes
chiaryan Oct 25, 2024
25e6b1e
fix: move timer activaition to form onFinish
chiaryan Oct 25, 2024
b023d6d
remove cancel button from 'joined' modal
chiaryan Oct 25, 2024
dbcdc69
feat: implement grpc client
tituschewxj Oct 25, 2024
8ba4883
chore: remove deprecated funcs
tituschewxj Oct 25, 2024
84ada41
Add auto-detection of language based on user input
bensohh Oct 25, 2024
922f336
feat: grpc client-server connection
tituschewxj Oct 25, 2024
a0d4d02
Reduce time before joining, set localstorage variables
bensohh Oct 25, 2024
e5acf02
Add configuration for other auto language detection and syntax highli…
bensohh Oct 25, 2024
c040b36
feat: improve logs
tituschewxj Oct 25, 2024
e98e0bd
feat: improve logs
tituschewxj Oct 25, 2024
a03dbb5
Add documentation for signalling server
bensohh Oct 25, 2024
cf1417d
feat: add client to server struct
tituschewxj Oct 25, 2024
b9050cc
feat: find random question
tituschewxj Oct 25, 2024
3c877c9
References added
bensohh Oct 25, 2024
edab9a6
feat: add stubs
tituschewxj Oct 25, 2024
1248651
refactor: findmachingquestion
tituschewxj Oct 25, 2024
7b37824
fix: complexity matching
tituschewxj Oct 25, 2024
16a2023
feat: return docrefid
tituschewxj Oct 25, 2024
fcd1bed
feat: update test file
tituschewxj Oct 25, 2024
7b5e880
Replace button to question in question table with plain Link
chiaryan Oct 25, 2024
125ce82
fix: proto dependency
tituschewxj Oct 25, 2024
c2ad342
feat: add simulation test
tituschewxj Oct 25, 2024
8aabda6
fix: remove h1
tituschewxj Oct 25, 2024
47eb5f0
fix: margin
tituschewxj Oct 25, 2024
2ff03c3
chore: move proto files into individual services
tituschewxj Oct 25, 2024
f268332
feat: update docker and env
tituschewxj Oct 25, 2024
bb50c9b
Merge pull request #49 from CS3219-AY2425S1/titus/matching-service-im…
tituschewxj Oct 26, 2024
e58e4af
fix: return error if unable to lock
tituschewxj Oct 26, 2024
0f16864
Merge pull request #50 from CS3219-AY2425S1/titus/question-matching
solomonng2001 Oct 26, 2024
71a2ce1
Merge pull request #52 from CS3219-AY2425S1/ben/collaboration-page
solomonng2001 Oct 26, 2024
8f5318f
Add collaboration fetch question
solomonng2001 Oct 26, 2024
290094b
Remove comments
solomonng2001 Oct 26, 2024
bb2b215
Merge pull request #54 from CS3219-AY2425S1/solomon/collaboration-fet…
bensohh Oct 26, 2024
68023da
Implement session timer using localstorage
bensohh Oct 27, 2024
77ff847
Add modal component on top of end session
bensohh Oct 27, 2024
5943995
Implement authentication blocked pages using middleware
chiaryan Oct 27, 2024
9f804b1
Add history service and frontend code submission
solomonng2001 Oct 27, 2024
b1fa2ec
Add Dockerise history service and update readme and environment example
solomonng2001 Oct 27, 2024
5d0c765
Merge branch 'staging' into solomon/code-execute
solomonng2001 Oct 27, 2024
8928086
Update test.yml and add history-service and firebase for history-service
solomonng2001 Oct 27, 2024
0aa84e3
Update test.yml
solomonng2001 Oct 27, 2024
0693873
Update test.yml
solomonng2001 Oct 27, 2024
e5b7293
Update test.yml
solomonng2001 Oct 27, 2024
56dd8e6
Update test.yml
solomonng2001 Oct 27, 2024
aadd46c
Update test.yml
solomonng2001 Oct 27, 2024
63dd460
Update test.yml
solomonng2001 Oct 28, 2024
f50b89a
Update test.yml
solomonng2001 Oct 28, 2024
81c4e36
Update test.yml
solomonng2001 Oct 28, 2024
6ad4bff
Update test.yml
solomonng2001 Oct 28, 2024
b3bc499
Update test.yml
solomonng2001 Oct 28, 2024
49dbd3c
Update test.yml
solomonng2001 Oct 28, 2024
0bde1d1
Update test.yml
solomonng2001 Oct 28, 2024
ae4f691
Update test.yml
solomonng2001 Oct 28, 2024
3ee517c
Change connected user status to fetch using provider awareness
bensohh Oct 28, 2024
5a51c70
clean up unused imports
chiaryan Oct 28, 2024
81a09c5
Update test.yml
solomonng2001 Oct 28, 2024
cab2b2c
Update test.yml
solomonng2001 Oct 28, 2024
cf36fca
remove client-side redirects
chiaryan Oct 28, 2024
de59434
Merge branch 'staging' into ryan/auth-guard
chiaryan Oct 28, 2024
b6a32db
Implement end collaboration session for both users, fix minor bugs wi…
bensohh Oct 28, 2024
5be7f3c
Minor UI adjustment for modal
bensohh Oct 28, 2024
3502e42
Sync submission across webrtc and update history-service routing
solomonng2001 Oct 28, 2024
ba383ad
Merge pull request #55 from CS3219-AY2425S1/solomon/code-execute
solomonng2001 Oct 28, 2024
5f284c8
Merge branch 'staging' into ben/misc-collab
bensohh Oct 29, 2024
1fc5c9f
Fix commented providerRef error
bensohh Oct 29, 2024
09708e1
Add dockerfile and remove immediate redirect upon closing collab editor
bensohh Oct 29, 2024
b70f478
Update docker-compose.yml to include signalling server
bensohh Oct 29, 2024
5fdbaa8
Replace providerRef with outer ref reference and update test.yml
bensohh Oct 29, 2024
02b9a80
Merge pull request #57 from CS3219-AY2425S1/ben/misc-collab
bensohh Oct 29, 2024
6f8952f
Fix code saved message appearing on end session
solomonng2001 Oct 29, 2024
af68728
merge
chiaryan Oct 30, 2024
7bced3b
Merge branch 'staging' into frontend-changes2
chiaryan Oct 30, 2024
f558075
Remove cancel, join button from Found UI
chiaryan Oct 30, 2024
de92010
feat: update backend routes
tituschewxj Oct 30, 2024
6772a30
delete cookie by setting expiry to 0
chiaryan Oct 30, 2024
1475c05
Merge pull request #56 from CS3219-AY2425S1/ryan/auth-guard
chiaryan Oct 30, 2024
483525f
setup jest
chiaryan Nov 1, 2024
53016e1
update action
chiaryan Nov 1, 2024
365616a
add trigger workflow-dispatch
chiaryan Nov 1, 2024
0d77bfe
asd
chiaryan Nov 1, 2024
ac09202
asd
chiaryan Nov 1, 2024
06b839c
asd
chiaryan Nov 1, 2024
1d0f6fe
asd
chiaryan Nov 1, 2024
fe78391
Merge branch 'staging' into titus/history-service
tituschewxj Nov 1, 2024
54ad800
asd
chiaryan Nov 1, 2024
415161e
asd2
chiaryan Nov 1, 2024
8b054f7
asd
chiaryan Nov 1, 2024
62a72a9
asd
chiaryan Nov 1, 2024
b23580a
Add code execution service
solomonng2001 Nov 1, 2024
aa8be69
Add .env.example
solomonng2001 Nov 1, 2024
a1232e7
Add api test cases and api usage examples
solomonng2001 Nov 1, 2024
0427229
Merge pull request #58 from CS3219-AY2425S1/solomon/fix-code-saved-me…
bensohh Nov 1, 2024
547a2a1
unit testing for question api functions
chiaryan Nov 2, 2024
ed871a9
Merge branch 'staging' into frontend-unit-test
chiaryan Nov 2, 2024
97d6b6c
mock getToken for question.test.ts
chiaryan Nov 2, 2024
c7a72bf
Add accepted or attempted status and dockerise
solomonng2001 Nov 2, 2024
2e99740
Merge branch 'staging' into solomon/code-execute
solomonng2001 Nov 2, 2024
7994e7f
Update test.yml
solomonng2001 Nov 2, 2024
a23a7b4
add unit test for utils/encode
chiaryan Nov 2, 2024
435765a
Add testing workflow part 1..
chiaryan Nov 2, 2024
5a8f8ff
asd
chiaryan Nov 2, 2024
8eb66f4
feat: update frontend for question page
tituschewxj Nov 2, 2024
00497c6
Create VideoPanel component
bensohh Nov 3, 2024
1fc36fa
Integrate videopanel into existing collab page
bensohh Nov 3, 2024
0e5ee2e
Swap chat template to video panel and edit styling
bensohh Nov 3, 2024
a3e02a2
Add some minor comments
bensohh Nov 3, 2024
81b48c9
Update dependencies
bensohh Nov 3, 2024
8b7fa39
Implement end session due to inactivity that triggers after 15s
bensohh Nov 3, 2024
3528c9d
Clear timeout when user end before auto trigger
bensohh Nov 3, 2024
9574769
Change default language to python for code editor
bensohh Nov 3, 2024
31579dc
Comment out isvalidtoken check for docker to run properly
bensohh Nov 3, 2024
4a89600
feat: use codemirror editor
tituschewxj Nov 3, 2024
3b810cf
fix: add token expire check and comment out backend token check request
tituschewxj Nov 3, 2024
5484438
feat; update history service model
tituschewxj Nov 3, 2024
4297c31
feat: fetch from backend for a submission
tituschewxj Nov 3, 2024
d3d5b05
Link frontend code execution to execution service and sync across mat…
solomonng2001 Nov 3, 2024
f32dd72
Update submission and execution logic
solomonng2001 Nov 3, 2024
fdb4c1a
add "unit test" for ReadQuestion
chiaryan Nov 3, 2024
ca7864d
Update README APIs
solomonng2001 Nov 3, 2024
d047aa1
add test for not found
chiaryan Nov 3, 2024
ba541a5
update workflow to add credentials
chiaryan Nov 3, 2024
3d66e85
fix: use historyDocRefId
tituschewxj Nov 3, 2024
89577e4
asd
chiaryan Nov 3, 2024
07131a8
asd2
chiaryan Nov 3, 2024
f1a0e36
asd3
chiaryan Nov 3, 2024
0208df5
asd3
chiaryan Nov 3, 2024
77b8d46
asd4
chiaryan Nov 3, 2024
221d737
remove file
chiaryan Nov 3, 2024
259e462
feat: clickable row entries
tituschewxj Nov 3, 2024
657a29d
feat: modify create so that history is always created
tituschewxj Nov 3, 2024
75a5c35
Merge branch 'frontend-unit-test' into n11-unit-tests
chiaryan Nov 3, 2024
da6001d
fix test.yml
chiaryan Nov 3, 2024
1ae0f5b
feat: order by created at desc
tituschewxj Nov 3, 2024
a3bcb12
fix: swap matched user and user on frontend for specific submission
tituschewxj Nov 3, 2024
4015266
fix: backend history sorting
tituschewxj Nov 3, 2024
36d7b07
feat: implement pagination for histories on question page
tituschewxj Nov 3, 2024
fb89725
fix: heights of submission editor
tituschewxj Nov 3, 2024
a488d26
fix: disable editor
tituschewxj Nov 3, 2024
1d5a38d
fix: other user query
tituschewxj Nov 3, 2024
b1dd96c
feat: add history page
tituschewxj Nov 3, 2024
76ce6c7
fix: pagination
tituschewxj Nov 3, 2024
4c4ada9
feat: remove buttons in match found modal
tituschewxj Nov 3, 2024
d00edf0
feat: remove cancel button in match found modal
tituschewxj Nov 3, 2024
f79896f
Add sandbox for python execution (to be debugged)
solomonng2001 Nov 4, 2024
bcd29d3
merge n11
chiaryan Nov 4, 2024
8dd1799
Add back go test in workflow
chiaryan Nov 4, 2024
0d2a3bc
Merge pull request #65 from CS3219-AY2425S1/n11-unit-tests
chiaryan Nov 4, 2024
e28bf0f
Add end call function, ammend styling and fix bugs
bensohh Nov 4, 2024
e6e1df0
Update lockfile
bensohh Nov 4, 2024
e0192bc
Upgrate lockfile version to v9
bensohh Nov 4, 2024
f0f13ec
Merge branch 'staging' into ben/n1-communication
bensohh Nov 4, 2024
521ac4a
Merge pull request #64 from CS3219-AY2425S1/ben/n1-communication
bensohh Nov 4, 2024
1bffd5c
Merge branch 'staging' into titus/history-service
tituschewxj Nov 4, 2024
1716efa
Dockerise execution of python code
solomonng2001 Nov 4, 2024
48d6745
Merge pull request #60 from CS3219-AY2425S1/titus/history-service
solomonng2001 Nov 4, 2024
3ff07c4
Merge branch 'staging' into frontend-changes2
chiaryan Nov 4, 2024
f77bbfa
Merge pull request #59 from CS3219-AY2425S1/frontend-changes2
bensohh Nov 4, 2024
dd90eaf
Resolve merge conflicts and additional fixes
solomonng2001 Nov 4, 2024
fdd7a13
Update test.yml
solomonng2001 Nov 5, 2024
b5324e2
update test.yml
solomonng2001 Nov 5, 2024
70c52bd
Update optional population of tests
solomonng2001 Nov 5, 2024
66be207
Update test.yml
solomonng2001 Nov 5, 2024
eab5a68
Fix populate bug
solomonng2001 Nov 5, 2024
911ff0f
move decode_test to tests folder
chiaryan Nov 5, 2024
3396c29
Merge pull request #62 from CS3219-AY2425S1/solomon/code-execute
solomonng2001 Nov 5, 2024
4c58547
feat: add test cases to question service
tituschewxj Nov 5, 2024
324463e
branch name
chiaryan Nov 5, 2024
eb946d7
fix: implement check to ensure correct user shows up in matchedUser f…
tituschewxj Nov 6, 2024
b236251
feat: add loading to submission
tituschewxj Nov 6, 2024
afaef67
feat: adjust padding
tituschewxj Nov 6, 2024
a81e280
feat: adjust css
tituschewxj Nov 6, 2024
8a0e046
feat: implement rabbitmq msg queue
tituschewxj Nov 6, 2024
e48bc7e
feat: update docker compose
tituschewxj Nov 6, 2024
64a1bad
fix: update docker-compose
tituschewxj Nov 6, 2024
fbd3a4d
feat: update log msg
tituschewxj Nov 6, 2024
8bd3d10
feat: update readme
tituschewxj Nov 6, 2024
b8e3004
docs: update readme
tituschewxj Nov 6, 2024
bf0c096
docs: update readme
tituschewxj Nov 6, 2024
95a82dc
ci: update docker compose test
tituschewxj Nov 6, 2024
2b2bbd5
docs: update readme
tituschewxj Nov 6, 2024
fac4430
docs: update readme
tituschewxj Nov 6, 2024
d75215c
style(execution-service): :fire: remove commented code
tituschewxj Nov 7, 2024
e5e41ce
fix(frontend): :bug: mounts component before accessing local storage
tituschewxj Nov 7, 2024
1bde600
Fix python sandbox container not found
solomonng2001 Nov 7, 2024
fdce97a
fix(videoPanel): :bug: default for undefined partnerId
tituschewxj Nov 8, 2024
ee60055
Merge pull request #72 from CS3219-AY2425S1/solomon/fix-python-sandbo…
solomonng2001 Nov 9, 2024
b4e499d
Ammend styling issues with question page
bensohh Nov 9, 2024
439b410
Merge pull request #68 from CS3219-AY2425S1/titus/add-test-cases-to-q…
tituschewxj Nov 9, 2024
9656dec
Merge branch 'commit-signalling-.dockerignore' into browser-tests
chiaryan Nov 9, 2024
ab4cc47
try selenium test
chiaryan Nov 10, 2024
8958cb6
asd
chiaryan Nov 10, 2024
240c839
asd
chiaryan Nov 10, 2024
5b79d8b
asd
chiaryan Nov 10, 2024
6796083
asd
chiaryan Nov 10, 2024
9f1efaf
asd
chiaryan Nov 10, 2024
cc46721
asd
chiaryan Nov 10, 2024
f5b521a
asd
chiaryan Nov 10, 2024
f1e7e40
asd
chiaryan Nov 10, 2024
45ebeb4
asd
chiaryan Nov 10, 2024
3570555
asd
chiaryan Nov 10, 2024
cccfa54
install pnpm
chiaryan Nov 10, 2024
2f97a34
asd
chiaryan Nov 10, 2024
c784496
asd
chiaryan Nov 10, 2024
f58f035
asd
chiaryan Nov 10, 2024
862051a
asd
chiaryan Nov 10, 2024
311be82
set up browser tests for Chrome
chiaryan Nov 10, 2024
bf9f160
Merge branch 'browser-compatibility-tests' into browser-tests
chiaryan Nov 10, 2024
f86888b
Increase timeout for browser tests, verbosify jest
chiaryan Nov 10, 2024
7d931ee
Merge pull request #70 from CS3219-AY2425S1/titus/add-message-queue
bensohh Nov 11, 2024
3fd5752
Merge branch 'staging' into titus/fix-local-storage-bug
bensohh Nov 11, 2024
31a6bd1
Merge pull request #71 from CS3219-AY2425S1/titus/fix-local-storage-bug
bensohh Nov 12, 2024
b0b9fb5
Merge branch 'browser-compatibility-tests' into browser-tests
chiaryan Nov 12, 2024
9663688
asd add browsers
chiaryan Nov 12, 2024
3a975ff
asd
chiaryan Nov 12, 2024
e92e186
asd
chiaryan Nov 12, 2024
e400a71
asd
chiaryan Nov 12, 2024
c4ccd11
Merge branch 'staging' into browser-tests
chiaryan Nov 12, 2024
4c405f4
asd
chiaryan Nov 12, 2024
64e2651
asd
chiaryan Nov 12, 2024
3657a9c
asd
chiaryan Nov 12, 2024
7555976
asd
chiaryan Nov 12, 2024
d3eb518
asd
chiaryan Nov 12, 2024
e0c62de
asd
chiaryan Nov 12, 2024
266971d
Squashed commit of the following:
chiaryan Nov 12, 2024
d3ad549
quit driver only if present
chiaryan Nov 12, 2024
8f9d98a
Merge branch 'browser-compatibility-tests' into browser-tests
chiaryan Nov 12, 2024
e3a384e
asd
chiaryan Nov 12, 2024
5dbc8a0
asd
chiaryan Nov 12, 2024
77f62db
Squashed commit of the following:
chiaryan Nov 12, 2024
f1e3deb
Merge branch 'browser-compatibility-tests' into browser-tests
chiaryan Nov 12, 2024
974caa6
asad
chiaryan Nov 12, 2024
1add73d
asd
chiaryan Nov 12, 2024
196329a
remove webdriver working workflow
chiaryan Nov 12, 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
Empty file added .github/.keep
Empty file.
251 changes: 251 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
name: Run Tests

on:
push:
branches:
- main
- staging
- frontend-websocket-test
pull_request:
branches:
- main
- staging
workflow_dispatch:

jobs:
question-service-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up .env
env:
QUESTION_FIREBASE_CREDENTIAL_PATH: ${{ vars.QUESTION_SERVICE_FIREBASE_CREDENTIAL_PATH }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
EXECUTION_SERVICE_URL: ${{ vars.EXECUTION_SERVICE_URL }}
run: |
cd ./apps/question-service
echo "FIREBASE_CREDENTIAL_PATH=$QUESTION_FIREBASE_CREDENTIAL_PATH" >> .env
echo "JWT_SECRET=$JWT_SECRET" >> .env
echo "EXECUTION_SERVICE_URL=$EXECUTION_SERVICE_URL" >> .env

- name: Set up credentials
env:
QUESTION_FIREBASE_JSON: ${{ secrets.QUESTION_SERVICE_FIREBASE_CREDENTIAL }}
QUESTION_FIREBASE_CREDENTIAL_PATH: ${{ vars.QUESTION_SERVICE_FIREBASE_CREDENTIAL_PATH }}
run: |
cd ./apps/question-service
echo "$QUESTION_FIREBASE_JSON" > "./$QUESTION_FIREBASE_CREDENTIAL_PATH"

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23.x"

- name: Install Go dependencies
run: |
cd ./apps/question-service
go mod tidy

- name: Install firebase tools
run: curl -sL firebase.tools | bash

- name: Run Go tests with Firebase emulator
run: firebase emulators:exec --only firestore 'cd ./apps/question-service; go test -v ./tests'

frontend-unit-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup .env
run: |
cd ./apps/frontend
cp .env.example .env

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "22"

- name: Install pnpm
run: npm i -g pnpm

- name: Install dependencies
run: |
cd ./apps/frontend
pnpm i

- name: Run tests
run: |
cd ./apps/frontend
pnpm unit-test

test-docker-compose:
runs-on: ubuntu-latest

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

- name: Set up Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Create Environment Files
env:
QUESTION_SERVICE_URL: ${{ vars.QUESTION_SERVICE_URL }}
USER_SERVICE_URL: ${{ vars.USER_SERVICE_URL }}
MATCHING_SERVICE_URL: ${{ vars.MATCHING_SERVICE_URL }}
HISTORY_SERVICE_URL: ${{ vars.HISTORY_SERVICE_URL }}
SIGNALLING_SERVICE_URL: ${{ vars.SIGNALLING_SERVICE_URL }}
EXECUTION_SERVICE_URL: ${{ vars.EXECUTION_SERVICE_URL }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
QUESTION_FIREBASE_CREDENTIAL_PATH: ${{ vars.QUESTION_SERVICE_FIREBASE_CREDENTIAL_PATH }}
HISTORY_FIREBASE_CREDENTIAL_PATH: ${{ vars.HISTORY_SERVICE_FIREBASE_CREDENTIAL_PATH }}
EXECUTION_FIREBASE_CREDENTIAL_PATH: ${{ vars.EXECUTION_SERVICE_FIREBASE_CREDENTIAL_PATH }}
DB_CLOUD_URI: ${{ secrets.USER_SERVICE_DB_CLOUD_URI }}
USER_SERVICE_PORT: ${{ vars.USER_SERVICE_PORT }}
MATCHING_SERVICE_PORT: ${{ vars.MATCHING_SERVICE_PORT }}
HISTORY_SERVICE_PORT: ${{ vars.HISTORY_SERVICE_PORT }}
SIGNALLING_SERVICE_PORT: ${{ vars.SIGNALLING_SERVICE_PORT }}
EXECUTION_SERVICE_PORT: ${{ vars.EXECUTION_SERVICE_PORT }}
MATCHING_SERVICE_TIMEOUT: ${{ vars.MATCHING_SERVICE_TIMEOUT }}
REDIS_URL: ${{ vars.REDIS_URL }}
QUESTION_SERVICE_GRPC_URL: ${{ vars.QUESTION_SERVICE_GPRC_URL }}
run: |
cd ./apps/frontend
echo "NEXT_PUBLIC_QUESTION_SERVICE_URL=$QUESTION_SERVICE_URL" >> .env
echo "NEXT_PUBLIC_USER_SERVICE_URL=$USER_SERVICE_URL" >> .env
echo "NEXT_PUBLIC_MATCHING_SERVICE_URL=$MATCHING_SERVICE_URL" >> .env
echo "NEXT_PUBLIC_HISTORY_SERVICE_URL=$HISTORY_SERVICE_URL" >> .env
echo "NEXT_PUBLIC_SIGNALLING_SERVICE_URL=$SIGNALLING_SERVICE_URL" >> .env
echo "NEXT_PUBLIC_EXECUTION_SERVICE_URL=EXECUTION_SERVICE_URL" >> .env

cd ../question-service
echo "FIREBASE_CREDENTIAL_PATH=$QUESTION_FIREBASE_CREDENTIAL_PATH" >> .env
echo "JWT_SECRET=$JWT_SECRET" >> .env
echo "EXECUTION_SERVICE_URL=$EXECUTION_SERVICE_URL" >> .env

cd ../user-service
echo "DB_CLOUD_URI=$DB_CLOUD_URI" >> .env
echo "PORT=$USER_SERVICE_PORT" >> .env
echo "JWT_SECRET=$JWT_SECRET" >> .env

cd ../matching-service
echo "PORT=$MATCHING_SERVICE_PORT" >> .env
echo "MATCH_TIMEOUT=$MATCHING_SERVICE_TIMEOUT" >> .env
echo "JWT_SECRET=$JWT_SECRET" >> .env
echo "REDIS_URL=$REDIS_URL" >> .env
echo "QUESTION_SERVICE_GRPC_URL=$QUESTION_SERVICE_GRPC_URL" >> .env

cd ../history-service
echo "FIREBASE_CREDENTIAL_PATH=$HISTORY_FIREBASE_CREDENTIAL_PATH" >> .env
echo "PORT=$HISTORY_SERVICE_PORT" >> .env

cd ../execution-service
echo "FIREBASE_CREDENTIAL_PATH=$EXECUTION_FIREBASE_CREDENTIAL_PATH" >> .env
echo "PORT=$EXECUTION_SERVICE_PORT" >> .env
echo "HISTORY_SERVICE_URL=$HISTORY_SERVICE_URL" >> .env

cd ../signalling-service
echo "PORT=$SIGNALLING_SERVICE_PORT" >> .env

- name: Create Database Credential Files
env:
QUESTION_FIREBASE_JSON: ${{ secrets.QUESTION_SERVICE_FIREBASE_CREDENTIAL }}
QUESTION_FIREBASE_CREDENTIAL_PATH: ${{ vars.QUESTION_SERVICE_FIREBASE_CREDENTIAL_PATH }}
HISTORY_FIREBASE_JSON: ${{ secrets.HISTORY_SERVICE_FIREBASE_CREDENTIAL }}
HISTORY_FIREBASE_CREDENTIAL_PATH: ${{ vars.HISTORY_SERVICE_FIREBASE_CREDENTIAL_PATH }}
EXECUTION_FIREBASE_JSON: ${{ secrets.EXECUTION_SERVICE_FIREBASE_CREDENTIAL }}
EXECUTION_FIREBASE_CREDENTIAL_PATH: ${{ vars.EXECUTION_SERVICE_FIREBASE_CREDENTIAL_PATH }}
run: |
cd ./apps/question-service
echo "$QUESTION_FIREBASE_JSON" > "./$QUESTION_FIREBASE_CREDENTIAL_PATH"

cd ../history-service
echo "$HISTORY_FIREBASE_JSON" > "./$HISTORY_FIREBASE_CREDENTIAL_PATH"

cd ../execution-service
echo "$EXECUTION_FIREBASE_JSON" > "./$EXECUTION_FIREBASE_CREDENTIAL_PATH"

- name: Build and Run Services
run: |
cd ./apps
docker-compose up --build -d

- name: Wait for services to be ready
run: sleep 30

- name: Install websocat
run: |
sudo wget -qO /usr/local/bin/websocat https://github.com/vi/websocat/releases/latest/download/websocat.x86_64-unknown-linux-musl
sudo chmod a+x /usr/local/bin/websocat
websocat --version

- name: Run Tests
env:
FRONTEND_URL: ${{ vars.FRONTEND_URL }}
USER_SERVICE_URL: ${{ vars.USER_SERVICE_URL }}
QUESTION_SERVICE_URL: ${{ vars.QUESTION_SERVICE_URL }}
MATCHING_SERVICE_URL: ${{ vars.MATCHING_SERVICE_URL }}
HISTORY_SERVICE_URL: ${{ vars.HISTORY_SERVICE_URL }}
SIGNALLING_SERVICE_URL: ${{ vars.SIGNALLING_SERVICE_URL }}
EXECUTION_SERVICE_URL: ${{ vars.EXECUTION_SERVICE_URL }}
run: |
echo "Testing Question Service..."
curl -sSL -o /dev/null $QUESTION_SERVICE_URL && echo "Question Service is up"
echo "Testing User Service..."
curl -fsSL -o /dev/null $USER_SERVICE_URL && echo "User Service is up"
echo "Testing Frontend..."
curl -fsSL -o /dev/null $FRONTEND_URL && echo "Frontend is up"
echo "Testing History Service..."
curl -fsSL -o /dev/null $HISTORY_SERVICE_URL && echo "History Service is up"
echo "Testing Execution Service..."
curl -fsSL -o /dev/null $EXECUTION_SERVICE_URL && echo "Execution Service is up"
echo "Testing Matching Service..."
if ! (echo "Hello" | websocat $MATCHING_SERVICE_URL); then
echo "WebSocket for Matching Service is not live"
else
echo "WebSocket for Matching Service is live"
fi
# Add in test for matching service in the future
echo "Testing Signalling Service..."
if ! (echo "Hello" | websocat $SIGNALLING_SERVICE_URL); then
echo "WebSocket for Signalling Service is not live"
else
echo "WebSocket for Signalling Service is live"
fi
# We can add more tests here

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.1.4

- name: Install dependencies
run: |
cd ./apps/frontend
pnpm i

- name: Install Chrome WebDriver
uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: '130.0.6723.116'
- name: Install Edge
uses: browser-actions/setup-edge@v1
with:
edge-version: stable

- name: Install Geckodriver
uses: browser-actions/setup-geckodriver@latest

- name: Run Browser Test
run: |
cd ./apps/frontend
pnpm browser-test
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apps/question-service/.next/
apps/question-service/next-env.d.ts
apps/question-service/node_modules/
services/question-service/cs3219-g24-firebase-adminsdk-9cm7h-b1675603ab.json

14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[![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

### 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.
## Group: G24

### 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.
110 changes: 110 additions & 0 deletions apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# PeerPrep Docker Compose Guide

This project uses Docker Compose to manage multiple services such as a frontend, backend, and a database. The configuration is defined in the `docker-compose.yml` file, and environment variables can be stored in environment files for different environments (e.g., development, production).

## Prerequisites

Before you begin, ensure you have the following installed on your machine:

- [Docker](https://www.docker.com/get-started)
- [Docker Compose](https://docs.docker.com/compose/install/)

## Project Structure

In the `./apps` directory:

```plaintext
.
├── docker-compose.yml # Docker Compose configuration
├── README.md # Project documentation (for docker compose)
├── .env # Global environment variables (optional)
├── frontend
│ ├── Dockerfile # Dockerfile for frontend
│ └── ... (other frontend files)
├── matching-service
│ ├── Dockerfile # Dockerfile for matching-service
│ └── ... (other matching-service files)
├── question-service
│ ├── Dockerfile # Dockerfile for question-service
│ └── ... (other question-service files)
├── user-service
│ ├── Dockerfile # Dockerfile for user-service
│ └── ... (other user-service files)

```

## Docker Compose Setup

By using multiple Dockerfiles in Docker Compose, we can manage complex multi-container applications where each service has its own environment and build process.

1. Build and Start the Application

To build and run both the frontend and backend services, you can change your directory to the `./apps` directory and run:

```bash
docker-compose up --build
```

This will:

- Build the Docker images for all services using the specified Dockerfiles
- Start the containers and map the defined ports

2. Access the Application

Once running, you can access:

- The **frontend** at http://localhost:3000
- The **user service** at http://localhost:3001
- The **question service** at http://localhost:8080 (REST) and http://localhost:50051 (gRPC)
- The **matching service** at http://localhost:8081
- The **redis service** at http://localhost:6379

3. Stopping Services

To stop the running services, run:

```bash
docker-compose down
```

This command will stop and remove the containers, networks, and volumes created by docker-compose up.

## Troubleshooting

### Common Issues

- **Port Conflicts**: If you encounter port conflicts, ensure the host ports specified in docker-compose.yml (e.g., 3000:3000) are not in use by other applications.
- **Environment Variables Not Loaded**: Ensure the `.env` files are in the correct directories as found in the `docker-compose.yml` file.

### Known Issues

- **Mongo DB Connection Failing**: The user service fails to connect to the Mongo DB server on NUS Wi-Fi. To resolve this we have to use another network.

### Logs

You can view the logs for each service using the following command:

```bash
docker-compose logs
```

### Useful Commands

Rebuild a specific service:

```bash
docker-compose build <service_name>
```

Start services in detached mode (run in the background):

```bash
docker-compose up -d
```

Remove all containers, networks, and volumes created by Docker Compose:

```bash
docker-compose down --volumes
```
Loading