matrix-synapse
by 0hlov3
A Helm chart for deploying Matrix Synapse on Kubernetes
About this chart
Matrix Synapse Helm Chart [WiP]
This Helm chart deploys a Matrix Synapse homeserver instance on a Kubernetes cluster. It supports various configurations, including SQLite and external PostgreSQL databases, and integrates seamlessly with Kubernetes-native resources for high availability and scalability.
⚠️ Important Warning - BIG REFACTOR
Please review your values file before updating, we did a complete new chart for refactoring.
Features
- Flexible database configurations: Supports both SQLite and external PostgreSQL.
- Persistent volume support for media storage.
- Customizable secrets management for secure deployments.
- Integration with external SMTP for email notifications.
- Health checks for liveness and readiness probes.
- Optional Ingress configuration for public access.
- Metrics collection and reporting options.
Prerequisites
- Kubernetes 1.19+
- Helm 3.7.0+ (for JSON Schema validation)
- PV provisioner for persistent volume support (if enabled)
Installation
1. Add the Helm Repository
helm repo add schoenwald https://charts.schoenwald.aero
helm repo update schoenwald
2. Install the Chart
helm install matrix-synapse schoenwald/matrix-synapse --namespace synapse --create-namespace
3. Provide Custom Values
Create a values.yaml file to override default values:
config:
server:
server_name: "example.com"
public_baseurl: "https://example.com/"
sqlite:
enabled: true
externalPostgresql:
enabled: false
signingkey:
job:
enabled: true
Install the chart using the custom values:
helm install matrix-synapse 0hlov3/matrix-synapse -f values.yaml
Configuration
Database
You must Choose between SQLite or external PostgreSQL for the database backend. If none is choosen the Chart will fail Enable the desired database in your values.yaml:
SQLite
sqlite:
enabled: true
externalPostgresql:
enabled: false
External PostgreSQL:
sqlite:
enabled: false
externalPostgresql:
enabled: true
host: "your-database-host"
port: 5432
database: "synapse"
username: "your-username"
password: "your-password"
Media Store
Enable persistent storage for media:
config:
mediaStore:
enable_media_repo: true
persistence:
enabled: true
size: 10Gi
accessMode: ReadWriteOnce
Secrets
Secure sensitive information such as database credentials and SMTP settings using Kubernetes secrets. Reference existing secrets in your values.yaml:
externalPostgresql:
existingSecret:
name: "db-credentials"
keys:
username: "db-username-key"
password: "db-password-key"
Create first User
After deploying your Chart you may want to create the first USer/Admin, for theat check the containers in your Release Namespace:
kubectl get pods -n synapse
Exec into the Container
kubectl exec -n synapse -ti matrix-synapse-* -- /bin/bash
Register you first user when you are logged in to your container.
register_new_matrix_user http://localhost:8008 -c /synapse/config/homeserver.yaml -c /synapse/config/conf.d/secrets.yaml
ArgoCD
When you are using Argocd it you may should set
ignoreDifferences:
- group: ""
kind: Secret
name: signingkey-matrix-synapse
jsonPointers:
- /data
syncPolicy:
syncOptions:
- CreateNamespace=true
- RespectIgnoreDifferences=true
Parameters
Synapse Image
| Name | Description | Value |
|---|---|---|
image.registry | Global Docker image registry | ghcr.io |
image.repository | Global Docker registry secret names as an array | element-hq/synapse |
image.pullPolicy | default image pullPolicy | IfNotPresent |
image.tag | default image tag | "" |
Synapse Config
| Name | Description | Value |
|---|---|---|
config.server.server_name | This sets the public-facing domain of the server e.g. matrix.org or localhost:8080. | "" |
config.server.public_baseurl | The public-facing base URL that clients use to access this Homeserver (not including _matrix/...). This is the same URL a user might enter into the 'Custom Homeserver URL' field on their client. | "" |
config.server.web_client_location | The absolute URL to the web client which / will redirect to. Defaults to none. | "" |
config.server.serve_server_wellknown | By default, other servers will try to reach our server on port 8448, which can be inconvenient in some environments. | false |
config.server.email.enabled | Enabled the rendering of the emailconfig | false |
config.server.email.smtp_host | The hostname of the outgoing SMTP server to use. | "" |
config.server.email.smtp_port | The port on the mail server for outgoing SMTP. | "" |
config.server.email.smtp_user | Username for authentication to the SMTP server | "" |
config.server.email.smtp_pass | password for authentication to the SMTP server | "" |
config.server.email.existingSecret.name | the name for the SMTP Secret Configuration | "" |
config.server.email.existingSecret.keys.smtp_host | The secret key of the smtp_host overrides smtp_host. | "" |
config.server.email.existingSecret.keys.smtp_port | The secret key of the smtp_port overrides smtp_port. | "" |
config.server.email.existingSecret.keys.smtp_user | The secret key of the smtp_user overrides smtp_user. | "" |
config.server.email.existingSecret.keys.smtp_pass | The secret key of the smtp_pass overrides smtp_pass. | "" |
config.server.email.force_tls | By default, Synapse connects over plain text and then optionally upgrades to TLS via STARTTLS. | "" |
config.server.email.require_transport_security | Set to true to require TLS transport security for SMTP. | "" |
config.server.email.enable_tls | By default, if the server supports TLS, it will be used, and the server must present a certificate that is valid for 'smtp_host'. | "" |
config.server.email.notif_from | defines the "From" address to use when sending emails. It must be set if email sending is enabled. | "" |
config.server.email.enable_notifs | Set to true to allow users to receive e-mail notifications. | "" |
config.server.email.client_base_url | Custom URL for client links within the email notifications. | "" |
config.mediaStore.enable_media_repo | Enable the media store service in the Synapse master. Defaults to true. | true |
config.mediaStore.persistence.enabled | Enable persistence mediaStore, if false refers to emptyDir (not recommendet). | true |
config.mediaStore.persistence.size | Defines the Size of Peristant volume for Media. | 2Gi |
config.mediaStore.persistence.accessMode | Enable persistence for SQLite data. | ReadWriteOnce |
config.mediaStore.persistence.storageClassName | If empty uses the default storageClass. | "" |
config.metrics.enable_metrics | Set to true to enable collection and rendering of performance metrics. Defaults to false. | false |
config.metrics.report_stats | Whether or not to report homeserver usage statistics. This is originally set when generating the config. | false |
config.metrics.serviceMonitor.enabled | If the serviceMonitor should be deployed. | false |
config.metrics.prometheusRule.enabled | If the PrometheusRule should be deployed. | false |
config.metrics.prometheusRule.rules | Prometheus Rules to deploy. | [] |
config.registration.enable_registration | Enable registration for new users. Defaults to false. | false |
config.registration.enable_registration_without_verification | Enable registration without email or captcha verification. | false |
config.registration.registration_shared_secret |
Deploy matrix-synapse with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has matrix-synapse on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartmatrix-synapse is pinned at v1.0.42 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply