matrix-synapse

by 0hlov3

Helm chartv1.0.42App v1.165.0

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

NameDescriptionValue
image.registryGlobal Docker image registryghcr.io
image.repositoryGlobal Docker registry secret names as an arrayelement-hq/synapse
image.pullPolicydefault image pullPolicyIfNotPresent
image.tagdefault image tag""

Synapse Config

NameDescriptionValue
config.server.server_nameThis sets the public-facing domain of the server e.g. matrix.org or localhost:8080.""
config.server.public_baseurlThe 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_locationThe absolute URL to the web client which / will redirect to. Defaults to none.""
config.server.serve_server_wellknownBy default, other servers will try to reach our server on port 8448, which can be inconvenient in some environments.false
config.server.email.enabledEnabled the rendering of the emailconfigfalse
config.server.email.smtp_hostThe hostname of the outgoing SMTP server to use.""
config.server.email.smtp_portThe port on the mail server for outgoing SMTP.""
config.server.email.smtp_userUsername for authentication to the SMTP server""
config.server.email.smtp_passpassword for authentication to the SMTP server""
config.server.email.existingSecret.namethe name for the SMTP Secret Configuration""
config.server.email.existingSecret.keys.smtp_hostThe secret key of the smtp_host overrides smtp_host.""
config.server.email.existingSecret.keys.smtp_portThe secret key of the smtp_port overrides smtp_port.""
config.server.email.existingSecret.keys.smtp_userThe secret key of the smtp_user overrides smtp_user.""
config.server.email.existingSecret.keys.smtp_passThe secret key of the smtp_pass overrides smtp_pass.""
config.server.email.force_tlsBy default, Synapse connects over plain text and then optionally upgrades to TLS via STARTTLS.""
config.server.email.require_transport_securitySet to true to require TLS transport security for SMTP.""
config.server.email.enable_tlsBy 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_fromdefines the "From" address to use when sending emails. It must be set if email sending is enabled.""
config.server.email.enable_notifsSet to true to allow users to receive e-mail notifications.""
config.server.email.client_base_urlCustom URL for client links within the email notifications.""
config.mediaStore.enable_media_repoEnable the media store service in the Synapse master. Defaults to true.true
config.mediaStore.persistence.enabledEnable persistence mediaStore, if false refers to emptyDir (not recommendet).true
config.mediaStore.persistence.sizeDefines the Size of Peristant volume for Media.2Gi
config.mediaStore.persistence.accessModeEnable persistence for SQLite data.ReadWriteOnce
config.mediaStore.persistence.storageClassNameIf empty uses the default storageClass.""
config.metrics.enable_metricsSet to true to enable collection and rendering of performance metrics. Defaults to false.false
config.metrics.report_statsWhether or not to report homeserver usage statistics. This is originally set when generating the config.false
config.metrics.serviceMonitor.enabledIf the serviceMonitor should be deployed.false
config.metrics.prometheusRule.enabledIf the PrometheusRule should be deployed.false
config.metrics.prometheusRule.rulesPrometheus Rules to deploy.[]
config.registration.enable_registrationEnable registration for new users. Defaults to false.false
config.registration.enable_registration_without_verificationEnable 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartmatrix-synapse is pinned at v1.0.42 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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