From d2a4639007b4cb1b8d799bbcfee23d968a4e214a Mon Sep 17 00:00:00 2001 From: dingo Date: Thu, 23 Apr 2026 06:28:55 -0400 Subject: [PATCH] feat(website): add k8s deployment, service, ingress rules and CI for SOR.Website MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - deployment-website.yaml + service-website.yaml: new ClusterIP deployment for sor-website image; injects only the three secrets it needs (Postgres, Redis, Cdn__PublicBaseUrl) — no NATS or ENABLED_SERVICES - ingress.yaml: add TLS + rules for aeternalisgames.com and www.aeternalisgames.com pointing to sor-website service - appsettings.json: remove localhost ConnectionStrings (dev defaults already live in appsettings.Development.json; prod values come from k8s secrets) - build-push.yml: build and push sor-website image from Dockerfile.website - build-push-client.yml: add paths filter so Godot export only runs on Client/** changes; add --network host to docker build Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .gitea/workflows/build-push-client.yml | 5 ++++- .gitea/workflows/build-push.yml | 8 ++++++++ Server/src/SOR.Website/appsettings.json | 4 ---- deploy/k8s/deployment-website.yaml | 15 +++++++++++++- deploy/k8s/ingress.yaml | 27 +++++++++++++++++++------ deploy/k8s/service-website.yaml | 4 ++-- 6 files changed, 49 insertions(+), 14 deletions(-) diff --git a/.gitea/workflows/build-push-client.yml b/.gitea/workflows/build-push-client.yml index c322c43..2f9f8d4 100644 --- a/.gitea/workflows/build-push-client.yml +++ b/.gitea/workflows/build-push-client.yml @@ -3,6 +3,9 @@ name: Build & Push Web Client on: push: branches: [main] + paths: + - "Client/**" + - ".gitea/workflows/build-push-client.yml" env: REGISTRY: registry.aeternalisgames.com @@ -38,7 +41,7 @@ jobs: run: | set -euo pipefail SHA='${{ steps.tag.outputs.SHA }}' - docker build -f Client/origin-client/Dockerfile.web \ + docker build --network host -f Client/origin-client/Dockerfile.web \ -t "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-client:${SHA}" \ -t "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-client:latest" \ Client/origin-client diff --git a/.gitea/workflows/build-push.yml b/.gitea/workflows/build-push.yml index 2ea87f4..d21bac9 100644 --- a/.gitea/workflows/build-push.yml +++ b/.gitea/workflows/build-push.yml @@ -78,8 +78,16 @@ jobs: -t "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-admin:latest" \ Server + docker build --network host -f Server/Dockerfile.website \ + -t "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-website:${SHA}" \ + -t "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-website:latest" \ + Server + docker push "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-server:${SHA}" docker push "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-server:latest" docker push "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-admin:${SHA}" docker push "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-admin:latest" + + docker push "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-website:${SHA}" + docker push "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-website:latest" diff --git a/Server/src/SOR.Website/appsettings.json b/Server/src/SOR.Website/appsettings.json index d5c0055..0db8e12 100644 --- a/Server/src/SOR.Website/appsettings.json +++ b/Server/src/SOR.Website/appsettings.json @@ -14,10 +14,6 @@ ], "Enrich": [ "FromLogContext" ] }, - "ConnectionStrings": { - "Default": "Host=localhost;Port=5432;Database=sor;Username=sor;Password=sor", - "Redis": "localhost:6379" - }, "Cdn": { "PublicBaseUrl": "https://cdn.aeternalisgames.com" }, diff --git a/deploy/k8s/deployment-website.yaml b/deploy/k8s/deployment-website.yaml index 48e26dc..69d125f 100644 --- a/deploy/k8s/deployment-website.yaml +++ b/deploy/k8s/deployment-website.yaml @@ -24,33 +24,43 @@ spec: containers: - name: sor-website - image: registry.aeternalisgames.com/sor/sor-server:latest + image: registry.aeternalisgames.com/sor/sor-website:latest ports: - containerPort: 8080 + # ── Shared non-secret config ─────────────────────────────────────── + # Only ASPNETCORE_URLS and ASPNETCORE_ENVIRONMENT are relevant here. + # WebSocket/NATS/Gateway keys from sor-config are ignored by SOR.Website. envFrom: - configMapRef: name: sor-config + # ── Website-specific secrets ─────────────────────────────────────── env: + # Postgres — Identity schema (account login/register) and Catalog + # (card/deck data displayed on the website). - name: ConnectionStrings__Default valueFrom: secretKeyRef: name: sor-app-secrets key: ConnectionStrings__Default + # Redis — stores DataProtection keys so all pod replicas can decrypt + # each other's __Host-sor-web-session cookies. - name: ConnectionStrings__Redis valueFrom: secretKeyRef: name: redis-credentials key: connection-string + # CDN — public base URL used in page templates to build asset URLs. - name: Cdn__PublicBaseUrl valueFrom: secretKeyRef: name: sor-app-secrets key: Cdn__PublicBaseUrl + # ── Health checks ────────────────────────────────────────────────── livenessProbe: httpGet: path: /health @@ -69,6 +79,9 @@ spec: timeoutSeconds: 3 failureThreshold: 3 + # ── Resources ───────────────────────────────────────────────────── + # Razor Pages with no background workers — light CPU, moderate memory + # for EF Core query compilation cache. resources: requests: cpu: "100m" diff --git a/deploy/k8s/ingress.yaml b/deploy/k8s/ingress.yaml index 5eb3148..1963c92 100644 --- a/deploy/k8s/ingress.yaml +++ b/deploy/k8s/ingress.yaml @@ -26,6 +26,15 @@ spec: ingressClassName: nginx tls: + # aeternalisgames.com — public game website. + # cert-manager will auto-provision this cert on first deployment. + # TODO: ensure DNS A/AAAA records for aeternalisgames.com and www.aeternalisgames.com + # point to your ingress IP. + - hosts: + - aeternalisgames.com + - www.aeternalisgames.com + secretName: website-tls + # hub.aeternalisgames.com — game server + WebSocket gateway. # hub-tls already exists in this namespace (your existing Let's Encrypt cert). - hosts: @@ -39,11 +48,6 @@ spec: - control.aeternalisgames.com secretName: control-tls - # aeternalisgames.com — public website. - - hosts: - - aeternalisgames.com - secretName: website-tls - rules: # ── Public website ───────────────────────────────────────────────────────── - host: aeternalisgames.com @@ -55,7 +59,18 @@ spec: service: name: sor-website port: - number: 443 + number: 80 + + - host: www.aeternalisgames.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: sor-website + port: + number: 80 # ── Game server / WebSocket gateway ──────────────────────────────────────── - host: hub.aeternalisgames.com diff --git a/deploy/k8s/service-website.yaml b/deploy/k8s/service-website.yaml index 9dc8e30..2dacf23 100644 --- a/deploy/k8s/service-website.yaml +++ b/deploy/k8s/service-website.yaml @@ -7,8 +7,8 @@ spec: selector: app: sor-website ports: - - name: https + - name: http protocol: TCP - port: 443 + port: 80 targetPort: 8080 type: ClusterIP