Files
sor/deploy/k8s/deployment-gateway.yaml
T
4440c6c981 Split sor-host into dedicated gateway and workers deployments
Before: 3 pods ran ENABLED_SERVICES=all — gateway, auth, and every
business-logic service co-hosted. This defeated the purpose of the
gateway pattern and prevented independent scaling.

After:
  sor-gateway (2 replicas) — ENABLED_SERVICES=gateway,auth
    • WebSocket edge, accepts client connections
    • Auth co-located (JWT validation is a localhost gRPC call, no network hop)
    • Lighter resource footprint: 150m/128Mi request, 500m/512Mi limit
    • Ingress at hub.aeternalisgames.com → sor-gateway:80

  sor-workers (3 replicas) — ENABLED_SERVICES=chat,collection,bazaar,
                               content,versioning,matchmaking,game
    • Subscribes to NATS, handles all business-logic messages
    • Holds DB connection pools for all schemas
    • Internal only — no ingress
    • Heavier resources: 300m/384Mi request, 1000m/1Gi limit

configmap.yaml: removed ENABLED_SERVICES=all and Services__Auth (each
  deployment now sets these directly in its own env block)

ingress.yaml: hub.aeternalisgames.com backend sor-host → sor-gateway

ArgoCD prune=true will delete the old sor-host Deployment + Service
from the cluster on next sync.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-02-27 14:44:08 -05:00

112 lines
3.7 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: sor-gateway
namespace: stone-server
labels:
app: sor-gateway
spec:
replicas: 2
selector:
matchLabels:
app: sor-gateway
template:
metadata:
labels:
app: sor-gateway
spec:
imagePullSecrets:
- name: harbor-credentials
containers:
- name: sor-gateway
image: registry.aeternalisgames.com/sor/sor-server:latest
ports:
- containerPort: 8080
# ── Shared non-secret config ───────────────────────────────────────
envFrom:
- configMapRef:
name: sor-config
# ── Gateway-specific overrides + secrets ───────────────────────────
env:
# This pod runs only the WebSocket gateway and the auth gRPC service.
# Auth is co-located so JWT validation has no extra network hop.
- name: ENABLED_SERVICES
value: "gateway,auth"
# Auth gRPC is in the same process — call ourselves.
- name: Services__Auth
value: "http://localhost:8080"
# Postgres — Identity schema only (auth needs it for account lookups).
- name: ConnectionStrings__Default
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: ConnectionStrings__Default
# Redis — used by gateway for client push delivery.
- name: ConnectionStrings__Redis
valueFrom:
secretKeyRef:
name: redis-credentials
key: connection-string
# CDN — not used by gateway/auth, but included to keep secret binding uniform.
- name: Cdn__PublicBaseUrl
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__PublicBaseUrl
- name: Cdn__EndpointUrl
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__EndpointUrl
- name: Cdn__AccessKey
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__AccessKey
- name: Cdn__SecretKey
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__SecretKey
- name: Cdn__BucketName
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__BucketName
# ── Health checks ──────────────────────────────────────────────────
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 15
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
# ── Resources ─────────────────────────────────────────────────────
# Lighter than workers: no business-logic DB connections.
resources:
requests:
cpu: "150m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "512Mi"