File tree Expand file tree Collapse file tree 9 files changed +103
-22
lines changed
Expand file tree Collapse file tree 9 files changed +103
-22
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ FROM node:18-alpine AS base
33
44# Install pnpm globally
55RUN npm install -g pnpm
6+ RUN npm install -g typescript
67
78# Set the working directory in the container
89WORKDIR /app
@@ -22,7 +23,6 @@ COPY tsconfig.json ./
2223
2324CMD ["pnpm" , "dev" ]
2425
25-
2626# Production stage
2727FROM base AS production
2828ENV NODE_ENV=production
@@ -33,4 +33,6 @@ COPY tsconfig.json ./
3333
3434EXPOSE ${PORT}
3535
36+ RUN pnpm build
37+
3638CMD ["pnpm" , "start" ]
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ app.use(express.json());
1717app . use ( cors ( ) ) ; // configured so any one can use
1818app . options ( '*' , cors ( ) ) ;
1919
20- // Health check route
20+ // Health check route, redeploy
2121app . get ( '/' , ( req , res ) => {
2222 res . status ( 200 ) . send ( 'OK' ) ;
2323} ) ;
Original file line number Diff line number Diff 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---
3547apiVersion : v1
3648kind : Service
3749metadata :
3850 name : api-gateway
51+ annotations :
52+ cloud.google.com/neg : ' {"ingress": true}'
3953spec :
4054 type : LoadBalancer
4155 ports :
Original file line number Diff line number Diff line change 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+ ---
110apiVersion : networking.k8s.io/v1
211kind : Ingress
312metadata :
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"
719spec :
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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -42,7 +42,13 @@ metadata:
4242spec :
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
Original file line number Diff line number Diff 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+
2227const httpServer = createServer ( app ) ;
2328const io = new Server ( httpServer , {
2429 cors : {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments