@@ -4,8 +4,6 @@ kind: Deployment
44metadata :
55 name : matrix-synapse
66 namespace : apps
7- annotations :
8- argocd.argoproj.io/sync-wave : " 4"
97spec :
108 selector :
119 matchLabels :
@@ -18,24 +16,35 @@ spec:
1816 labels :
1917 app : matrix-synapse
2018 spec :
21- containers :
22- - name : synapse
19+ # Init container per generare le chiavi di firma
20+ initContainers :
21+ - name : generate-keys
2322 image : ghcr.io/element-hq/synapse:v1.123.0
23+ command :
24+ - /bin/sh
25+ - -c
26+ - |
27+ echo "=== Matrix Synapse Key Generation ==="
28+ if [ -f /data/keys/signing.key ]; then
29+ echo "✓ Signing key exists"
30+ exit 0
31+ fi
32+
33+ echo "Generating signing key..."
34+ mkdir -p /data/keys
35+ python -m synapse.app.homeserver \
36+ --server-name=matrix.ildoc.it \
37+ --config-path=/data/homeserver.yaml \
38+ --generate-keys
39+
40+ echo "✓ Key generated successfully"
2441 env :
2542 - name : SYNAPSE_SERVER_NAME
2643 value : " matrix.ildoc.it"
2744 - name : SYNAPSE_REPORT_STATS
2845 value : " no"
29- - name : UID
30- value : " 991"
31- - name : GID
32- value : " 991"
33- - name : TZ
34- value : " Europe/Rome"
35-
36- # PostgreSQL configuration (da cross-secrets)
3746 - name : POSTGRES_HOST
38- value : " 192.168.0.40 "
47+ value : " 192.168.0.30 "
3948 - name : POSTGRES_PORT
4049 value : " 5432"
4150 - name : POSTGRES_DB
@@ -45,44 +54,87 @@ spec:
4554 - name : POSTGRES_PASSWORD
4655 valueFrom :
4756 secretKeyRef :
48- name : matrix-cross-secrets # DA CROSS
57+ name : matrix-cross-secrets
4958 key : postgres-password
50-
5159 - name : SYNAPSE_REDIS_HOST
52- value : " matrix-redis.apps.svc.cluster.local" # Service interno
60+ value : " matrix-redis.apps.svc.cluster.local"
5361 - name : SYNAPSE_REDIS_PORT
5462 value : " 6379"
5563 - name : SYNAPSE_REDIS_PASSWORD
5664 valueFrom :
5765 secretKeyRef :
5866 name : matrix-redis-secret
5967 key : password
60-
61- # Synapse secrets (da k8s-secrets)
6268 - name : REGISTRATION_SHARED_SECRET
6369 valueFrom :
6470 secretKeyRef :
65- name : matrix-k8s-secrets # DA KUBERNETES
71+ name : matrix-k8s-secrets
6672 key : registration-shared-secret
6773 - name : MACAROON_SECRET_KEY
6874 valueFrom :
6975 secretKeyRef :
70- name : matrix-k8s-secrets # DA KUBERNETES
76+ name : matrix-k8s-secrets
7177 key : macaroon-secret-key
7278 - name : FORM_SECRET
7379 valueFrom :
7480 secretKeyRef :
75- name : matrix-k8s-secrets # DA KUBERNETES
81+ name : matrix-k8s-secrets
7682 key : form-secret
77-
83+ volumeMounts :
84+ - name : data
85+ mountPath : /data
86+ - name : config
87+ mountPath : /data/homeserver.yaml
88+ subPath : homeserver.yaml
89+ - name : config
90+ mountPath : /data/log.config
91+ subPath : log.config
92+
93+ containers :
94+ - name : synapse
95+ image : ghcr.io/element-hq/synapse:v1.123.0
96+ env :
97+ - name : SYNAPSE_SERVER_NAME
98+ value : " matrix.ildoc.it"
99+ - name : SYNAPSE_REPORT_STATS
100+ value : " no"
101+ - name : UID
102+ value : " 991"
103+ - name : GID
104+ value : " 991"
105+ - name : TZ
106+ value : " Europe/Rome"
107+ # PostgreSQL configuration
108+ - name : POSTGRES_HOST
109+ value : " 192.168.0.30"
110+ - name : POSTGRES_PORT
111+ value : " 5432"
112+ - name : POSTGRES_DB
113+ value : " synapse"
114+ - name : POSTGRES_USER
115+ value : " synapse"
116+ - name : POSTGRES_PASSWORD
117+ valueFrom :
118+ secretKeyRef :
119+ name : matrix-secrets
120+ key : postgres-password
121+ # Redis configuration
122+ - name : SYNAPSE_REDIS_HOST
123+ value : " 192.168.0.40"
124+ - name : SYNAPSE_REDIS_PORT
125+ value : " 6379"
126+ - name : SYNAPSE_REDIS_PASSWORD
127+ valueFrom :
128+ secretKeyRef :
129+ name : matrix-secrets
130+ key : redis-password
78131 ports :
79132 - containerPort : 8008
80133 name : http
81134 protocol : TCP
82135 - containerPort : 8448
83136 name : federation
84137 protocol : TCP
85-
86138 volumeMounts :
87139 - name : data
88140 mountPath : /data
@@ -92,15 +144,13 @@ spec:
92144 - name : config
93145 mountPath : /data/log.config
94146 subPath : log.config
95-
96147 resources :
97148 limits :
98149 cpu : 2000m
99150 memory : 4Gi
100151 requests :
101152 cpu : 500m
102153 memory : 1Gi
103-
104154 livenessProbe :
105155 httpGet :
106156 path : /health
@@ -109,7 +159,6 @@ spec:
109159 periodSeconds : 30
110160 timeoutSeconds : 5
111161 failureThreshold : 3
112-
113162 readinessProbe :
114163 httpGet :
115164 path : /health
@@ -118,7 +167,6 @@ spec:
118167 periodSeconds : 10
119168 timeoutSeconds : 5
120169 failureThreshold : 3
121-
122170 volumes :
123171 - name : data
124172 persistentVolumeClaim :
0 commit comments