Set up the repository structure following GitOps principles: - apps/ for application deployments (Stalwart as example) - infrastructure/ for cluster-wide configs (networking, monitoring) - docs/ for general documentation Migrated complete Stalwart deployment configuration including: - Multiple deployment variants (basic, OIDC-enabled) - Helm values files - Monitoring and dashboard configurations - Operational documentation (backup/restore, bootstrap) - Configuration patches and fixes Added comprehensive README files at each level to guide future use. Co-Authored-By: Paperclip <noreply@paperclip.ing>
203 lines
4.3 KiB
YAML
Executable file
203 lines
4.3 KiB
YAML
Executable file
---
|
|
apiVersion: v1
|
|
kind: Namespace
|
|
metadata:
|
|
name: mail
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: stalwart-data
|
|
namespace: mail
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
storageClassName: hcloud-volumes-encrypted
|
|
resources:
|
|
requests:
|
|
storage: 20Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: stalwart-admin
|
|
namespace: mail
|
|
type: Opaque
|
|
stringData:
|
|
admin-password: "***REMOVED***"
|
|
---
|
|
# OIDC Secret for Stalwart
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: stalwart-oidc
|
|
namespace: mail
|
|
type: Opaque
|
|
stringData:
|
|
oidc-client-id: "19432b61-e27e-444d-9ff0-0fa23fdac6d7"
|
|
oidc-client-secret: "***REMOVED***"
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: stalwart-smtp
|
|
namespace: mail
|
|
spec:
|
|
type: LoadBalancer
|
|
selector:
|
|
app: stalwart
|
|
ports:
|
|
- name: smtp
|
|
port: 25
|
|
targetPort: 25
|
|
protocol: TCP
|
|
- name: submission
|
|
port: 587
|
|
targetPort: 587
|
|
protocol: TCP
|
|
- name: submissions
|
|
port: 465
|
|
targetPort: 465
|
|
protocol: TCP
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: stalwart-imap
|
|
namespace: mail
|
|
spec:
|
|
type: LoadBalancer
|
|
selector:
|
|
app: stalwart
|
|
ports:
|
|
- name: imap
|
|
port: 143
|
|
targetPort: 143
|
|
protocol: TCP
|
|
- name: imaps
|
|
port: 993
|
|
targetPort: 993
|
|
protocol: TCP
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: stalwart-http
|
|
namespace: mail
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: stalwart
|
|
ports:
|
|
- name: http
|
|
port: 8080
|
|
targetPort: 8080
|
|
protocol: TCP
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: stalwart
|
|
namespace: mail
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app: stalwart
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: stalwart
|
|
spec:
|
|
initContainers:
|
|
- name: fix-permissions
|
|
image: busybox
|
|
command: ["sh", "-c", "chown -R 2000:2000 /opt/stalwart-mail && chmod -R 755 /opt/stalwart-mail"]
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /opt/stalwart-mail
|
|
containers:
|
|
- name: stalwart
|
|
image: stalwartlabs/stalwart:v0.16
|
|
command: ["/usr/local/bin/stalwart"]
|
|
args: ["--config", "/etc/stalwart/config.json"]
|
|
ports:
|
|
- containerPort: 25
|
|
name: smtp
|
|
- containerPort: 587
|
|
name: submission
|
|
- containerPort: 465
|
|
name: submissions
|
|
- containerPort: 143
|
|
name: imap
|
|
- containerPort: 993
|
|
name: imaps
|
|
- containerPort: 8080
|
|
name: http
|
|
env:
|
|
- name: STALWART_RECOVERY_ADMIN
|
|
value: "admin@basicstack.de:***REMOVED***"
|
|
# OIDC Configuration
|
|
- name: STALWART_OAUTH_ENABLE
|
|
value: "true"
|
|
- name: STALWART_OAUTH_ISSUER
|
|
value: "https://auth.basicstack.de"
|
|
- name: STALWART_OAUTH_CLIENT_ID
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: stalwart-oidc
|
|
key: oidc-client-id
|
|
- name: STALWART_OAUTH_CLIENT_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: stalwart-oidc
|
|
key: oidc-client-secret
|
|
- name: STALWART_OAUTH_REDIRECT_URI
|
|
value: "https://mail.basicstack.de/login/oauth"
|
|
- name: STALWART_OAUTH_SCOPES
|
|
value: "openid profile email"
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /var/lib/stalwart
|
|
- name: data
|
|
mountPath: /etc/stalwart
|
|
subPath: etc
|
|
resources:
|
|
requests:
|
|
memory: "512Mi"
|
|
cpu: "250m"
|
|
limits:
|
|
memory: "1Gi"
|
|
cpu: "1000m"
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: stalwart-data
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: Ingress
|
|
metadata:
|
|
name: stalwart-web
|
|
namespace: mail
|
|
annotations:
|
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
|
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
|
spec:
|
|
ingressClassName: traefik
|
|
tls:
|
|
- hosts:
|
|
- mail.basicstack.de
|
|
secretName: stalwart-tls
|
|
rules:
|
|
- host: mail.basicstack.de
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: Prefix
|
|
backend:
|
|
service:
|
|
name: stalwart-http
|
|
port:
|
|
number: 8080
|