Personal homeserver with bridges deferred. Single host
matrix.{cluster.domain} with path-based routing: /_matrix, /_synapse,
/.well-known/matrix → Synapse; / → Element Web. Both share matrix-tls.
Stack: ananace/matrix-synapse + element-web charts, CNPG postgres
(LC_COLLATE=C), in-cluster alpine redis (no auth, replaces bitnami
subchart), mittwald-generated synapse-secrets for registration_shared/
macaroon/form_secret, custom idempotent signing-key init Job (replaces
chart's bitnami/kubectl publisher).
Sync waves:
-3 Namespace
-2 synapse-secrets (mittwald head-start), signing-key RBAC
-1 signing-key Job, CNPG Cluster, redis
0 Synapse, Element, Ingress
Synapse pod waits in extraCommands until synapse-secrets is populated,
then writes zz-overrides.yaml to override chart placeholders for the
three secret values without churning the chart-managed Secret on every
render. Resources tightened for 1-2 user scale: Synapse 256Mi/512Mi,
Postgres 64Mi/128Mi.
ArgoCD destination.namespace overridden to matrix via prototype-level
argocd overlay so both apps share the matrix ns instead of creating
unused matrix-synapse and element-web namespaces.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
143 lines
4.7 KiB
YAML
143 lines
4.7 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
annotations:
|
|
a8r.io/repository: ssh://git@git.tr1ceracop.de:222/gitea_admin/k8s-and-chill.git
|
|
labels:
|
|
app.kubernetes.io/component: synapse
|
|
app.kubernetes.io/instance: matrix-synapse
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: matrix-synapse
|
|
app.kubernetes.io/version: 1.152.0
|
|
helm.sh/chart: matrix-synapse-3.12.26
|
|
name: matrix-synapse
|
|
namespace: matrix
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/component: synapse
|
|
app.kubernetes.io/instance: matrix-synapse
|
|
app.kubernetes.io/name: matrix-synapse
|
|
strategy:
|
|
type: Recreate
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
checksum/config: e9410364225cc447e9ce6b06ef65e4740011fa188b0a8ebab877ea04a1d100d7
|
|
checksum/secrets: 54091df516cd7bf15484597ec0c9613cd969341f977e3228b5416997dc9b8c95
|
|
labels:
|
|
app.kubernetes.io/component: synapse
|
|
app.kubernetes.io/instance: matrix-synapse
|
|
app.kubernetes.io/name: matrix-synapse
|
|
spec:
|
|
containers:
|
|
- command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
export POSTGRES_PASSWORD=$(echo "${POSTGRES_PASSWORD:-}" | sed 's/\//\\\//g' | sed 's/\&/\\\&/g') && \
|
|
export REDIS_PASSWORD=$(echo "${REDIS_PASSWORD:-}" | sed 's/\//\\\//g' | sed 's/\&/\\\&/g') && \
|
|
cat /synapse/secrets/*.yaml | \
|
|
sed -e "s/@@POSTGRES_PASSWORD@@/${POSTGRES_PASSWORD:-}/" \
|
|
-e "s/@@REDIS_PASSWORD@@/${REDIS_PASSWORD:-}/" \
|
|
> /synapse/config/conf.d/secrets.yaml
|
|
|
|
|
|
i=0; while [ ! -s /synapse/extra-secrets/registration_shared_secret ] && [ $i -lt 60 ]; do echo "waiting for synapse-secrets"; sleep 2; i=$((i+1)); done
|
|
printf 'registration_shared_secret: "%s"\nmacaroon_secret_key: "%s"\nform_secret: "%s"\n' "$(cat /synapse/extra-secrets/registration_shared_secret)" "$(cat /synapse/extra-secrets/macaroon_secret_key)" "$(cat /synapse/extra-secrets/form_secret)" > /synapse/config/conf.d/zz-overrides.yaml
|
|
|
|
exec python -B -m synapse.app.homeserver \
|
|
-c /synapse/config/homeserver.yaml \
|
|
-c /synapse/config/conf.d/
|
|
env:
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
key: password
|
|
name: synapse-cnpg-app
|
|
image: ghcr.io/element-hq/synapse:v1.152.0
|
|
imagePullPolicy: IfNotPresent
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: http
|
|
name: synapse
|
|
ports:
|
|
- containerPort: 8008
|
|
name: http
|
|
protocol: TCP
|
|
- containerPort: 9093
|
|
name: replication
|
|
protocol: TCP
|
|
- containerPort: 9090
|
|
name: metrics
|
|
protocol: TCP
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: http
|
|
resources:
|
|
limits:
|
|
memory: 512Mi
|
|
requests:
|
|
cpu: 100m
|
|
memory: 256Mi
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
startupProbe:
|
|
failureThreshold: 12
|
|
httpGet:
|
|
path: /health
|
|
port: http
|
|
volumeMounts:
|
|
- mountPath: /synapse/config
|
|
name: config
|
|
- mountPath: /synapse/config/conf.d
|
|
name: tmpconf
|
|
- mountPath: /synapse/secrets
|
|
name: secrets
|
|
- mountPath: /synapse/keys
|
|
name: signingkey
|
|
- mountPath: /synapse/data
|
|
name: media
|
|
- mountPath: /tmp
|
|
name: tmpdir
|
|
- mountPath: /synapse/extra-secrets
|
|
name: synapse-secrets
|
|
readOnly: true
|
|
securityContext:
|
|
fsGroup: 991
|
|
runAsGroup: 991
|
|
runAsNonRoot: true
|
|
runAsUser: 991
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
serviceAccountName: matrix-synapse
|
|
volumes:
|
|
- configMap:
|
|
name: matrix-synapse
|
|
name: config
|
|
- name: secrets
|
|
secret:
|
|
secretName: matrix-synapse
|
|
- name: signingkey
|
|
secret:
|
|
items:
|
|
- key: signing.key
|
|
path: signing.key
|
|
secretName: synapse-signing-key
|
|
- emptyDir: {}
|
|
name: tmpconf
|
|
- emptyDir: {}
|
|
name: tmpdir
|
|
- name: media
|
|
persistentVolumeClaim:
|
|
claimName: matrix-synapse
|
|
- name: synapse-secrets
|
|
secret:
|
|
secretName: synapse-secrets
|