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

Create release 1.0.0 #232

Merged
merged 55 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
8167cac
Downsize prod CPU requests
yhtMinceraft1010X Oct 24, 2023
c1ff1fa
Re-arrange frontend dependencies
yhtMinceraft1010X Oct 25, 2023
ae0c485
Clear timeout in useEffect (#174)
chunweii Oct 26, 2023
0f81576
Fix gateway user verification (#186)
yhtMinceraft1010X Oct 26, 2023
36f73b0
Fix websocket proxying bug (#183)
yhtMinceraft1010X Oct 26, 2023
043f6ff
Fix missing env variables in Docker Compose
yhtMinceraft1010X Oct 26, 2023
38eefe3
Add HTTPS support and reconfigure ingress
yhtMinceraft1010X Oct 26, 2023
f87dbb8
Fix service name errors
yhtMinceraft1010X Oct 26, 2023
86ded76
Fix gateway being named frontend
yhtMinceraft1010X Oct 26, 2023
4b7f557
Merge branch 'prod' into master
yhtMinceraft1010X Oct 26, 2023
90af990
Add server-side search for question title and filtering by difficulty…
chunweii Oct 26, 2023
f3edc05
Remove unused FQDN from managed cert
yhtMinceraft1010X Oct 27, 2023
3ac8c2f
Add backend config to Gateway service
yhtMinceraft1010X Oct 27, 2023
548cde1
Fix CORS response headers
yhtMinceraft1010X Oct 27, 2023
50f08f2
Merge branch 'prod' into master
yhtMinceraft1010X Oct 27, 2023
f575671
Revert back to HTTP with loadbalancer services
yhtMinceraft1010X Oct 27, 2023
036f2e1
Remove backend config
yhtMinceraft1010X Oct 27, 2023
c641a3d
Revert "Revert back to HTTP with loadbalancer services"
yhtMinceraft1010X Oct 27, 2023
6629bbe
Add healthcheck on gateway
yhtMinceraft1010X Oct 27, 2023
b919b3a
Merge branch 'prod' into master
yhtMinceraft1010X Oct 27, 2023
53f9e88
Revert "Merge branch 'prod' into master"
yhtMinceraft1010X Oct 27, 2023
8d2cde1
Change Docker Compose to use production-style images (#196)
yhtMinceraft1010X Oct 28, 2023
539a5f9
Rearrange and standardise dependencies and scripts (#187)
yhtMinceraft1010X Oct 28, 2023
907d9dd
Rearrange swagger files and scripts (#204)
yhtMinceraft1010X Oct 28, 2023
4a52426
Remove unused dependencies (#205)
yhtMinceraft1010X Oct 28, 2023
fea6e03
Merge branch 'prod' into master
yhtMinceraft1010X Oct 28, 2023
0566969
Twilio video default mute and no video (#192)
chunweii Oct 30, 2023
9c36f62
standardize frameworks
ong6 Oct 30, 2023
700aada
Check if user is admin on frontend (#193)
chunweii Oct 30, 2023
e01b270
Add success condition to production workflow run (#209)
yhtMinceraft1010X Oct 31, 2023
b2f5b41
add useHistory hook
ong6 Oct 31, 2023
79d08bb
Merge branch 'master' of https://github.com/CS3219-AY2324S1/ay2324s1-…
ong6 Oct 31, 2023
e09d0c5
Display question and swap question in collaboration rooms (#185)
gycgabriel Oct 31, 2023
e78450b
Link user profile settings to backend (firebase and supabase) (#210)
chunweii Nov 1, 2023
19bb77d
handle more error cases for userHandler
ong6 Nov 2, 2023
f17ce45
delete dumps
ong6 Nov 2, 2023
dce34a7
Fix incorrect status code issue on frontend
chunweii Nov 2, 2023
b2e18f0
Fix deleting account
chunweii Nov 2, 2023
8afd057
remove redundant matching details
ong6 Nov 2, 2023
77f3f29
update find match logic
ong6 Nov 2, 2023
977599c
Remove stackdump file
yhtMinceraft1010X Nov 4, 2023
45d86a0
Question page Submit button (#228)
gycgabriel Nov 4, 2023
c10ce9a
Preferred code language to default to first item
gycgabriel Nov 4, 2023
583c3b4
Add documentation for setting/removing admins (#218)
yhtMinceraft1010X Nov 8, 2023
cf27637
Add environment variables and remove unused code (#229)
yhtMinceraft1010X Nov 8, 2023
0323b30
Fix match backend (#230)
chunweii Nov 10, 2023
3718b16
add preference update to interviews page
ong6 Nov 10, 2023
81a45b8
link up matching finding and added more error states
ong6 Nov 10, 2023
3e7d3d2
fixed room not loading questions bug
ong6 Nov 10, 2023
475ef8c
feat: sanitize question description and wrap pre tag
ckcherry23 Nov 10, 2023
47e2823
feat: remove console in code editor
ckcherry23 Nov 10, 2023
884054e
feat: show test cases in question description
ckcherry23 Nov 10, 2023
6fd9547
feat: add solution ui for questions/room
ckcherry23 Nov 10, 2023
c7db5f2
feat: add md support for question description
ckcherry23 Nov 10, 2023
2edefff
fix: make isLoading optional in difficulty selector
ckcherry23 Nov 11, 2023
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
6 changes: 5 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ jobs:

- name: Run linting
run: |
yarn workspace user-service lint
yarn workspace admin-service lint
yarn workspace collaboration-service lint
yarn workspace frontend lint
yarn workspace gateway lint
yarn workspace matching-service lint
yarn workspace question-service lint
yarn workspace user-service lint

- name: Run unit tests
run: |
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ env:
PRISMA_DATABASE_URL: ${{ secrets.PRISMA_DATABASE_URL_PROD }}
MONGO_ATLAS_URL: ${{ secrets.MONGO_ATLAS_URL_PROD }}
NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG: ${{ secrets.FRONTEND_FIREBASE_CONFIG_PROD }}
NEXT_PUBLIC_HTTP_PROXY_GATEWAY_ADDRESS: https://api.codeparty.org/
NEXT_PUBLIC_WS_MATCH_PROXY_GATEWAY_ADDRESS: https://wsmatch.codeparty.org
NEXT_PUBLIC_WS_COLLABORATION_PROXY_GATEWAY_ADDRESS: https://wscollab.codeparty.org
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }}
TWILIO_API_KEY: ${{ secrets.TWILIO_API_KEY }}
TWILIO_API_SECRET: ${{ secrets.TWILIO_API_SECRET }}
Expand All @@ -27,6 +30,7 @@ jobs:
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-latest
environment: production
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: 'read'
id-token: 'write'
Expand Down Expand Up @@ -116,8 +120,8 @@ jobs:
# Build the Docker images and push to Google Artifact Repository
- name: Build and push Docker images
run: |-
chmod u+x ./build-prod-images.sh
./build-prod-images.sh
chmod u+x ./build-export-prod-images.sh
./build-export-prod-images.sh
working-directory: ./deployment

# Deploy the Docker images to the GKE cluster
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ node_modules
.env.firebase_emulators_test
secrets/
yarn-error.log
bash.exe.stackdump
sh.exe.stackdump
75 changes: 56 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

Prerequisites for PeerPrep Monorepo:

1. **Yarn:** Ensure you have the latest version of Yarn installed. Yarn
1. **Yarn:** Ensure you have the latest version of Yarn installed. Yarn
Workspaces is available in Yarn v1.0 and later.
2. Installation (if not already installed):
2. Installation (if not already installed):

```bash
npm install -g yarn
```

3. **Node.js:** Check each application's documentation for the recommended
3. **Node.js:** Check each application's documentation for the recommended
Node.js version.
4. **Git (Optional but Recommended):**
5. **Docker (If deploying with Docker):**
6. **Kubernetes Tools (If deploying with Kubernetes):**
4. **Git (Optional but Recommended):**
5. **Docker (If deploying with Docker):**
6. **Kubernetes Tools (If deploying with Kubernetes):**

---

Expand Down Expand Up @@ -52,10 +52,19 @@ your services / frontend.
MONGO_ATLAS_URL=<redacted>
FIREBASE_SERVICE_ACCOUNT=<redacted>
NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG={"apiKey": <redacted>,"authDomain": <redacted>,"projectId": <redacted>,"storageBucket": <redacted>,"messagingSenderId": <redacted>,"appId": <redacted>}
TWILIO_ACCOUNT_SID=<redacted>
TWILIO_API_KEY=<redacted>
TWILIO_API_SECRET=<redacted>
```
Note: For `NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG`, the JSON should not have newlines since Next.js may not process it correctly.
The difference between it and `FIREBASE_SERVICE_ACCOUNT` are shown below:

1. **Installing secret detection hooks:** From the root directory, run:
| Variable | Purpose |
| -------- | ------- |
| FIREBASE_SERVICE_ACCOUNT | For backend verification and administrative tasks |
| NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG | For the frontend to connect to Firebase |

2. **Installing secret detection hooks:** From the root directory, run:
```bash
pip install pre-commit
pre-commit install
Expand All @@ -66,7 +75,7 @@ As a tip, if you think a file will eventually store secrets, immediately add it
it in case you forget later on when you have a lot more files to commit.


1. **Installing Dependencies:** From the root directory (`/peerprep`), run:
3. **Installing Dependencies:** From the root directory (`/peerprep`), run:

```bash
yarn install
Expand All @@ -83,27 +92,27 @@ it in case you forget later on when you have a lot more files to commit.
This command will install dependencies for all services and the frontend in a
centralized `node_modules` directory at the root.

1. **Adding Dependencies:** To add a dependency to a specific workspace (e.g.,
4. **Adding Dependencies:** To add a dependency to a specific workspace (e.g.,
`user-service`), use:

```bash
yarn workspace user-service add [dependency-name]
```

1. **Initializing Prisma:** In the root file, run the following:
5. **Initializing Prisma:** In the root file, run the following:

```bash
yarn prisma generate ## Do this whenever we change the models in schema.prisma
```

1. **Running Backend Scripts:** To run a script specific to a workspace (e.g.,
6. **Running Backend Scripts:** To run a script specific to a workspace (e.g.,
the `start` script for `user-service`), use:

```bash
yarn workspace user-service start
```

1. **Running Frontend Scripts:** To run the frontend cod, use:
7. **Running Frontend Scripts:** To run the frontend cod, use:

```bash
yarn workspace frontend dev ## For development
Expand All @@ -113,25 +122,53 @@ it in case you forget later on when you have a lot more files to commit.
yarn workspace frontend build ## For first time setup run the build command
yarn workspace frontend start ## For subsequent runs
```
8. **Running everything at once:** To run everything at once and still maintain the ability to hot-reload your changes, use:

```bash
./start-app-no-docker.sh # on mac /linus

# You can also use the above command on Windows with Git Bash

```

### Getting Started - Docker:
Docker and Docker Compose are used to set up a simulated production build (meaning that the Docker images and
containers that will be spun up locally are almost identical to those in the production environment, with the exception
of some environment variables).

1. **Run the start-app.sh script:** From the root repo, run
1. **Run yarn docker:build:** From the root repo, run

```bash
./start-app.sh # on mac / linus
yarn docker:build
```
This will create new Docker images.

# or
2. **Run yarn docker:devup:** From the root repo, run
```bash
yarn docker:devup
```
This will start all the containers.

start-app.sh # on windows
3. **Once done, run yarn docker:devdown:** From the root repo, run
```bash
yarn docker:devdown
```
This will stop and delete all the containers.

2. Made a change in code? To refresh containers, run
#### If you want to do all the above steps at once, see the below section

**Run the start-app-with-docker.sh script:** From the root repo, run

```bash
docker-compose up --force-recreate --build -d
docker image prune -f
./start-app-with-docker.sh # on mac / linus

# You can also use the above command on Windows with Git Bash
```
This will create new Docker images everytime it is run. Be careful of how much disk space you have left.

Any edits you make to the source code will not be automatically reflected on the site. We recommend using Docker
Compose to check if your changes are likely to work on the production environment once they have been proven to work
in your local development environment.

### Notes:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ service_array=("admin-service" "collaboration-service" "gateway" "matching-servi
for i in ${!service_array[@]}; do
docker build \
--tag $GKE_REGION-docker.pkg.dev/$PROJECT_ID/$ARTIFACT_REPOSITORY_NAME/${service_array[$i]}:latest \
--file prod-dockerfiles/Dockerfile.${service_array[$i]}-prod ..
--file prod-dockerfiles/Dockerfile.${service_array[$i]} ..
docker push $GKE_REGION-docker.pkg.dev/$PROJECT_ID/$ARTIFACT_REPOSITORY_NAME/${service_array[$i]}:latest
done

# Build and publish frontend prod image
docker build \
--build-arg="NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG_ARG=$NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG" \
--build-arg="NEXT_PUBLIC_HTTP_PROXY_GATEWAY_ADDRESS_ARG=$NEXT_PUBLIC_HTTP_PROXY_GATEWAY_ADDRESS" \
--build-arg="NEXT_PUBLIC_WS_MATCH_PROXY_GATEWAY_ADDRESS_ARG=$NEXT_PUBLIC_WS_MATCH_PROXY_GATEWAY_ADDRESS" \
--build-arg="NEXT_PUBLIC_WS_COLLABORATION_PROXY_GATEWAY_ADDRESS_ARG=$NEXT_PUBLIC_WS_COLLABORATION_PROXY_GATEWAY_ADDRESS" \
--tag $GKE_REGION-docker.pkg.dev/$PROJECT_ID/$ARTIFACT_REPOSITORY_NAME/frontend:latest \
--file prod-dockerfiles/Dockerfile.frontend-prod ..
--file prod-dockerfiles/Dockerfile.frontend ..
docker push $GKE_REGION-docker.pkg.dev/$PROJECT_ID/$ARTIFACT_REPOSITORY_NAME/frontend:latest
18 changes: 0 additions & 18 deletions deployment/dev-dockerfiles/Dockerfile.admin-service

This file was deleted.

22 changes: 0 additions & 22 deletions deployment/dev-dockerfiles/Dockerfile.collaboration-service

This file was deleted.

24 changes: 0 additions & 24 deletions deployment/dev-dockerfiles/Dockerfile.frontend

This file was deleted.

18 changes: 0 additions & 18 deletions deployment/dev-dockerfiles/Dockerfile.gateway

This file was deleted.

18 changes: 0 additions & 18 deletions deployment/dev-dockerfiles/Dockerfile.matching-service

This file was deleted.

18 changes: 0 additions & 18 deletions deployment/dev-dockerfiles/Dockerfile.question-service

This file was deleted.

18 changes: 0 additions & 18 deletions deployment/dev-dockerfiles/Dockerfile.user-service

This file was deleted.

5 changes: 0 additions & 5 deletions deployment/dev-dockerfiles/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
spec:
containers:
- env:
- name: FRONTEND_ADDRESS
value: "https://www.codeparty.org"
- name: PRISMA_DATABASE_URL
valueFrom:
secretKeyRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ spec:
spec:
containers:
- env:
- name: FRONTEND_ADDRESS
value: "https://www.codeparty.org"
- name: QUESTION_SERVICE_HOSTNAME
value: "question-service"
- name: PRISMA_DATABASE_URL
valueFrom:
secretKeyRef:
Expand Down
Loading