Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit e0c62de
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Tue Nov 12 15:23:44 2024 +0800

    asd

commit d3eb518
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Tue Nov 12 15:21:42 2024 +0800

    asd

commit 7555976
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Tue Nov 12 15:07:33 2024 +0800

    asd

commit 3657a9c
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Tue Nov 12 15:05:03 2024 +0800

    asd

commit 64e2651
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Tue Nov 12 15:00:01 2024 +0800

    asd

commit 4c405f4
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Tue Nov 12 14:57:22 2024 +0800

    asd

commit c4ccd11
Merge: e400a71 31a6bd1
Author: chiaryan <53717471+chiaryan@users.noreply.github.com>
Date:   Tue Nov 12 14:54:30 2024 +0800

    Merge branch 'staging' into browser-tests

commit e400a71
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Tue Nov 12 14:53:23 2024 +0800

    asd

commit e92e186
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Tue Nov 12 14:47:29 2024 +0800

    asd

commit 3a975ff
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Tue Nov 12 14:37:56 2024 +0800

    asd

commit 9663688
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Tue Nov 12 14:19:17 2024 +0800

    asd add browsers

commit b0b9fb5
Merge: bf9f160 f86888b
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Tue Nov 12 14:18:56 2024 +0800

    Merge branch 'browser-compatibility-tests' into browser-tests

commit 31a6bd1
Merge: 7d931ee 3fd5752
Author: Benjamin Soh Zikang <97374822+bensohh@users.noreply.github.com>
Date:   Tue Nov 12 10:20:13 2024 +0800

    Merge pull request #71 from CS3219-AY2425S1/titus/fix-local-storage-bug

    fix(frontend): 🐛 mount component before accessing local storage

commit 3fd5752
Merge: fdce97a 7d931ee
Author: Benjamin Soh Zikang <97374822+bensohh@users.noreply.github.com>
Date:   Mon Nov 11 12:40:38 2024 +0800

    Merge branch 'staging' into titus/fix-local-storage-bug

commit 7d931ee
Merge: 439b410 d75215c
Author: Benjamin Soh Zikang <97374822+bensohh@users.noreply.github.com>
Date:   Mon Nov 11 12:20:10 2024 +0800

    Merge pull request #70 from CS3219-AY2425S1/titus/add-message-queue

    feat: add message queue

commit bf9f160
Merge: 862051a 311be82
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Mon Nov 11 04:56:37 2024 +0800

    Merge branch 'browser-compatibility-tests' into browser-tests

commit 862051a
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 21:16:04 2024 +0800

    asd

commit f58f035
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 21:13:59 2024 +0800

    asd

commit c784496
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 21:00:52 2024 +0800

    asd

commit 2f97a34
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 20:45:26 2024 +0800

    asd

commit cccfa54
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 20:44:24 2024 +0800

    install pnpm

commit 3570555
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 20:32:56 2024 +0800

    asd

commit 45ebeb4
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 20:32:04 2024 +0800

    asd

commit f1e7e40
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 20:08:35 2024 +0800

    asd

commit f5b521a
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 20:08:03 2024 +0800

    asd

commit cc46721
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 13:47:37 2024 +0800

    asd

commit 9f1efaf
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 11:55:18 2024 +0800

    asd
    s

commit 6796083
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 11:32:00 2024 +0800

    asd

commit 5b79d8b
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 11:28:49 2024 +0800

    asd

commit 240c839
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 11:27:52 2024 +0800

    asd

commit 8958cb6
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 11:23:29 2024 +0800

    asd

commit ab4cc47
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sun Nov 10 11:22:05 2024 +0800

    try selenium test

commit 9656dec
Merge: 439b410 324463e
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Sat Nov 9 16:14:56 2024 +0800

    Merge branch 'commit-signalling-.dockerignore' into browser-tests

commit fdce97a
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Fri Nov 8 14:17:53 2024 +0800

    fix(videoPanel): :bug: default for undefined partnerId

    Include a check to validate if partnerID is not undefined

commit e5e41ce
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Thu Nov 7 14:07:00 2024 +0800

    fix(frontend): :bug: mounts component before accessing local storage

    Only access localStorage on the client side (in the browser) after the component has mounted.

commit d75215c
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Thu Nov 7 10:40:15 2024 +0800

    style(execution-service): :fire: remove commented code

    Revmoes the previous commented implementation of sending the submission to history service via REST API call.

commit fac4430
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Thu Nov 7 01:20:36 2024 +0800

    docs: update readme

commit 2b2bbd5
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Thu Nov 7 01:12:41 2024 +0800

    docs: update readme

commit 95a82dc
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Thu Nov 7 01:10:12 2024 +0800

    ci: update docker compose test

commit bf0c096
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Thu Nov 7 01:07:32 2024 +0800

    docs: update readme

commit b8e3004
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Thu Nov 7 00:54:53 2024 +0800

    docs: update readme

commit 8bd3d10
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Thu Nov 7 00:52:29 2024 +0800

    feat: update readme

commit fbd3a4d
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Thu Nov 7 00:45:09 2024 +0800

    feat: update log msg

commit 64a1bad
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Thu Nov 7 00:33:50 2024 +0800

    fix: update docker-compose

commit e48bc7e
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Wed Nov 6 23:17:41 2024 +0800

    feat: update docker compose

commit 8a0e046
Author: tituschewxj <tituschewxj@gmail.com>
Date:   Wed Nov 6 23:17:35 2024 +0800

    feat: implement rabbitmq msg queue

commit 324463e
Author: Ryan Chia <ryan_chia8@hotmail.com>
Date:   Wed Nov 6 01:33:41 2024 +0800

    branch name
  • Loading branch information
chiaryan committed Nov 12, 2024
1 parent f86888b commit 266971d
Show file tree
Hide file tree
Showing 23 changed files with 543 additions and 165 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up .env
env:
QUESTION_FIREBASE_CREDENTIAL_PATH: ${{ vars.QUESTION_SERVICE_FIREBASE_CREDENTIAL_PATH }}
Expand All @@ -30,7 +30,7 @@ jobs:
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 }}
Expand All @@ -41,8 +41,8 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
with:
go-version: "1.23.x"

- name: Install Go dependencies
run: |
Expand All @@ -51,7 +51,7 @@ jobs:
- 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'

Expand All @@ -66,11 +66,11 @@ jobs:
run: |
cd ./apps/frontend
cp .env.example .env
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '22'
node-version: "22"

- name: Install pnpm
run: npm i -g pnpm
Expand Down Expand Up @@ -227,17 +227,25 @@ jobs:
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
Expand Down
24 changes: 23 additions & 1 deletion apps/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ services:
- apps_network
volumes:
- ./history-service:/history-service

depends_on:
- rabbitmq

signalling-service:
build:
context: ./signalling-service
Expand All @@ -95,6 +97,8 @@ services:
volumes:
- ./execution-service:/execution-service
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- rabbitmq

redis:
image: redis:latest
Expand All @@ -104,6 +108,19 @@ services:
- 6379:6379
container_name: redis-container

rabbitmq:
image: rabbitmq:3-management
networks:
- apps_network
ports:
- 5672:5672 # Port for RabbitMQ message broker
- 15672:15672 # Port for RabbitMQ Management UI
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
volumes:
- rabbitmq_data:/var/lib/rabbitmq

python-sandbox:
build:
context: ./execution-service/execution/python
Expand All @@ -114,3 +131,8 @@ services:

networks:
apps_network:

volumes:
# Mounts a volume for RabbitMQ data persistence.
# This ensures that data is not lost when the container is restarted or removed.
rabbitmq_data:
2 changes: 2 additions & 0 deletions apps/execution-service/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ PORT=8083

# If you are NOT USING docker, use the below variables
# HISTORY_SERVICE_URL=http://localhost:8082/
# RABBITMQ_URL=amqp://guest:guest@localhost:5672/

# If you are USING docker, use the below variables
HISTORY_SERVICE_URL=http://history-service:8082/
RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672/
123 changes: 74 additions & 49 deletions apps/execution-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,32 @@ go run main.go

The server will be available at http://localhost:8083.

## Running the Application via Docker
### Setting up message queue with RabbitMQ

A message queue is used to pass submission results asynchronously from the execution-service to the history-service.

1. In order to do so, we can run the following command to set up a docker container for RabbitMQ:

```bash
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
```

2. Then we can run the execution-service:

```bash
go run main.go
```

3. We can run the history-service by changing our directory and running the same command:

```bash
cd ../history-service
go run main.go
```

To view more details on the RabbitMQ queue, we can go to `localhost:15672`, and login using `guest` as the username and password.

### Running the Application via Docker

To run the application via Docker, run the following command:

Expand Down Expand Up @@ -74,10 +99,10 @@ The following json format will be returned:

```json
[
{
"input":"hello",
"expected":"olleh"
}
{
"input": "hello",
"expected": "olleh"
}
]
```

Expand All @@ -98,16 +123,16 @@ The following json format will be returned:

```json
{
"visibleTestResults":[
"visibleTestResults": [
{
"input":"hello",
"expected":"olleh",
"actual":"olleh",
"passed":true,
"error":""
"input": "hello",
"expected": "olleh",
"actual": "olleh",
"passed": true,
"error": ""
}
],
"customTestResults":null
"customTestResults": null
}
```

Expand All @@ -127,29 +152,29 @@ The following json format will be returned:

```json
{
"visibleTestResults":[
"visibleTestResults": [
{
"input":"hello",
"expected":"olleh",
"actual":"olleh",
"passed":true,
"error":""
"input": "hello",
"expected": "olleh",
"actual": "olleh",
"passed": true,
"error": ""
}
],
"customTestResults":[
"customTestResults": [
{
"input":"Hannah",
"expected":"hannaH",
"actual":"hannaH",
"passed":true,
"error":""
"input": "Hannah",
"expected": "hannaH",
"actual": "hannaH",
"passed": true,
"error": ""
},
{
"input":"abcdefg",
"expected":"gfedcba",
"actual":"gfedcba",
"passed":true,
"error":""
"input": "abcdefg",
"expected": "gfedcba",
"actual": "gfedcba",
"passed": true,
"error": ""
}
]
}
Expand Down Expand Up @@ -178,40 +203,40 @@ The following json format will be returned:

```json
{
"visibleTestResults":[
"visibleTestResults": [
{
"input":"hello",
"expected":"olleh",
"actual":"olleh",
"passed":true,
"error":""
"input": "hello",
"expected": "olleh",
"actual": "olleh",
"passed": true,
"error": ""
}
],
"hiddenTestResults":{
"passed":2,
"total":2
"hiddenTestResults": {
"passed": 2,
"total": 2
},
"status":"Accepted"
"status": "Accepted"
}
```

If compilation error exists or any of the tests (visible and hidden) fails, status "Attempted" will be returned:

```json
{
"visibleTestResults":[
"visibleTestResults": [
{
"input":"hello",
"expected":"olleh",
"actual":"",
"passed":false,
"error":"Command execution failed: Traceback (most recent call last):\n File \"/tmp/4149249165.py\", line 2, in \u003cmodule\u003e\n prit(name[::-1])\n ^^^^\nNameError: name 'prit' is not defined. Did you mean: 'print'?\n: %!w(*exec.ExitError=\u0026{0x4000364678 []})"
"input": "hello",
"expected": "olleh",
"actual": "",
"passed": false,
"error": "Command execution failed: Traceback (most recent call last):\n File \"/tmp/4149249165.py\", line 2, in \u003cmodule\u003e\n prit(name[::-1])\n ^^^^\nNameError: name 'prit' is not defined. Did you mean: 'print'?\n: %!w(*exec.ExitError=\u0026{0x4000364678 []})"
}
],
"hiddenTestResults":{
"passed":0,
"total":2
"hiddenTestResults": {
"passed": 0,
"total": 2
},
"status":"Attempted"
"status": "Attempted"
}
```
1 change: 1 addition & 0 deletions apps/execution-service/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
github.com/rabbitmq/amqp091-go v1.10.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions apps/execution-service/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwA
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand Down
Loading

0 comments on commit 266971d

Please sign in to comment.