Add CI/CD pipeline, Dockerfiles, and k8s/ArgoCD manifests
- Gitea Actions workflow: build sor-host + sor-admin, push to Harbor, auto-update image tags in k8s manifests (GitOps — ArgoCD watches deploy/k8s/) - Dockerfile.host / Dockerfile.admin: multi-stage .NET 8 builds, non-root runtime - deploy/k8s/: configmap, deployments, services, nginx ingress - hub.aeternalisgames.com → sor-host (WebSocket gateway) - admin.aeternalisgames.com → sor-admin (Blazor admin portal) - hub-tls for hub, cert-manager auto-provisions admin-tls - deploy/secrets/: README + *.yaml.template files to populate (gitignored) - deploy/argo/application.yaml: ArgoCD Application (namespace stone-server) - Root .gitignore: excludes deploy/secrets/*.yaml (never commit populated secrets) 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>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: sor-config
|
||||
namespace: stone-server
|
||||
data:
|
||||
# ── SOR.Host ────────────────────────────────────────────────────────────────
|
||||
ENABLED_SERVICES: "all"
|
||||
ASPNETCORE_URLS: "http://+:8080"
|
||||
ASPNETCORE_ENVIRONMENT: "Production"
|
||||
|
||||
# WebSocket gateway settings
|
||||
WebSocket__Path: "/ws"
|
||||
Gateway__AuthTimeoutMs: "10000"
|
||||
Gateway__MaxMessagesPerSecond: "20"
|
||||
|
||||
# gRPC: gateway calls auth at this address.
|
||||
# In single-pod (ENABLED_SERVICES=all) mode both run in the same process on the same port.
|
||||
Services__Auth: "http://localhost:8080"
|
||||
|
||||
# NATS message bus — update to your NATS service address.
|
||||
# TODO: replace with your actual NATS service URL.
|
||||
Nats__Url: "nats://nats.stone-server.svc.cluster.local:4222"
|
||||
|
||||
# ── SOR.Admin ───────────────────────────────────────────────────────────────
|
||||
# Admin inherits ASPNETCORE_URLS and ASPNETCORE_ENVIRONMENT from the same configmap.
|
||||
@@ -0,0 +1,87 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sor-admin
|
||||
namespace: stone-server
|
||||
labels:
|
||||
app: sor-admin
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sor-admin
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sor-admin
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: harbor-credentials
|
||||
|
||||
containers:
|
||||
- name: sor-admin
|
||||
# CI updates this image tag on every push to master.
|
||||
# TODO: replace with your actual Harbor hostname/project before first deploy.
|
||||
image: harbor.aeternalisgames.com/sor/sor-admin:latest
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: sor-config
|
||||
|
||||
env:
|
||||
# Postgres — same database, admin-specific schema access.
|
||||
- name: ConnectionStrings__Default
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: sor-app-secrets
|
||||
key: ConnectionStrings__Default
|
||||
|
||||
# CDN — needed for asset uploads in the admin portal.
|
||||
- name: Cdn__PublicBaseUrl
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: sor-app-secrets
|
||||
key: Cdn__PublicBaseUrl
|
||||
- name: Cdn__UploadBaseUrl
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: sor-app-secrets
|
||||
key: Cdn__UploadBaseUrl
|
||||
- name: Cdn__ApiKey
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: sor-app-secrets
|
||||
key: Cdn__ApiKey
|
||||
|
||||
# ASP.NET Core Data Protection — persists Blazor auth cookies across restarts.
|
||||
# TODO: generate a strong random value and store in sor-app-secrets.
|
||||
- name: DataProtection__ApplicationName
|
||||
value: "sor-admin"
|
||||
|
||||
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:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "500m"
|
||||
memory: "512Mi"
|
||||
@@ -0,0 +1,95 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sor-host
|
||||
namespace: stone-server
|
||||
labels:
|
||||
app: sor-host
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sor-host
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sor-host
|
||||
spec:
|
||||
# Pull images from Harbor using the harbor-credentials secret.
|
||||
imagePullSecrets:
|
||||
- name: harbor-credentials
|
||||
|
||||
containers:
|
||||
- name: sor-host
|
||||
# CI updates this image tag on every push to master.
|
||||
# TODO: replace with your actual Harbor hostname/project before first deploy.
|
||||
image: harbor.aeternalisgames.com/sor/sor-host:latest
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
# ── Non-secret config from ConfigMap ──────────────────────────────
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: sor-config
|
||||
|
||||
# ── Secrets injected as individual env vars ────────────────────────
|
||||
env:
|
||||
# Postgres — from the sor-app-secrets Secret (see deploy/secrets/).
|
||||
- name: ConnectionStrings__Default
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: sor-app-secrets
|
||||
key: ConnectionStrings__Default
|
||||
|
||||
# Redis — from the pre-existing redis-credentials Secret.
|
||||
# TODO: verify the key name matches your redis-credentials secret.
|
||||
- name: ConnectionStrings__Redis
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: redis-credentials
|
||||
key: connection-string
|
||||
|
||||
# CDN
|
||||
- name: Cdn__PublicBaseUrl
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: sor-app-secrets
|
||||
key: Cdn__PublicBaseUrl
|
||||
- name: Cdn__UploadBaseUrl
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: sor-app-secrets
|
||||
key: Cdn__UploadBaseUrl
|
||||
- name: Cdn__ApiKey
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: sor-app-secrets
|
||||
key: Cdn__ApiKey
|
||||
|
||||
# ── 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 ─────────────────────────────────────────────────────
|
||||
resources:
|
||||
requests:
|
||||
cpu: "250m"
|
||||
memory: "256Mi"
|
||||
limits:
|
||||
cpu: "1000m"
|
||||
memory: "1Gi"
|
||||
@@ -0,0 +1,61 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: sor-ingress
|
||||
namespace: stone-server
|
||||
annotations:
|
||||
# cert-manager: automatically provision / renew Let's Encrypt certs.
|
||||
# TODO: verify your cluster-issuer name (run: kubectl get clusterissuer -A).
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||
|
||||
# Nginx: keep WebSocket connections open for up to 1 hour.
|
||||
# Required so clients don't get disconnected mid-game by proxy timeouts.
|
||||
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
|
||||
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
|
||||
nginx.ingress.kubernetes.io/proxy-connect-timeout: "60"
|
||||
|
||||
# Nginx will forward HTTP → HTTPS and handle the WebSocket Upgrade header.
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
||||
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
|
||||
tls:
|
||||
# hub.aeternalisgames.com — game server + WebSocket gateway.
|
||||
# hub-tls already exists in this namespace (your existing Let's Encrypt cert).
|
||||
- hosts:
|
||||
- hub.aeternalisgames.com
|
||||
secretName: hub-tls
|
||||
|
||||
# admin.aeternalisgames.com — admin portal.
|
||||
# cert-manager will auto-provision this cert on first deployment.
|
||||
# TODO: ensure DNS A record for admin.aeternalisgames.com points to your ingress IP.
|
||||
- hosts:
|
||||
- admin.aeternalisgames.com
|
||||
secretName: admin-tls
|
||||
|
||||
rules:
|
||||
# ── Game server / WebSocket gateway ────────────────────────────────────────
|
||||
- host: hub.aeternalisgames.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: sor-host
|
||||
port:
|
||||
number: 80
|
||||
|
||||
# ── Admin portal ───────────────────────────────────────────────────────────
|
||||
# Hosted on a separate subdomain to avoid SignalR/Blazor path conflicts.
|
||||
- host: admin.aeternalisgames.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: sor-admin
|
||||
port:
|
||||
number: 80
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: sor-admin
|
||||
namespace: stone-server
|
||||
spec:
|
||||
selector:
|
||||
app: sor-admin
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
type: ClusterIP
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: sor-host
|
||||
namespace: stone-server
|
||||
spec:
|
||||
selector:
|
||||
app: sor-host
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
type: ClusterIP
|
||||
Reference in New Issue
Block a user