Skip to content

Commit 711beab

Browse files
committed
Merge branch 'main' of https://github.com/CS3219-AY2425S1/cs3219-ay2425s1-project-g11 into fix/audio-call
2 parents b896387 + df76946 commit 711beab

File tree

9 files changed

+103
-22
lines changed

9 files changed

+103
-22
lines changed

api-gateway/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM node:18-alpine AS base
33

44
# Install pnpm globally
55
RUN npm install -g pnpm
6+
RUN npm install -g typescript
67

78
# Set the working directory in the container
89
WORKDIR /app
@@ -22,7 +23,6 @@ COPY tsconfig.json ./
2223

2324
CMD ["pnpm", "dev"]
2425

25-
2626
# Production stage
2727
FROM base AS production
2828
ENV NODE_ENV=production
@@ -33,4 +33,6 @@ COPY tsconfig.json ./
3333

3434
EXPOSE ${PORT}
3535

36+
RUN pnpm build
37+
3638
CMD ["pnpm", "start"]

api-gateway/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"dev": "nodemon --exec ts-node src/app.ts",
8-
"start": "tsc && node dist/app.js",
8+
"start": "node dist/app.js",
99
"build": "tsc",
1010
"format": "prettier --write \"src/**/*.ts\"",
1111
"test": "echo \"Error: no test specified\" && exit 1",

api-gateway/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ app.use(express.json());
1717
app.use(cors()); // configured so any one can use
1818
app.options('*', cors());
1919

20-
// Health check route
20+
// Health check route, redeploy
2121
app.get('/', (req, res) => {
2222
res.status(200).send('OK');
2323
});

k8s/api-gateway.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,36 @@ spec:
2020
imagePullPolicy: Always
2121
resources:
2222
requests:
23-
cpu: "500m"
24-
memory: "512Mi"
23+
memory: "128Mi"
24+
cpu: "100m"
2525
limits:
26-
cpu: "1"
27-
memory: "1Gi"
26+
memory: "256Mi"
27+
cpu: "200m"
2828
ports:
2929
- containerPort: 8001
3030
envFrom:
3131
- secretRef:
3232
name: api-gateway-config
33+
livenessProbe: # Add this block for liveness probe
34+
httpGet:
35+
path: /
36+
port: 8001
37+
initialDelaySeconds: 10
38+
periodSeconds: 10
39+
readinessProbe: # Add this block for readiness probe
40+
httpGet:
41+
path: /
42+
port: 8001
43+
initialDelaySeconds: 5
44+
periodSeconds: 5
3345
dnsPolicy: ClusterFirst
3446
---
3547
apiVersion: v1
3648
kind: Service
3749
metadata:
3850
name: api-gateway
51+
annotations:
52+
cloud.google.com/neg: '{"ingress": true}'
3953
spec:
4054
type: LoadBalancer
4155
ports:

k8s/ingress.yml

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,61 @@
1+
apiVersion: networking.gke.io/v1beta1
2+
kind: FrontendConfig
3+
metadata:
4+
name: http-to-https
5+
spec:
6+
redirectToHttps:
7+
enabled: true
8+
responseCodeName: MOVED_PERMANENTLY_DEFAULT
9+
---
110
apiVersion: networking.k8s.io/v1
211
kind: Ingress
312
metadata:
4-
name: fe-ingress
13+
name: nginx-ingress-session
514
annotations:
6-
ingress.kubernetes.io/rewrite-target: /
15+
kubernetes.io/ingress.global-static-ip-name: nginx-api
16+
networking.gke.io/managed-certificates: peerprep-fe-cs3219-g11-nginx-all
17+
kubernetes.io/ingress.class: "gce"
18+
networking.gke.io/frontend-config: "http-to-https"
719
spec:
8-
tls:
9-
- hosts:
10-
- peerprep-interview.duckdns.org
11-
secretName: peerprep-config
20+
ingressClassName: "gce"
1221
rules:
13-
- host: peerprep-interview.duckdns.org
22+
- host: peerprep-fe.duckdns.org
1423
http:
15-
paths:
16-
- path: /
17-
pathType: Prefix
18-
backend:
19-
service:
24+
paths:
25+
- path: /*
26+
pathType: ImplementationSpecific
27+
backend:
28+
service:
2029
name: peerprep-fe
2130
port:
22-
number: 80
31+
number: 80
32+
- host: peerprep-api.duckdns.org
33+
http:
34+
paths:
35+
- path: /*
36+
pathType: ImplementationSpecific
37+
backend:
38+
service:
39+
name: api-gateway
40+
port:
41+
number: 8001
42+
- host: peerprep-session.duckdns.org
43+
http:
44+
paths:
45+
- path: /*
46+
pathType: ImplementationSpecific
47+
backend:
48+
service:
49+
name: session-svc
50+
port:
51+
number: 4444
52+
- host: peerprep-audio.duckdns.org
53+
http:
54+
paths:
55+
- path: /*
56+
pathType: ImplementationSpecific
57+
backend:
58+
service:
59+
name: session-svc
60+
port:
61+
number: 5555

k8s/managed-cert.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: networking.gke.io/v1
2+
kind: ManagedCertificate
3+
metadata:
4+
name: peerprep-fe-cs3219-g11-nginx-all
5+
spec:
6+
domains:
7+
- peerprep-mock-interview.duckdns.org
8+
- peerprep-api.duckdns.org
9+
- peerprep-session.duckdns.org
10+
- peerprep-audio.duckdns.org

k8s/peerprep-fe.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ metadata:
4242
spec:
4343
type: LoadBalancer
4444
ports:
45-
- port: 80
45+
- name: http
46+
protocol: TCP
47+
port: 80
48+
targetPort: 3000
49+
- name: https
50+
protocol: TCP
51+
port: 443
4652
targetPort: 3000
4753
selector:
4854
type: frontend

session-service/src/audio-service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ app.use(
1919
})
2020
);
2121

22+
// Health check route
23+
app.get('/', (req, res) => {
24+
res.status(200).send('OK');
25+
});
26+
2227
const httpServer = createServer(app);
2328
const io = new Server(httpServer, {
2429
cors: {

session-service/src/server.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ app.use(
2424
credentials: true,
2525
})
2626
);
27-
app.use(express.json()); //
27+
app.use(express.json());
28+
29+
// Health check route
30+
app.get('/', (req, res) => {
31+
res.status(200).send('OK');
32+
});
2833

2934
/**
3035
* Create an http server

0 commit comments

Comments
 (0)