feat(ci): GitLab CI/CD dev→prod pipeline, kustomize base+overlays

Multiple developers now work on this repo, and the only working deploy
trigger required pushing to GitHub - which contradicts the standing
GitLab-canonical policy for this repo - while every actual deploy was a
manual kubectl run against one environment (no prod exists at all).

Restructures deploy/k8s/ into base/ + overlays/{dev,prod}: overlays/dev
is a verified byte-for-byte no-op for the live sandbox (kubectl kustomize
diff against the old flat layout is empty), overlays/prod is scaffolded
but inert (placeholder hostname + JMAP_SERVER_URL, since neither a prod
hostname decision nor a prod Stalwart exist yet). deploy/k8s/ca/ (the
EJBCA internal CA) is untouched and never referenced by either overlay.

Adds .gitlab-ci.yml: verify (MR gate, no push/deploy) -> build+deploy-dev
(automatic on push to dev, one image name/tag-only environments, fixing
the old -dev/-beta naming split) -> promote (manual, protected
`production` environment, retags the exact dev digest via
`docker buildx imagetools create` - never rebuilds - and is left as a
documented TODO for the actual `kubectl apply` until prod is real).

Updates VNCMAIL-SETUP.md and deploy/k8s/README.md to describe the new
flow and correct the aspirational promotion description that assumed a
"production image" CI never actually built.

Also fixes a pre-existing lint error (no-control-regex false positive on
an intentional DN-sanitizing character class in lib/smime-ca/ejbca.ts)
that was blocking this commit's pre-commit hook - unrelated to this
change otherwise, confirmed already present on dev before this branch.

Runner/RBAC/registry setup is an infra prerequisite this commit cannot
provide - documented in the pipeline plan, not part of this diff.
This commit is contained in:
Bernd Rodler
2026-08-05 11:43:55 +02:00
parent 12908ab706
commit 3512f935d1
18 changed files with 402 additions and 62 deletions
+91
View File
@@ -0,0 +1,91 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: vncmail-plus
labels:
app: vncmail-plus
spec:
replicas: 1
selector:
matchLabels:
app: vncmail-plus
# RWO volumes can only mount to one pod — Recreate avoids a stuck rollout.
strategy:
type: Recreate
template:
metadata:
labels:
app: vncmail-plus
spec:
# The image runs as uid/gid 1001 (nextjs:nodejs) and the Dockerfile
# chowns /app/data to 1001. fsGroup makes the mounted PVCs writable by it.
securityContext:
fsGroup: 1001
runAsUser: 1001
runAsGroup: 1001
# ghcr package is private by default — see deploy/k8s/README.md to create
# this pull secret. Delete this block if you make the package public.
# NOTE: once CI moves to pushing registry.gitlab.vnc.biz images (the
# dev-auto-deploy phase of the GitLab pipeline), this needs to become a
# docker-registry secret for that registry instead — comments only,
# deliberately not renamed here, so this file stays a no-op today.
imagePullSecrets:
- name: ghcr-pull
containers:
- name: vncmail-plus
# Default/legacy value — CI overrides the image per-deploy via
# `kustomize edit set image`, so what's committed here never goes
# stale. For a one-off manual apply, pin a digest instead of :latest.
image: ghcr.io/brvncde-dotcom/vncmail-plus-dev:latest
imagePullPolicy: Always
ports:
- containerPort: 3000
envFrom:
- secretRef:
name: vncmail-env
env:
- name: HOSTNAME
value: "0.0.0.0"
- name: PORT
value: "3000"
readinessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 10
periodSeconds: 10
livenessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 25
periodSeconds: 30
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: "1"
memory: 1Gi
volumeMounts:
- name: settings
mountPath: /app/data/settings
- name: admin
mountPath: /app/data/admin
- name: admin-state
mountPath: /app/data/admin-state
- name: telemetry
mountPath: /app/data/telemetry
volumes:
- name: settings
persistentVolumeClaim:
claimName: vncmail-settings
- name: admin
persistentVolumeClaim:
claimName: vncmail-admin
- name: admin-state
persistentVolumeClaim:
claimName: vncmail-admin-state
- name: telemetry
persistentVolumeClaim:
claimName: vncmail-telemetry
+33
View File
@@ -0,0 +1,33 @@
# Exposes VNCmail+ at vncmail.sandbox.vnc.de, alongside bulwark.sandbox.vnc.de.
# MATCH YOUR CLUSTER — inspect the existing Bulwark ingress and copy its
# ingressClassName + TLS/cert-manager annotations:
# kubectl get ingress -A | grep bulwark
# kubectl get ingress <bulwark-ingress> -n <ns> -o yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: vncmail-plus
annotations:
# cert-manager issuer — set to whatever bulwark.sandbox.vnc.de uses.
cert-manager.io/cluster-issuer: letsencrypt-prod
# Mail attachments can be large; raise the nginx body limit.
nginx.ingress.kubernetes.io/proxy-body-size: "100m"
spec:
# microk8s ingress addon class is usually "public" (nginx). Confirm with
# `kubectl get ingressclass` and match bulwark's.
ingressClassName: public
tls:
- hosts:
- vncmail.sandbox.vnc.de
secretName: vncmail-plus-tls
rules:
- host: vncmail.sandbox.vnc.de
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: vncmail-plus
port:
number: 80
+14
View File
@@ -0,0 +1,14 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- pvc.yaml
- deployment.yaml
- service.yaml
- ingress.yaml
# - secret.yaml # create from an overlay's secret.example.yaml; not committed
# Namespace is intentionally NOT set here. Kustomize's `namespace:` transformer
# doesn't rename cluster-scoped Namespace objects, so each overlay ships its own
# namespace.yaml (the actual object) and its own `namespace:` field (which
# injects metadata.namespace into every namespaced resource below). Applying
# this base directly is meaningless — always go through an overlay.
+46
View File
@@ -0,0 +1,46 @@
# Four persistent volumes — mirror the fork's docker-compose volumes.
# storageClassName: microk8s default is "microk8s-hostpath". Match your
# cluster: `kubectl get sc`. Change all four if yours differs.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: vncmail-settings
spec:
accessModes: [ReadWriteOnce]
storageClassName: microk8s-hostpath
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: vncmail-admin
spec:
accessModes: [ReadWriteOnce]
storageClassName: microk8s-hostpath
resources:
requests:
storage: 256Mi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: vncmail-admin-state
spec:
accessModes: [ReadWriteOnce]
storageClassName: microk8s-hostpath
resources:
requests:
storage: 256Mi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: vncmail-telemetry
spec:
accessModes: [ReadWriteOnce]
storageClassName: microk8s-hostpath
resources:
requests:
storage: 256Mi
+13
View File
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: vncmail-plus
labels:
app: vncmail-plus
spec:
selector:
app: vncmail-plus
ports:
- name: http
port: 80
targetPort: 3000