From 043f6ffc079dbbfc03467829c19ea5c5c721cbc1 Mon Sep 17 00:00:00 2001 From: "YIHSUEN\\Yi Hsuen" Date: Thu, 26 Oct 2023 22:46:02 +0800 Subject: [PATCH 1/4] Fix missing env variables in Docker Compose --- deployment/prod-dockerfiles/Dockerfile.frontend-prod | 1 - docker-compose.yml | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/deployment/prod-dockerfiles/Dockerfile.frontend-prod b/deployment/prod-dockerfiles/Dockerfile.frontend-prod index 7c305c02..a23eb2f9 100644 --- a/deployment/prod-dockerfiles/Dockerfile.frontend-prod +++ b/deployment/prod-dockerfiles/Dockerfile.frontend-prod @@ -23,7 +23,6 @@ RUN yarn prisma generate ARG NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG_ARG ENV NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG=$NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG_ARG -ENV NEXT_PUBLIC_GATEWAY_ADDRESS="http://api.codeparty.org:4000/" ENV NEXT_PUBLIC_HTTP_PROXY_GATEWAY_ADDRESS="http://api.codeparty.org:4000/" ENV NEXT_PUBLIC_WS_MATCH_PROXY_GATEWAY_ADDRESS="http://api.codeparty.org:4002/" ENV NEXT_PUBLIC_WS_COLLABORATION_PROXY_GATEWAY_ADDRESS="http://api.codeparty.org:4003/" diff --git a/docker-compose.yml b/docker-compose.yml index 614a6bec..215f3800 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -99,5 +99,7 @@ services: ports: - "3000:3000" environment: - NEXT_PUBLIC_GATEWAY_ADDRESS: "http://localhost:4000/" + NEXT_PUBLIC_HTTP_PROXY_GATEWAY_ADDRESS: "http://localhost:4000/" + NEXT_PUBLIC_WS_MATCH_PROXY_GATEWAY_ADDRESS: "http://localhost:4002/" + NEXT_PUBLIC_WS_COLLABORATION_PROXY_GATEWAY_ADDRESS: "http://localhost:4003/" NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG: ${NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG} From 38eefe3efa8cc473647bebb006cc07e0aeece476 Mon Sep 17 00:00:00 2001 From: "YIHSUEN\\Yi Hsuen" Date: Thu, 26 Oct 2023 22:57:53 +0800 Subject: [PATCH 2/4] Add HTTPS support and reconfigure ingress --- deployment/gke-prod-manifests/frontend-ingress.yaml | 13 +++++++++++++ deployment/gke-prod-manifests/frontend-service.yaml | 1 - .../gke-prod-manifests/gateway-deployment.yaml | 2 +- .../gke-prod-manifests/gateway-http-ingress.yaml | 13 +++++++++++++ deployment/gke-prod-manifests/gateway-service.yaml | 1 - .../gateway-wscollaboration-ingress.yaml | 13 +++++++++++++ .../gke-prod-manifests/gateway-wsmatch-ingress.yaml | 13 +++++++++++++ deployment/gke-prod-manifests/gke-managed-cert.yaml | 11 +++++++++++ .../prod-dockerfiles/Dockerfile.frontend-prod | 6 +++--- 9 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 deployment/gke-prod-manifests/frontend-ingress.yaml create mode 100644 deployment/gke-prod-manifests/gateway-http-ingress.yaml create mode 100644 deployment/gke-prod-manifests/gateway-wscollaboration-ingress.yaml create mode 100644 deployment/gke-prod-manifests/gateway-wsmatch-ingress.yaml create mode 100644 deployment/gke-prod-manifests/gke-managed-cert.yaml diff --git a/deployment/gke-prod-manifests/frontend-ingress.yaml b/deployment/gke-prod-manifests/frontend-ingress.yaml new file mode 100644 index 00000000..86a8e8a7 --- /dev/null +++ b/deployment/gke-prod-manifests/frontend-ingress.yaml @@ -0,0 +1,13 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: frontend-ingress + annotations: + networking.gke.io/managed-certificates: gke-managed-cert + kubernetes.io/ingress.class: "gce" +spec: + defaultBackend: + service: + name: frontend-service + port: + number: 3000 diff --git a/deployment/gke-prod-manifests/frontend-service.yaml b/deployment/gke-prod-manifests/frontend-service.yaml index 9f0ca682..a72a5a12 100644 --- a/deployment/gke-prod-manifests/frontend-service.yaml +++ b/deployment/gke-prod-manifests/frontend-service.yaml @@ -12,6 +12,5 @@ spec: targetPort: 3000 selector: io.kompose.service: frontend - type: LoadBalancer status: loadBalancer: {} diff --git a/deployment/gke-prod-manifests/gateway-deployment.yaml b/deployment/gke-prod-manifests/gateway-deployment.yaml index db1cf683..37d8493b 100644 --- a/deployment/gke-prod-manifests/gateway-deployment.yaml +++ b/deployment/gke-prod-manifests/gateway-deployment.yaml @@ -31,7 +31,7 @@ spec: - name: WS_COLLABORATION_PROXY_PORT value: "4003" - name: FRONTEND_ADDRESS - value: "http://www.codeparty.org:3000" + value: "https://www.codeparty.org" image: asia-southeast1-docker.pkg.dev/peerprep-group11-prod/codeparty-prod-images/gateway:latest name: gateway ports: diff --git a/deployment/gke-prod-manifests/gateway-http-ingress.yaml b/deployment/gke-prod-manifests/gateway-http-ingress.yaml new file mode 100644 index 00000000..2af19c15 --- /dev/null +++ b/deployment/gke-prod-manifests/gateway-http-ingress.yaml @@ -0,0 +1,13 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: gateway-http-ingress + annotations: + networking.gke.io/managed-certificates: gke-managed-cert + kubernetes.io/ingress.class: "gce" +spec: + defaultBackend: + service: + name: frontend-service + port: + number: 4000 diff --git a/deployment/gke-prod-manifests/gateway-service.yaml b/deployment/gke-prod-manifests/gateway-service.yaml index 519efc3f..64815258 100644 --- a/deployment/gke-prod-manifests/gateway-service.yaml +++ b/deployment/gke-prod-manifests/gateway-service.yaml @@ -18,6 +18,5 @@ spec: targetPort: 4003 selector: io.kompose.service: gateway - type: LoadBalancer status: loadBalancer: {} diff --git a/deployment/gke-prod-manifests/gateway-wscollaboration-ingress.yaml b/deployment/gke-prod-manifests/gateway-wscollaboration-ingress.yaml new file mode 100644 index 00000000..72714ddc --- /dev/null +++ b/deployment/gke-prod-manifests/gateway-wscollaboration-ingress.yaml @@ -0,0 +1,13 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: gateway-wscollaboration-ingress + annotations: + networking.gke.io/managed-certificates: gke-managed-cert + kubernetes.io/ingress.class: "gce" +spec: + defaultBackend: + service: + name: gateway-service + port: + number: 4003 diff --git a/deployment/gke-prod-manifests/gateway-wsmatch-ingress.yaml b/deployment/gke-prod-manifests/gateway-wsmatch-ingress.yaml new file mode 100644 index 00000000..3f6c2064 --- /dev/null +++ b/deployment/gke-prod-manifests/gateway-wsmatch-ingress.yaml @@ -0,0 +1,13 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: gateway-wsmatch-ingress + annotations: + networking.gke.io/managed-certificates: gke-managed-cert + kubernetes.io/ingress.class: "gce" +spec: + defaultBackend: + service: + name: gateway-service + port: + number: 4002 diff --git a/deployment/gke-prod-manifests/gke-managed-cert.yaml b/deployment/gke-prod-manifests/gke-managed-cert.yaml new file mode 100644 index 00000000..4390e533 --- /dev/null +++ b/deployment/gke-prod-manifests/gke-managed-cert.yaml @@ -0,0 +1,11 @@ +apiVersion: networking.gke.io/v1 +kind: ManagedCertificate +metadata: + name: gke-managed-cert +spec: + domains: + - codeparty.org + - www.codeparty.org + - api.codeparty.org + - wsmatch.codeparty.org + - wscollab.codeparty.org diff --git a/deployment/prod-dockerfiles/Dockerfile.frontend-prod b/deployment/prod-dockerfiles/Dockerfile.frontend-prod index a23eb2f9..d8e4826b 100644 --- a/deployment/prod-dockerfiles/Dockerfile.frontend-prod +++ b/deployment/prod-dockerfiles/Dockerfile.frontend-prod @@ -23,9 +23,9 @@ RUN yarn prisma generate ARG NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG_ARG ENV NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG=$NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG_ARG -ENV NEXT_PUBLIC_HTTP_PROXY_GATEWAY_ADDRESS="http://api.codeparty.org:4000/" -ENV NEXT_PUBLIC_WS_MATCH_PROXY_GATEWAY_ADDRESS="http://api.codeparty.org:4002/" -ENV NEXT_PUBLIC_WS_COLLABORATION_PROXY_GATEWAY_ADDRESS="http://api.codeparty.org:4003/" +ENV NEXT_PUBLIC_HTTP_PROXY_GATEWAY_ADDRESS="https://api.codeparty.org/" +ENV NEXT_PUBLIC_WS_MATCH_PROXY_GATEWAY_ADDRESS="https://wsmatch.codeparty.org" +ENV NEXT_PUBLIC_WS_COLLABORATION_PROXY_GATEWAY_ADDRESS="https://wscollab.codeparty.org" RUN yarn build From f87dbb8f8472c1ac91d0763267550b8045abfa40 Mon Sep 17 00:00:00 2001 From: "YIHSUEN\\Yi Hsuen" Date: Thu, 26 Oct 2023 23:41:27 +0800 Subject: [PATCH 3/4] Fix service name errors --- deployment/gke-prod-manifests/frontend-ingress.yaml | 2 +- deployment/gke-prod-manifests/gateway-http-ingress.yaml | 2 +- .../gke-prod-manifests/gateway-wscollaboration-ingress.yaml | 2 +- deployment/gke-prod-manifests/gateway-wsmatch-ingress.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deployment/gke-prod-manifests/frontend-ingress.yaml b/deployment/gke-prod-manifests/frontend-ingress.yaml index 86a8e8a7..c99b9e91 100644 --- a/deployment/gke-prod-manifests/frontend-ingress.yaml +++ b/deployment/gke-prod-manifests/frontend-ingress.yaml @@ -8,6 +8,6 @@ metadata: spec: defaultBackend: service: - name: frontend-service + name: frontend port: number: 3000 diff --git a/deployment/gke-prod-manifests/gateway-http-ingress.yaml b/deployment/gke-prod-manifests/gateway-http-ingress.yaml index 2af19c15..313b3edc 100644 --- a/deployment/gke-prod-manifests/gateway-http-ingress.yaml +++ b/deployment/gke-prod-manifests/gateway-http-ingress.yaml @@ -8,6 +8,6 @@ metadata: spec: defaultBackend: service: - name: frontend-service + name: frontend port: number: 4000 diff --git a/deployment/gke-prod-manifests/gateway-wscollaboration-ingress.yaml b/deployment/gke-prod-manifests/gateway-wscollaboration-ingress.yaml index 72714ddc..b3900773 100644 --- a/deployment/gke-prod-manifests/gateway-wscollaboration-ingress.yaml +++ b/deployment/gke-prod-manifests/gateway-wscollaboration-ingress.yaml @@ -8,6 +8,6 @@ metadata: spec: defaultBackend: service: - name: gateway-service + name: gateway port: number: 4003 diff --git a/deployment/gke-prod-manifests/gateway-wsmatch-ingress.yaml b/deployment/gke-prod-manifests/gateway-wsmatch-ingress.yaml index 3f6c2064..5aea8575 100644 --- a/deployment/gke-prod-manifests/gateway-wsmatch-ingress.yaml +++ b/deployment/gke-prod-manifests/gateway-wsmatch-ingress.yaml @@ -8,6 +8,6 @@ metadata: spec: defaultBackend: service: - name: gateway-service + name: gateway port: number: 4002 From 86ded76d71f617bf3d45ac1ca154de5fc2c579de Mon Sep 17 00:00:00 2001 From: "YIHSUEN\\Yi Hsuen" Date: Thu, 26 Oct 2023 23:43:23 +0800 Subject: [PATCH 4/4] Fix gateway being named frontend --- deployment/gke-prod-manifests/gateway-http-ingress.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/gke-prod-manifests/gateway-http-ingress.yaml b/deployment/gke-prod-manifests/gateway-http-ingress.yaml index 313b3edc..cb6434ae 100644 --- a/deployment/gke-prod-manifests/gateway-http-ingress.yaml +++ b/deployment/gke-prod-manifests/gateway-http-ingress.yaml @@ -8,6 +8,6 @@ metadata: spec: defaultBackend: service: - name: frontend + name: gateway port: number: 4000