Deploy Aeternalis through Argo CD with verified PostgreSQL and SRS TLS
This commit is contained in:
@@ -2,6 +2,7 @@ name: Verify, publish, and promote
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master, main]
|
branches: [master, main]
|
||||||
|
paths-ignore: [deploy/values-srs.yaml]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -36,7 +37,11 @@ jobs:
|
|||||||
- run: npx playwright install --with-deps chromium
|
- run: npx playwright install --with-deps chromium
|
||||||
- run: npm run test:e2e
|
- run: npm run test:e2e
|
||||||
- uses: azure/setup-helm@v4.3.0
|
- uses: azure/setup-helm@v4.3.0
|
||||||
- run: helm lint deploy/chart && helm template aeternalis deploy/chart > /tmp/aeternalis.yaml
|
- run: |
|
||||||
|
helm lint deploy/chart
|
||||||
|
helm template aeternalis deploy/chart > /tmp/aeternalis.yaml
|
||||||
|
helm lint deploy/chart -f deploy/values-srs.yaml
|
||||||
|
helm template aeternalis deploy/chart -f deploy/values-srs.yaml > /tmp/aeternalis-srs.yaml
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
if: gitea.event_name == 'push'
|
if: gitea.event_name == 'push'
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# SRS deployment
|
||||||
|
|
||||||
|
Argo CD application: `argocd/aeternalis`, namespace `aeternalis`.
|
||||||
|
Endpoint: `https://srs.aeternalisgames.com` (NGINX HTTPS/443).
|
||||||
|
The chart uses `letsencrypt-godaddy`, matching SOR, and the `srs-tls`
|
||||||
|
certificate secret. One initial world is configured at the requested hostname.
|
||||||
|
|
||||||
|
Production configuration is `deploy/values-srs.yaml`. CI publishes a SHA-tagged
|
||||||
|
image to `registry.aeternalisgames.com/aeternalis/aeternalis`, then promotes its
|
||||||
|
immutable digest into that values file. Values-only promotion commits do not
|
||||||
|
start another build. Argo CD uses the chart and values from this repository.
|
||||||
|
Do not sync the bootstrap image; wait for successful publication and promotion.
|
||||||
|
|
||||||
|
External prerequisites (not stored in Git):
|
||||||
|
|
||||||
|
- `aeternalis-runtime`: DATABASE_URL, OIDC_ISSUER, OIDC_CLIENT_ID,
|
||||||
|
OIDC_CLIENT_SECRET. PostgreSQL uses database `aeternalis`, dedicated login
|
||||||
|
`aeternalis_app`, and `sslmode=verify-full`.
|
||||||
|
- `postgres-ca` ConfigMap: `ca.crt`, mounted at `/etc/postgres-ca/ca.crt`.
|
||||||
|
It trusts the database certificate, whose DNS identity is `pg-forge-01`.
|
||||||
|
A selectorless Service and EndpointSlice resolve that name to the existing
|
||||||
|
PostgreSQL host. Review/update this trust bundle when its certificate rotates.
|
||||||
|
- `harbor-pull`: registry credential for pulling this project's images.
|
||||||
|
- Argo CD repository access: a Kubernetes repository Secret, not CI kubeconfig.
|
||||||
|
|
||||||
|
OIDC uses the existing `aeternalis` realm and dedicated confidential client
|
||||||
|
`aeternalis-web`, authorization-code flow with PKCE S256, and exact callback
|
||||||
|
`https://srs.aeternalisgames.com/auth/callback`. Existing realm users and policy
|
||||||
|
are preserved. No user passwords or admin credentials are added to the app.
|
||||||
|
|
||||||
|
NetworkPolicy permits DNS, PostgreSQL at `172.10.1.127:5432`, and the internal
|
||||||
|
NGINX address `172.10.1.160:443` used by the identity provider. Update the explicit
|
||||||
|
allowlists if infrastructure addresses change; do not disable production TLS.
|
||||||
|
|
||||||
|
Validate with Helm lint/template for both defaults and SRS values, Kubernetes
|
||||||
|
server-side dry-run, CI tests, registry digest readback, Argo CD Synced/Healthy,
|
||||||
|
HTTPS `/readyz`, certificate hostname/chain validation, and OIDC redirect checks.
|
||||||
|
A complete interactive login/playtest still requires a real realm user.
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: aeternalis
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://git.aeternalisgames.com/Stone/aeternalis.git
|
||||||
|
targetRevision: master
|
||||||
|
path: deploy/chart
|
||||||
|
helm:
|
||||||
|
releaseName: aeternalis
|
||||||
|
valueFiles: [../values-srs.yaml]
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: aeternalis
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: false
|
||||||
|
selfHeal: true
|
||||||
|
syncOptions: [CreateNamespace=true, ServerSideApply=true]
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{{- if .Values.externalDatabase.address }}
|
||||||
|
# Preserve the certificate's DNS identity while routing to the external database.
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ .Values.externalDatabase.name | quote }}
|
||||||
|
spec:
|
||||||
|
ports: [{ name: postgres, port: 5432, targetPort: 5432 }]
|
||||||
|
---
|
||||||
|
apiVersion: discovery.k8s.io/v1
|
||||||
|
kind: EndpointSlice
|
||||||
|
metadata:
|
||||||
|
name: {{ .Values.externalDatabase.name | quote }}
|
||||||
|
labels:
|
||||||
|
kubernetes.io/service-name: {{ .Values.externalDatabase.name | quote }}
|
||||||
|
addressType: IPv4
|
||||||
|
ports: [{ name: postgres, protocol: TCP, port: 5432 }]
|
||||||
|
endpoints:
|
||||||
|
- addresses: [{{ .Values.externalDatabase.address | quote }}]
|
||||||
|
conditions: { ready: true }
|
||||||
|
{{- end }}
|
||||||
@@ -11,6 +11,9 @@ spec:
|
|||||||
- from:
|
- from:
|
||||||
- namespaceSelector:
|
- namespaceSelector:
|
||||||
matchLabels: { kubernetes.io/metadata.name: {{ .Values.networkPolicy.ingressNamespace | quote }} }
|
matchLabels: { kubernetes.io/metadata.name: {{ .Values.networkPolicy.ingressNamespace | quote }} }
|
||||||
|
{{- range .Values.networkPolicy.ingressCIDRs }}
|
||||||
|
- ipBlock: { cidr: {{ . | quote }} }
|
||||||
|
{{- end }}
|
||||||
ports: [{ protocol: TCP, port: 8080 }]
|
ports: [{ protocol: TCP, port: 8080 }]
|
||||||
egress:
|
egress:
|
||||||
- to:
|
- to:
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ spec:
|
|||||||
automountServiceAccountToken: false
|
automountServiceAccountToken: false
|
||||||
terminationGracePeriodSeconds: 30
|
terminationGracePeriodSeconds: 30
|
||||||
imagePullSecrets: {{ $root.Values.imagePullSecrets | toJson }}
|
imagePullSecrets: {{ $root.Values.imagePullSecrets | toJson }}
|
||||||
|
{{- if $root.Values.databaseCA.configMap }}
|
||||||
|
volumes:
|
||||||
|
- name: postgres-ca
|
||||||
|
configMap:
|
||||||
|
name: {{ $root.Values.databaseCA.configMap | quote }}
|
||||||
|
{{- end }}
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsNonRoot: true
|
runAsNonRoot: true
|
||||||
runAsUser: 65532
|
runAsUser: 65532
|
||||||
@@ -32,6 +38,12 @@ spec:
|
|||||||
- name: world
|
- name: world
|
||||||
image: {{ if $root.Values.image.digest }}{{ printf "%s@%s" $root.Values.image.repository $root.Values.image.digest | quote }}{{ else }}{{ printf "%s:%s" $root.Values.image.repository $root.Values.image.tag | quote }}{{ end }}
|
image: {{ if $root.Values.image.digest }}{{ printf "%s@%s" $root.Values.image.repository $root.Values.image.digest | quote }}{{ else }}{{ printf "%s:%s" $root.Values.image.repository $root.Values.image.tag | quote }}{{ end }}
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
|
{{- if $root.Values.databaseCA.configMap }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: postgres-ca
|
||||||
|
mountPath: /etc/postgres-ca
|
||||||
|
readOnly: true
|
||||||
|
{{- end }}
|
||||||
ports: [{ name: http, containerPort: 8080 }]
|
ports: [{ name: http, containerPort: 8080 }]
|
||||||
securityContext:
|
securityContext:
|
||||||
readOnlyRootFilesystem: true
|
readOnlyRootFilesystem: true
|
||||||
@@ -64,6 +76,9 @@ kind: Ingress
|
|||||||
metadata:
|
metadata:
|
||||||
name: {{ $root.Release.Name }}-{{ .id }}
|
name: {{ $root.Release.Name }}-{{ .id }}
|
||||||
annotations:
|
annotations:
|
||||||
|
{{- if $root.Values.ingress.clusterIssuer }}
|
||||||
|
cert-manager.io/cluster-issuer: {{ $root.Values.ingress.clusterIssuer | quote }}
|
||||||
|
{{- end }}
|
||||||
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
|
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
|
||||||
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
|
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
|
||||||
nginx.ingress.kubernetes.io/proxy-body-size: "8k"
|
nginx.ingress.kubernetes.io/proxy-body-size: "8k"
|
||||||
|
|||||||
@@ -5,9 +5,15 @@ image:
|
|||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: harbor-pull
|
- name: harbor-pull
|
||||||
existingSecret: aeternalis-runtime
|
existingSecret: aeternalis-runtime
|
||||||
|
databaseCA:
|
||||||
|
configMap: ""
|
||||||
|
externalDatabase:
|
||||||
|
name: pg-forge-01
|
||||||
|
address: ""
|
||||||
ingress:
|
ingress:
|
||||||
className: nginx
|
className: nginx
|
||||||
tlsSecret: aeternalis-tls
|
tlsSecret: aeternalis-tls
|
||||||
|
clusterIssuer: ""
|
||||||
worlds:
|
worlds:
|
||||||
- id: world-001
|
- id: world-001
|
||||||
seed: "734291"
|
seed: "734291"
|
||||||
@@ -30,6 +36,8 @@ resources:
|
|||||||
networkPolicy:
|
networkPolicy:
|
||||||
enabled: true
|
enabled: true
|
||||||
ingressNamespace: ingress-nginx
|
ingressNamespace: ingress-nginx
|
||||||
|
# Node addresses for ingress controllers using host networking.
|
||||||
|
ingressCIDRs: []
|
||||||
# Explicitly set actual database and OIDC provider IP ranges before deployment.
|
# Explicitly set actual database and OIDC provider IP ranges before deployment.
|
||||||
databaseCIDRs: []
|
databaseCIDRs: []
|
||||||
identityCIDRs: []
|
identityCIDRs: []
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# Runtime credentials and PostgreSQL CA are provisioned outside Git.
|
||||||
|
image:
|
||||||
|
repository: registry.aeternalisgames.com/aeternalis/aeternalis
|
||||||
|
tag: bootstrap
|
||||||
|
digest: ""
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: harbor-pull
|
||||||
|
existingSecret: aeternalis-runtime
|
||||||
|
databaseCA:
|
||||||
|
configMap: postgres-ca
|
||||||
|
externalDatabase:
|
||||||
|
name: pg-forge-01
|
||||||
|
address: 172.10.1.127
|
||||||
|
ingress:
|
||||||
|
className: nginx
|
||||||
|
clusterIssuer: letsencrypt-godaddy
|
||||||
|
tlsSecret: srs-tls
|
||||||
|
worlds:
|
||||||
|
- id: world-001
|
||||||
|
seed: "734291"
|
||||||
|
host: srs.aeternalisgames.com
|
||||||
|
networkPolicy:
|
||||||
|
enabled: true
|
||||||
|
ingressNamespace: kube-system
|
||||||
|
ingressCIDRs:
|
||||||
|
- 172.10.1.135/32
|
||||||
|
- 172.10.1.146/32
|
||||||
|
- 172.10.1.160/32
|
||||||
|
- 172.10.1.196/32
|
||||||
|
databaseCIDRs: [172.10.1.127/32]
|
||||||
|
identityCIDRs: [172.10.1.160/32]
|
||||||
|
dnsNamespace: kube-system
|
||||||
Reference in New Issue
Block a user