2021-07-01 16:29:33 +00:00
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: {{ .Release.Name }}-matrix
|
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: {{ .Release.Name }}-matrix
|
|
|
|
replicas: 1
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: {{ .Release.Name }}-matrix
|
|
|
|
use-as-service: {{ .Release.Name }}
|
|
|
|
spec:
|
|
|
|
initContainers:
|
2021-07-17 18:12:27 +00:00
|
|
|
- name: generate-matrix-signing-key
|
2021-07-17 18:47:54 +00:00
|
|
|
image: ungleich/ungleich-matrix-synapse:{{ .Values.synapseVersion }}
|
2021-07-17 20:48:48 +00:00
|
|
|
imagePullPolicy: Always
|
2021-07-17 18:12:27 +00:00
|
|
|
command:
|
|
|
|
- "python"
|
|
|
|
- "-m"
|
|
|
|
- "synapse.app.homeserver"
|
|
|
|
- "--config-path"
|
2021-07-17 18:47:54 +00:00
|
|
|
- "/baseconfig"
|
2021-07-17 18:12:27 +00:00
|
|
|
- "--keys-directory"
|
|
|
|
- "/data"
|
|
|
|
- "--generate-keys"
|
|
|
|
volumeMounts:
|
|
|
|
- name: data
|
|
|
|
mountPath: "/data"
|
|
|
|
- name: matrix-config
|
2021-07-17 18:47:54 +00:00
|
|
|
mountPath: "/baseconfig"
|
2021-07-01 16:29:33 +00:00
|
|
|
containers:
|
2021-07-17 20:07:30 +00:00
|
|
|
- name: certbot
|
|
|
|
image: ungleich/ungleich-certbot
|
2021-07-17 20:48:48 +00:00
|
|
|
imagePullPolicy: Always
|
2021-07-17 20:07:30 +00:00
|
|
|
ports:
|
|
|
|
- containerPort: 80
|
|
|
|
env:
|
|
|
|
- name: DOMAIN
|
|
|
|
value: "{{ tpl .Values.fqdn . }}"
|
|
|
|
- name: EMAIL
|
|
|
|
value: "{{ .Values.email }}"
|
|
|
|
{{ if eq .Values.letsencryptStaging "no" }}
|
|
|
|
- name: STAGING
|
|
|
|
value: "no"
|
|
|
|
{{ end }}
|
2021-07-17 20:48:48 +00:00
|
|
|
volumeMounts:
|
|
|
|
- name: etcletsencrypt
|
|
|
|
mountPath: "/etc/letsencrypt"
|
2021-07-01 16:29:33 +00:00
|
|
|
# This container will only start *after* the cert has been placed
|
2021-07-17 18:47:54 +00:00
|
|
|
- name: debug
|
|
|
|
image: alpine:latest
|
|
|
|
volumeMounts:
|
|
|
|
- name: nginx-config
|
|
|
|
mountPath: "/etc/nginx/conf.d/"
|
|
|
|
- name: etcletsencrypt
|
|
|
|
mountPath: "/etc/letsencrypt"
|
|
|
|
- name: data
|
|
|
|
mountPath: "/data"
|
|
|
|
- name: matrix-config
|
|
|
|
mountPath: "/baseconfig"
|
|
|
|
- name: postgres-vars
|
|
|
|
mountPath: "/postgres"
|
|
|
|
args:
|
|
|
|
- sleep
|
|
|
|
- "1000000"
|
2021-07-01 16:29:33 +00:00
|
|
|
- name: nginx
|
|
|
|
image: nginx:1.21-alpine
|
|
|
|
ports:
|
|
|
|
- containerPort: 443
|
|
|
|
volumeMounts:
|
|
|
|
- name: nginx-config
|
|
|
|
mountPath: "/etc/nginx/conf.d/"
|
|
|
|
- name: etcletsencrypt
|
|
|
|
mountPath: "/etc/letsencrypt"
|
|
|
|
- name: postgres
|
|
|
|
image: postgres:13
|
|
|
|
ports:
|
|
|
|
- containerPort: 5432
|
|
|
|
envFrom:
|
2021-07-17 18:12:27 +00:00
|
|
|
- secretRef:
|
2021-07-01 16:29:33 +00:00
|
|
|
name: {{ tpl .Values.identifier . }}-postgres-config
|
|
|
|
volumeMounts:
|
|
|
|
- name: postgres-data
|
|
|
|
mountPath: "/var/lib/postgresql/data"
|
2021-07-17 18:47:54 +00:00
|
|
|
# Use subpath to avoid lost+found error
|
2021-07-01 16:29:33 +00:00
|
|
|
subPath: postgres
|
|
|
|
- name: matrix
|
2021-07-17 18:47:54 +00:00
|
|
|
# SYNAPSE_CONFIG_DIR: where additional configs are placed -> postgres-db.yaml
|
|
|
|
# SYNAPSE_CONFIG_PATH: the initial config
|
|
|
|
# log.yaml -> same dir as postgres-db.yaml
|
|
|
|
# /data = persistent storage
|
2021-07-17 18:12:36 +00:00
|
|
|
image: ungleich/ungleich-matrix-synapse:{{ .Values.synapseVersion }}
|
2021-07-17 22:16:35 +00:00
|
|
|
imagePullPolicy: Always
|
2021-07-01 16:29:33 +00:00
|
|
|
ports:
|
|
|
|
- containerPort: 8008
|
|
|
|
env:
|
2021-07-17 18:47:54 +00:00
|
|
|
- name: SYNAPSE_CONFIG_PATH
|
|
|
|
value: "/baseconfig/homeserver.yaml"
|
2021-07-17 18:12:27 +00:00
|
|
|
- name: SYNAPSE_CONFIG_DIR
|
|
|
|
value: "/config"
|
2021-07-17 18:47:54 +00:00
|
|
|
|
2021-07-01 16:29:33 +00:00
|
|
|
volumeMounts:
|
|
|
|
- name: data
|
|
|
|
mountPath: "/data"
|
|
|
|
- name: matrix-config
|
2021-07-17 18:47:54 +00:00
|
|
|
mountPath: "/baseconfig"
|
2021-07-01 16:29:33 +00:00
|
|
|
volumes:
|
|
|
|
- name: etcletsencrypt
|
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: {{ tpl .Values.identifier . }}-letsencrypt-certs
|
|
|
|
- name: data
|
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: {{ tpl .Values.identifier . }}-data
|
|
|
|
- name: postgres-data
|
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: {{ tpl .Values.identifier . }}-postgres-data
|
2021-07-17 20:07:30 +00:00
|
|
|
- name: postgres-vars
|
|
|
|
secret:
|
|
|
|
secretName: {{ tpl .Values.identifier . }}-postgres-config
|
2021-07-01 16:29:33 +00:00
|
|
|
- name: nginx-config
|
|
|
|
configMap:
|
|
|
|
name: {{ tpl .Values.identifier . }}-nginx-config
|
|
|
|
- name: matrix-config
|
|
|
|
configMap:
|
|
|
|
name: {{ tpl .Values.identifier . }}-matrix-config
|
2021-07-17 18:12:36 +00:00
|
|
|
items:
|
|
|
|
- key: homeserver.yaml
|
|
|
|
path: homeserver.yaml
|
|
|
|
- key: log.yaml
|
|
|
|
path: log.yaml
|
2021-07-01 16:29:33 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: {{ tpl .Values.identifier . }}
|
|
|
|
labels:
|
|
|
|
app: {{ tpl .Values.identifier . }}
|
|
|
|
spec:
|
|
|
|
type: ClusterIP
|
|
|
|
ports:
|
|
|
|
# Required for letsencrypt
|
|
|
|
- port: 80
|
|
|
|
name: http
|
|
|
|
- port: 443
|
|
|
|
name: https
|
|
|
|
selector:
|
|
|
|
use-as-service: {{ .Release.Name }}
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
2021-07-17 18:12:27 +00:00
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: {{ tpl .Values.identifier . }}-web
|
|
|
|
labels:
|
|
|
|
app: {{ tpl .Values.identifier . }}-web
|
|
|
|
spec:
|
|
|
|
type: ClusterIP
|
|
|
|
ports:
|
|
|
|
# Required for letsencrypt
|
|
|
|
- port: 80
|
|
|
|
name: http
|
|
|
|
- port: 443
|
|
|
|
name: https
|
|
|
|
selector:
|
|
|
|
use-as-service: {{ .Release.Name }}-web
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
2021-07-01 16:29:33 +00:00
|
|
|
kind: PersistentVolumeClaim
|
|
|
|
metadata:
|
|
|
|
name: {{ tpl .Values.identifier . }}-letsencrypt-certs
|
|
|
|
spec:
|
|
|
|
accessModes:
|
|
|
|
- ReadWriteMany
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: 50Mi
|
|
|
|
storageClassName: rook-cephfs
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: PersistentVolumeClaim
|
|
|
|
metadata:
|
|
|
|
name: {{ tpl .Values.identifier . }}-data
|
|
|
|
spec:
|
|
|
|
accessModes:
|
|
|
|
- ReadWriteMany
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: 1Gi
|
|
|
|
storageClassName: rook-cephfs
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: PersistentVolumeClaim
|
|
|
|
metadata:
|
|
|
|
name: {{ tpl .Values.identifier . }}-postgres-data
|
|
|
|
spec:
|
|
|
|
accessModes:
|
|
|
|
- ReadWriteOnce
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: 500Mi
|
|
|
|
storageClassName: rook-ceph-block
|
|
|
|
---
|
2021-07-17 20:07:30 +00:00
|
|
|
# apiVersion: batch/v1
|
|
|
|
# kind: Job
|
|
|
|
# metadata:
|
|
|
|
# name: {{ tpl .Values.identifier . }}-getcert
|
|
|
|
# spec:
|
|
|
|
# template:
|
|
|
|
# metadata:
|
|
|
|
# labels:
|
|
|
|
# app: certbot-letsencrypt-getcert
|
|
|
|
# use-as-service: {{ .Release.Name }}
|
|
|
|
# spec:
|
|
|
|
# restartPolicy: Never
|
|
|
|
# containers:
|
|
|
|
# - name: certbot
|
|
|
|
# image: ungleich/ungleich-certbot
|
|
|
|
# ports:
|
|
|
|
# - containerPort: 80
|
|
|
|
# env:
|
|
|
|
# - name: DOMAIN
|
|
|
|
# value: "{{ tpl .Values.fqdn . }}"
|
|
|
|
# - name: EMAIL
|
|
|
|
# value: "{{ .Values.email }}"
|
|
|
|
# {{ if eq .Values.letsencryptStaging "no" }}
|
|
|
|
# - name: STAGING
|
|
|
|
# value: "no"
|
|
|
|
# {{ end }}
|
|
|
|
# volumeMounts:
|
|
|
|
# - name: etcletsencrypt
|
|
|
|
# mountPath: "/etc/letsencrypt"
|
|
|
|
# volumes:
|
|
|
|
# - name: etcletsencrypt
|
|
|
|
# persistentVolumeClaim:
|
|
|
|
# claimName: {{ tpl .Values.identifier . }}-letsencrypt-certs
|
|
|
|
# backoffLimit: 3
|
|
|
|
#---
|
2021-07-01 16:29:33 +00:00
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
metadata:
|
|
|
|
name: {{ tpl .Values.identifier . }}-nginx-config
|
|
|
|
data:
|
|
|
|
default.conf: |
|
|
|
|
server {
|
|
|
|
listen 443 ssl http2;
|
|
|
|
listen [::]:443 ssl http2;
|
|
|
|
|
|
|
|
server_name {{ tpl .Values.fqdn . }};
|
|
|
|
|
|
|
|
ssl_certificate /etc/letsencrypt/live/{{ tpl .Values.fqdn . }}/fullchain.pem;
|
|
|
|
ssl_certificate_key /etc/letsencrypt/live/{{ tpl .Values.fqdn . }}/privkey.pem;
|
|
|
|
|
2021-07-16 14:28:54 +00:00
|
|
|
client_max_body_size {{ .Values.max_filesize_in_mb }}m;
|
2021-07-01 16:29:33 +00:00
|
|
|
|
|
|
|
location ~ /_matrix|/_synapse {
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_pass http://localhost:8008;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
2021-07-17 18:12:27 +00:00
|
|
|
kind: Secret
|
2021-07-01 16:29:33 +00:00
|
|
|
metadata:
|
|
|
|
name: {{ tpl .Values.identifier . }}-postgres-config
|
2021-07-17 18:12:27 +00:00
|
|
|
annotations:
|
|
|
|
secret-generator.v1.mittwald.de/autogenerate: POSTGRES_PASSWORD
|
2021-07-17 20:07:30 +00:00
|
|
|
stringData:
|
2021-07-17 18:12:36 +00:00
|
|
|
POSTGRES_USER: "matrix-synapse"
|
|
|
|
POSTGRES_DB: "matrix-synapse"
|
|
|
|
POSTGRES_HOST: "localhost"
|
2021-07-01 16:29:33 +00:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
metadata:
|
|
|
|
name: {{ tpl .Values.identifier . }}-matrix-config
|
|
|
|
data:
|
|
|
|
homeserver.yaml: |
|
|
|
|
server_name: "{{ .Values.server_name }}"
|
|
|
|
web_client_location: "{{ .Values.web_client_location }}"
|
|
|
|
|
|
|
|
public_baseurl: "{{ tpl .Values.fqdn . }}"
|
|
|
|
|
|
|
|
allow_public_rooms_without_auth: true
|
|
|
|
allow_public_rooms_over_federation: false
|
|
|
|
|
|
|
|
pid_file: "/var/run/matrix/homeserver.pid"
|
2021-07-17 18:12:27 +00:00
|
|
|
report_stats: false
|
|
|
|
signing_key_path: "/data/signin.key"
|
2021-07-01 16:29:33 +00:00
|
|
|
|
|
|
|
listeners:
|
|
|
|
- port: 8008
|
|
|
|
tls: false
|
|
|
|
type: http
|
|
|
|
x_forwarded: true
|
|
|
|
bind_addresses:
|
|
|
|
- '::1'
|
|
|
|
- '127.0.0.1'
|
|
|
|
|
|
|
|
resources:
|
2021-07-16 14:28:54 +00:00
|
|
|
- names: [federation,client]
|
2021-07-01 16:29:33 +00:00
|
|
|
compress: false
|
|
|
|
- port: 9093
|
|
|
|
bind_addresses:
|
|
|
|
- '::1'
|
|
|
|
- '127.0.0.1'
|
|
|
|
|
|
|
|
type: http
|
|
|
|
resources:
|
|
|
|
- names: [replication]
|
|
|
|
|
|
|
|
database:
|
|
|
|
name: "psycopg2"
|
|
|
|
args:
|
|
|
|
database: "matrix-synapse"
|
|
|
|
host: "localhost"
|
|
|
|
user: "matrix-synapse"
|
|
|
|
password: ""
|
|
|
|
cp_min: 10
|
|
|
|
cp_min: 5
|
|
|
|
|
2021-07-17 20:48:48 +00:00
|
|
|
log_config: "/baseconfig/log.yaml"
|
2021-07-01 16:29:33 +00:00
|
|
|
|
|
|
|
enable_media_repo: true
|
2021-07-17 18:12:27 +00:00
|
|
|
media_store_path: "/data/media"
|
2021-07-16 14:28:54 +00:00
|
|
|
max_upload_size: "{{ .Values.max_filesize_in_mb }}M"
|
|
|
|
enable_registration: {{ .Values.enable_registration }}
|
2021-07-01 16:29:33 +00:00
|
|
|
|
|
|
|
log.yaml: |
|
|
|
|
version: 1
|
|
|
|
|
|
|
|
formatters:
|
|
|
|
fmt:
|
|
|
|
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s- %(message)s'
|
|
|
|
|
|
|
|
filters:
|
|
|
|
context:
|
|
|
|
(): synapse.logging.context.LoggingContextFilter
|
|
|
|
request: ""
|
|
|
|
|
|
|
|
handlers:
|
|
|
|
console:
|
|
|
|
class: logging.StreamHandler
|
|
|
|
formatter: fmt
|
|
|
|
filters: [context]
|
|
|
|
|
|
|
|
root:
|
|
|
|
level: INFO
|
|
|
|
handlers: [console] # to use file handler instead, switch to [file]
|
|
|
|
|
|
|
|
loggers:
|
|
|
|
synapse:
|
|
|
|
level: INFO
|
|
|
|
|
|
|
|
synapse.storage.SQL:
|
|
|
|
level: INFO
|
|
|
|
|
|
|
|
# example of enabling debugging for a component:
|
|
|
|
#
|
|
|
|
# synapse.federation.transport.server:
|
|
|
|
# level: DEBUG
|