Skip to content

Commit 2f9e91a

Browse files
committed
fix merge conflicts
2 parents c2aeb46 + 712b09b commit 2f9e91a

File tree

29 files changed

+1209
-156
lines changed

29 files changed

+1209
-156
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ jobs:
3030
- name: "Trigger Cloud Build"
3131
env: # have to use env here as cant use secrets in kubernetes for nextJS
3232
NEXT_PUBLIC_API_GATEWAY_URL: ${{ secrets.NEXT_PUBLIC_API_GATEWAY_URL }}
33+
NEXT_PUBLIC_GITHUB_CLIENT_ID: ${{ secrets.NEXT_PUBLIC_GITHUB_CLIENT_ID }}
3334
run: |
34-
gcloud builds submit --config cloudbuild.yaml --substitutions _NEXT_PUBLIC_API_GATEWAY_URL="$NEXT_PUBLIC_API_GATEWAY_URL"
35+
gcloud builds submit --config cloudbuild.yaml --substitutions _NEXT_PUBLIC_API_GATEWAY_URL="$NEXT_PUBLIC_API_GATEWAY_URL",_NEXT_PUBLIC_GITHUB_CLIENT_ID="$NEXT_PUBLIC_GITHUB_CLIENT_ID"

api-gateway/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ENV PORT=8001
3030

3131
COPY src ./src
3232
COPY tsconfig.json ./
33-
COPY .env.production ./
33+
# COPY .env.production ./
3434

3535
EXPOSE ${PORT}
3636

cloudbuild.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ steps:
1010
"asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest",
1111
"--build-arg",
1212
"NEXT_PUBLIC_API_GATEWAY_URL=${_NEXT_PUBLIC_API_GATEWAY_URL}",
13+
"--build-arg",
14+
"NEXT_PUBLIC_GITHUB_CLIENT_ID=${_NEXT_PUBLIC_GITHUB_CLIENT_ID}",
1315
"-f",
1416
"peerprep-fe/Dockerfile",
1517
"peerprep-fe",
@@ -63,6 +65,26 @@ steps:
6365
"asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/user-svc:latest",
6466
]
6567

68+
# Build and push api-gateway
69+
- name: "gcr.io/cloud-builders/docker"
70+
args:
71+
[
72+
"build",
73+
"-t",
74+
"asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/api-gateway:latest",
75+
"-f",
76+
"api-gateway/Dockerfile",
77+
"api-gateway",
78+
]
79+
80+
# Push the api-gateway image to Artifact Registry
81+
- name: "gcr.io/cloud-builders/docker"
82+
args:
83+
[
84+
"push",
85+
"asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/api-gateway:latest",
86+
]
87+
6688
# Step 2: Clean up and deploy to GKE
6789

6890
# Clean up before deploying peerprep-fe
@@ -104,6 +126,19 @@ steps:
104126
- --location=asia-southeast1
105127
- --cluster=cs3219-g11-peerprep-kubes
106128

129+
# Clean up before deploying api-gateway
130+
- name: "ubuntu"
131+
args: ["rm", "-rf", "output"]
132+
133+
# Deploy api-gateway to Google Kubernetes Engine (GKE)
134+
- name: "gcr.io/cloud-builders/gke-deploy"
135+
args:
136+
- run
137+
- --filename=k8s/api-gateway.yml
138+
- --image=asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/api-gateway:latest
139+
- --location=asia-southeast1
140+
- --cluster=cs3219-g11-peerprep-kubes
141+
107142
# Step 3: update the deployments with the new images
108143

109144
# Update the peerprep-fe deployment
@@ -139,8 +174,20 @@ steps:
139174
- "CLOUDSDK_COMPUTE_ZONE=asia-southeast1"
140175
- "CLOUDSDK_CONTAINER_CLUSTER=cs3219-g11-peerprep-kubes"
141176

177+
# Update the api-gateway deployment
178+
- name: "gcr.io/cloud-builders/kubectl"
179+
args:
180+
- "set"
181+
- "image"
182+
- "deployment/api-gateway"
183+
- "api-gateway=asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/api-gateway:latest"
184+
env:
185+
- "CLOUDSDK_COMPUTE_ZONE=asia-southeast1"
186+
- "CLOUDSDK_CONTAINER_CLUSTER=cs3219-g11-peerprep-kubes"
187+
142188
substitutions:
143189
_NEXT_PUBLIC_API_GATEWAY_URL: ""
190+
_NEXT_PUBLIC_GITHUB_CLIENT_ID: ""
144191

145192
options:
146193
dynamic_substitutions: true
@@ -149,3 +196,4 @@ images:
149196
- "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest"
150197
- "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest"
151198
- "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/user-svc:latest"
199+
- "asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/api-gateway:latest"

docker-compose.prod.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ services:
1414
context: ./peerprep-fe
1515
dockerfile: Dockerfile
1616
target: production
17+
volumes:
18+
- /app/node_modules
1719
ports:
1820
- "3000:3000"
1921
networks:
@@ -28,6 +30,8 @@ services:
2830
context: ./question-service
2931
dockerfile: Dockerfile
3032
target: production
33+
volumes:
34+
- /app/node_modules
3135
ports:
3236
- "4001:4001"
3337
networks:
@@ -42,6 +46,8 @@ services:
4246
context: ./user-service
4347
dockerfile: Dockerfile
4448
target: production
49+
volumes:
50+
- /usr/src/app/node_modules
4551
ports:
4652
- "3001:3001"
4753
networks:
@@ -56,8 +62,7 @@ services:
5662
dockerfile: Dockerfile
5763
target: production
5864
volumes:
59-
- ./matching-service:/app
60-
- ./matching-service/node_modules:/app/node_modules
65+
- /app/node_modules
6166
ports:
6267
- "5001:5001"
6368
networks:
@@ -81,6 +86,21 @@ services:
8186
env_file:
8287
- ./api-gateway/.env.production
8388

89+
session-service:
90+
image: asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/session-svc:latest
91+
build:
92+
context: ./session-service
93+
dockerfile: Dockerfile
94+
target: production
95+
volumes:
96+
- /app/node_modules
97+
ports:
98+
- "4444:4444"
99+
networks:
100+
- peerprep-network
101+
env_file:
102+
- ./session-service/.env.dev
103+
84104
networks:
85105
peerprep-network:
86106
driver: bridge

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
target: development
1616
volumes:
1717
- ./peerprep-fe:/app
18-
- ./peerprep-fe/node_modules:/app/node_modules
18+
- /app/node_modules
1919
ports:
2020
- "3000:3000"
2121
networks:
@@ -79,7 +79,7 @@ services:
7979
target: development
8080
volumes:
8181
- ./session-service:/app
82-
- ./session-service/node_modules:/app/node_modules
82+
- /app/node_modules
8383
ports:
8484
- "4444:4444"
8585
networks:

k8s/api-gateway.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: api-gateway
5+
labels:
6+
type: backend
7+
app: api-gateway
8+
spec:
9+
selector:
10+
matchLabels:
11+
type: backend
12+
app: api-gateway
13+
template:
14+
metadata:
15+
name: api-gateway
16+
labels:
17+
type: backend
18+
app: api-gateway
19+
spec:
20+
containers:
21+
- name: api-gateway
22+
image: asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/api-gateway:latest
23+
imagePullPolicy: Always
24+
resources:
25+
requests:
26+
cpu: "100m"
27+
memory: "128Mi"
28+
limits:
29+
cpu: "200m"
30+
memory: "256Mi"
31+
ports:
32+
- containerPort: 8001
33+
envFrom:
34+
- secretRef:
35+
name: api-gateway-config
36+
dnsPolicy: ClusterFirst
37+
---
38+
apiVersion: v1
39+
kind: Service
40+
metadata:
41+
name: api-gateway
42+
spec:
43+
type: LoadBalancer
44+
ports:
45+
- port: 8001
46+
targetPort: 8001
47+
selector:
48+
type: backend
49+
app: api-gateway
50+
---
51+
apiVersion: autoscaling/v2
52+
kind: HorizontalPodAutoscaler
53+
metadata:
54+
name: api-gateway
55+
spec:
56+
scaleTargetRef:
57+
apiVersion: apps/v1
58+
kind: Deployment
59+
name: api-gateway
60+
minReplicas: 1
61+
maxReplicas: 5
62+
metrics:
63+
- type: Resource
64+
resource:
65+
name: cpu
66+
target:
67+
type: Utilization
68+
averageUtilization: 80

k8s/peerprep-config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ metadata:
55
type: Opaque
66
stringData:
77
NEXT_PUBLIC_API_GATEWAY_URL: "${_NEXT_PUBLIC_API_GATEWAY_URL}"
8+
NEXT_PUBLIC_GITHUB_CLIENT_ID: "${_NEXT_PUBLIC_GITHUB_CLIENT_ID}"
89
# Removed individual service URLs as they are no longer needed

peerprep-fe/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ ENV PORT=3000
3131

3232
# Accept build argument
3333
ARG NEXT_PUBLIC_API_GATEWAY_URL
34+
ARG NEXT_PUBLIC_GITHUB_CLIENT_ID
3435

3536
# Set environment variable
3637
ENV NEXT_PUBLIC_API_GATEWAY_URL=$NEXT_PUBLIC_API_GATEWAY_URL
38+
ENV NEXT_PUBLIC_GITHUB_CLIENT_ID=$NEXT_PUBLIC_GITHUB_CLIENT_ID
3739

3840
COPY . .
3941
RUN pnpm build

peerprep-fe/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@monaco-editor/react": "^4.6.0",
15+
"@radix-ui/react-alert-dialog": "^1.1.2",
1516
"@radix-ui/react-checkbox": "^1.1.1",
1617
"@radix-ui/react-dialog": "^1.1.1",
1718
"@radix-ui/react-dropdown-menu": "^2.1.2",
@@ -21,6 +22,7 @@
2122
"@radix-ui/react-scroll-area": "^1.2.0",
2223
"@radix-ui/react-select": "^2.1.1",
2324
"@radix-ui/react-slot": "^1.1.0",
25+
"@radix-ui/react-toast": "^1.2.2",
2426
"@stomp/stompjs": "^7.0.0",
2527
"@types/js-cookie": "^3.0.6",
2628
"amqplib": "^0.10.4",

0 commit comments

Comments
 (0)