ESS Community for homelabs
ESS Community on one k3s node at home, with database and media backups you’ve restored. Your homeserver federates, its PostgreSQL databases back up to object storage every night, and restic copies its media, values and generated secrets off the machine. You restore a database into a new cluster and find your user in it, and restore your uploaded image from restic.
TODO: these steps haven’t been run yet; run them end to end (and in CI) before publishing.
This guide sets up Element Server Suite Community (ESS Community) on a single machine at home, then backs it up and restores the backups once, so you know they work. A backup that’s never been restored is a hope, not a backup.
This isn’t Element’s user documentation, and the setup isn’t suitable for production. It’s one way to run ESS Community for yourself, with choices made for a homelab. The supported way to install ESS Community is the ESS Community README and its maintenance guide; for ESS Pro, see Element’s documentation. If you only want to see ESS working first, try ESS Community on a development machine.
The setup accepts three trade-offs on purpose:
- One node. k3s runs as a single-node cluster. If the machine fails, everything on it stops until you rebuild it from backups.
- Downtime is acceptable. Upgrades restart Synapse and Matrix Authentication Service (MAS), and nothing takes over while the node is down.
- Volume backups aren’t atomic. restic copies Synapse’s media files while Synapse runs. That’s good enough for media in a homelab; the databases, which need consistency, are backed up by CloudNativePG instead.
The ESS Community README recommends a dedicated PostgreSQL server over the one bundled with the chart, installed from your distribution’s packages. Here, CloudNativePG (CNPG) runs PostgreSQL in the same cluster, because it describes scheduled backups, write-ahead log (WAL) archiving and restores as Kubernetes resources.
1. Point your domain at your home
This step makes your hostnames resolve to your home connection, and lets traffic in. ESS Community serves six hostnames. The examples use example.com; replace it with your domain everywhere:
| Hostname | Serves |
|---|---|
example.com | The server name in Matrix IDs such as @alice:example.com, and the .well-known files that delegate to Synapse |
matrix.example.com | Synapse |
account.example.com | Matrix Authentication Service |
chat.example.com | Element Web |
admin.example.com | Element Admin |
mrtc.example.com | The MatrixRTC backend, for Element Call |
The server name can’t be changed later without resetting the database, so pick it with care.
Create an A record (or AAAA for IPv6) for each hostname, pointing to your public IP address. Then forward these ports on your router to the machine, as the ESS Community README lists them:
- TCP 80: Let’s Encrypt checks you control each hostname by fetching a file over HTTP, and its HTTP-01 challenge only works on port 80. Some residential ISPs block port 80; if yours does, this setup won’t get certificates as written.
- TCP 443: HTTPS for every hostname. Federation needs it from the whole internet: other homeservers fetch
https://example.com/.well-known/matrix/server, which ESS fills in withmatrix.example.com:443, then connect to Synapse there. - TCP 30001 and UDP 30002: WebRTC media for Element Call, through the MatrixRTC backend.
Everything on these ports is reachable from the internet once it’s forwarded, so only forward them to this machine. If the machine runs a firewall, follow k3s’s firewall guidance as well.
2. Install k3s on one node
This step creates the single-node Kubernetes cluster. Install k3s with its install script, pinned to a version that CloudNativePG 1.30 supports:
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.36.6+k3s1 sh -
Copy k3s’s kubeconfig to your home directory, so kubectl and helm work without sudo (from the ESS Community README):
mkdir ~/.kube
export KUBECONFIG=~/.kube/config
sudo k3s kubectl config view --raw > "$KUBECONFIG"
chmod 600 "$KUBECONFIG"
chown "$USER:$USER" "$KUBECONFIG"
Add export KUBECONFIG=~/.kube/config to ~/.bashrc to keep it in new shells.
k3s ships the Traefik ingress controller. ESS needs it to trust forwarded headers from inside the cluster and to accept encoded slashes and hashes in URLs. Save the following as /var/lib/rancher/k3s/server/manifests/traefik-config.yaml (as root; k3s applies files in that directory automatically):
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
ports:
web:
forwardedHeaders:
trustedIPs:
- "10.42.0.0/16"
- "2001:db8:42::/56"
http:
encodedCharacters:
allowEncodedHash: true
allowEncodedSlash: true
websecure:
forwardedHeaders:
trustedIPs:
- "10.42.0.0/16"
- "2001:db8:42::/56"
http:
encodedCharacters:
allowEncodedHash: true
allowEncodedSlash: true
The node should now be Ready:
kubectl get nodes
k3s keeps persistent volumes on the node’s disk, under /var/lib/rancher/k3s/storage. Everything ESS and PostgreSQL store ends up there, which is why the backups in steps 6 and 10 go to another machine.
3. Install Helm
This step installs Helm, which installs everything else. Use Helm’s installer script, pinned to a release:
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-4
chmod 700 get_helm.sh
./get_helm.sh --version v4.3.2
4. Get certificates from Let’s Encrypt
This step installs cert-manager, which requests and renews a certificate for each hostname. The Barman Cloud plugin in step 5 needs cert-manager too.
helm install cert-manager oci://quay.io/jetstack/charts/cert-manager \
--version v1.21.3 \
--namespace cert-manager \
--create-namespace \
--set crds.enabled=true
Create a ClusterIssuer for Let’s Encrypt, which answers HTTP-01 challenges through Traefik. The ESS chart refers to it by name:
kubectl apply -f - <<EOF
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
name: letsencrypt-prod-private-key
solvers:
- http01:
ingress:
class: traefik
EOF
This is the issuer from the ESS Community README. Certificates are only requested once ESS is installed, in step 8.
TODO: cert-manager’s documentation recommends ingressClassName over class for most ingress controllers. Check the name of k3s’s Traefik IngressClass and whether the ESS README should switch.
5. Install CloudNativePG and its backup plugin
This step installs the operator that runs PostgreSQL, and the plugin that backs it up. Apply the operator manifest for CloudNativePG 1.30.2, as its installation guide shows, and wait for it:
kubectl apply --server-side -f \
https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.30/releases/cnpg-1.30.2.yaml
kubectl rollout status deployment -n cnpg-system cnpg-controller-manager
CloudNativePG can back up to object storage in two ways. Its in-tree barmanObjectStore support has been deprecated since 1.26, and the documentation recommends the Barman Cloud plugin instead, so this guide uses the plugin. It must run in the operator’s namespace, and requires cert-manager:
kubectl apply -f \
https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v0.16.0/manifest.yaml
kubectl -n cnpg-system rollout status deploy/barman-cloud
6. Send database backups to object storage
This step tells the plugin where to store base backups and WAL files. Pick any S3-compatible object store, as long as it isn’t on this machine: a backup that fails with the node isn’t one. Create a bucket and an access key there, then create the ess namespace and store the key in it. The read commands ask for the key, so it stays out of your shell history:
kubectl create namespace ess
read -r -p 'Access key ID: ' ACCESS_KEY_ID
read -r -s -p 'Secret access key: ' ACCESS_SECRET_KEY
kubectl create secret generic backup-object-store -n ess \
--from-literal=ACCESS_KEY_ID="$ACCESS_KEY_ID" \
--from-literal=ACCESS_SECRET_KEY="$ACCESS_SECRET_KEY"
Save the following as ~/ess-homelab/object-store.yaml, replacing the bucket and endpoint with yours. These are the only fields that depend on your provider:
destinationPath: the bucket, and a folder inside it, as ans3://URL.endpointURL: your provider’s S3 endpoint. Leave the line out for Amazon S3 itself.retentionPolicy: how far back you can restore. With30d, backups that are no longer needed to restore any point in the last 30 days are deleted after the next backup.
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
name: homelab-backups
namespace: ess
spec:
retentionPolicy: "30d"
configuration:
destinationPath: s3://BUCKET_NAME/ess/
endpointURL: https://s3.provider.example
s3Credentials:
accessKeyId:
name: backup-object-store
key: ACCESS_KEY_ID
secretAccessKey:
name: backup-object-store
key: ACCESS_SECRET_KEY
wal:
compression: gzip
kubectl apply -f ~/ess-homelab/object-store.yaml
Both databases share this store: the plugin writes each cluster’s files under a folder named after the cluster. Some S3-compatible providers reject the plugin’s uploads with an x-amz-content-sha256 error; the plugin documentation has a workaround.
7. Create the databases and schedule their backups
This step creates two PostgreSQL clusters, one for Synapse and one for MAS, each with a nightly backup. CloudNativePG’s FAQ recommends one database per cluster, partly because backups and restores work per cluster. Both use PostgreSQL 17, the major version the ESS chart bundles.
Create a password for each database user. CloudNativePG accepts them as basic-auth secrets whose username matches the database owner. Providing them yourself, rather than letting the operator generate them, means a restored cluster can reuse them:
kubectl create secret generic synapse-db-credentials -n ess \
--type=kubernetes.io/basic-auth \
--from-literal=username=synapse \
--from-literal=password="$(openssl rand -hex 32)"
kubectl create secret generic mas-db-credentials -n ess \
--type=kubernetes.io/basic-auth \
--from-literal=username=mas \
--from-literal=password="$(openssl rand -hex 32)"
Synapse needs its database created with UTF8 encoding and the C locale. CloudNativePG passes these settings to initdb; they’re its defaults, but setting them makes the requirement visible. MAS’s database guide creates its database without special settings. The plugins section turns on WAL archiving to the object store.
Save the following as ~/ess-homelab/databases.yaml:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: synapse-db
namespace: ess
spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgresql:17.11-standard-trixie
storage:
size: 10Gi
bootstrap:
initdb:
database: synapse
owner: synapse
secret:
name: synapse-db-credentials
encoding: UTF8
localeCollate: C
localeCType: C
plugins:
- name: barman-cloud.cloudnative-pg.io
isWALArchiver: true
parameters:
barmanObjectName: homelab-backups
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: mas-db
namespace: ess
spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgresql:17.11-standard-trixie
storage:
size: 5Gi
bootstrap:
initdb:
database: mas
owner: mas
secret:
name: mas-db-credentials
plugins:
- name: barman-cloud.cloudnative-pg.io
isWALArchiver: true
parameters:
barmanObjectName: homelab-backups
instances: 1 is the single-node trade-off again: there’s no standby to fail over to.
Save the backup schedules as ~/ess-homelab/scheduled-backups.yaml. CloudNativePG’s schedule has six fields, starting with seconds, so 0 0 3 * * * means 03:00 every day. immediate: true takes the first backup straight away:
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: synapse-db-nightly
namespace: ess
spec:
schedule: "0 0 3 * * *"
immediate: true
backupOwnerReference: self
cluster:
name: synapse-db
method: plugin
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
---
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: mas-db-nightly
namespace: ess
spec:
schedule: "0 0 3 * * *"
immediate: true
backupOwnerReference: self
cluster:
name: mas-db
method: plugin
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
Apply both files, and wait for the clusters to be ready:
kubectl apply -f ~/ess-homelab/databases.yaml
kubectl apply -f ~/ess-homelab/scheduled-backups.yaml
kubectl wait --for=condition=Ready cluster/synapse-db cluster/mas-db -n ess --timeout=10m
Then check that backups work, using the conditions CloudNativePG sets on each cluster. ContinuousArchiving means WAL files are reaching the object store, and LastBackupSucceeded means the first base backup finished:
kubectl wait --for=condition=ContinuousArchiving cluster/synapse-db cluster/mas-db -n ess --timeout=10m
kubectl wait --for=condition=LastBackupSucceeded cluster/synapse-db cluster/mas-db -n ess --timeout=15m
kubectl get backups -n ess
kubectl get backups lists one backup per cluster, in the completed phase. If a condition stays false, kubectl get cluster synapse-db -n ess -o yaml shows the error in its status, and the plugin’s sidecar logs (kubectl logs -n ess synapse-db-1 -c plugin-barman-cloud) usually say why: most often a wrong endpoint, bucket or key.
8. Install ESS Community
This step installs the ESS chart, pointed at your databases instead of its bundled PostgreSQL. Keep the values files together, so you can back them up in step 10 and reuse them for upgrades:
mkdir -p ~/ess-config-values
Save the hostnames as ~/ess-config-values/hostnames.yaml (the keys come from the chart’s quick setup example):
serverName: example.com
synapse:
ingress:
host: matrix.example.com
matrixAuthenticationService:
ingress:
host: account.example.com
elementWeb:
ingress:
host: chat.example.com
elementAdmin:
ingress:
host: admin.example.com
matrixRTC:
ingress:
host: mrtc.example.com
Save the certificate settings as ~/ess-config-values/tls.yaml. With certManager.clusterIssuer set, the chart annotates each ingress so cert-manager requests its certificate from the issuer you created in step 4:
certManager:
clusterIssuer: letsencrypt-prod
Save the database settings as ~/ess-config-values/postgresql.yaml. The keys follow the chart’s external PostgreSQL example; the passwords come from the secrets you created in step 7, which the chart reads by name and key. CloudNativePG’s -rw service always points at the primary. Its PostgreSQL instances serve TLS by default, with certificates signed by a CA the operator creates, so sslMode: require makes Synapse and MAS connect over TLS. Checking the server’s certificate as well (verify-ca or verify-full) would need that CA in their pods, which this guide doesn’t set up:
postgres:
enabled: false
synapse:
postgres:
host: synapse-db-rw
port: 5432
user: synapse
database: synapse
sslMode: require
password:
secret: synapse-db-credentials
secretKey: password
matrixAuthenticationService:
postgres:
host: mas-db-rw
port: 5432
user: mas
database: mas
sslMode: require
password:
secret: mas-db-credentials
secretKey: password
Install the chart, pinned to a release:
helm upgrade --install --namespace ess ess \
oci://ghcr.io/element-hq/ess-helm/matrix-stack \
--version 26.11.4 \
-f ~/ess-config-values/hostnames.yaml \
-f ~/ess-config-values/tls.yaml \
-f ~/ess-config-values/postgresql.yaml \
--wait
When it returns, list the persistent volume claims in the namespace:
kubectl get pvc -n ess
There are three: synapse-db-1 and mas-db-1 hold the PostgreSQL data, and ess-synapse-media holds Synapse’s media store. Media files live outside the database; Synapse keeps their metadata in its local_media_repository table, and the files themselves on disk. The chart creates no other volume unless you enable Hookshot with encryption, or its bundled PostgreSQL.
The chart also generated credentials the first time it ran, and stored them in a secret named ess-generated. They include Synapse’s signing key, which other homeservers use to verify your server’s events, and MAS’s encryption secret, which encrypts fields in the MAS database. Restore the databases without this secret and the chart generates new credentials: MAS can’t read what it encrypted, and Synapse signs with a different key. Step 10 backs it up.
9. Create a user and check federation
This step proves ESS works from outside your network. Registration is closed by default, so create a user with MAS’s command-line tool, which asks for a username and what to do next (choose to set a password):
kubectl exec -n ess -it deploy/ess-matrix-authentication-service -- mas-cli manage register-user
Open https://chat.example.com, sign in as that user, and upload an image to a room, so Synapse’s media store has a file in it. Then check that other homeservers can reach yours, with the Matrix Federation Tester or its plain-text API:
curl -s "https://federationtester.matrix.org/api/federation-ok?server_name=example.com"
GOOD
If it says BAD, the tester’s web page shows which check failed. Also check the delegation file ESS serves on your server name, which should name matrix.example.com:443:
curl -s https://example.com/.well-known/matrix/server
10. Back up media, values and secrets with restic
This step copies everything CloudNativePG doesn’t cover to a restic repository off the machine, every night. The values files and generated secrets matter as much as the media: the ESS maintenance guide lists them alongside the database.
About consistency: restic reads Synapse’s media directory while Synapse writes to it. A file uploaded during the backup can be missed or half-copied, and the media files and the database’s metadata about them are copied at different times. For a homelab, that risk is acceptable: at worst, an upload from around backup time is missing after a restore. The databases need consistency, and get it from CloudNativePG’s base backups and WAL archive, not from restic. The ESS maintenance guide stops Synapse and MAS before backing up; this guide doesn’t, to avoid nightly downtime.
Install restic from its official binaries, checking the download against the published checksums. Use the arm64 file instead on an ARM machine:
curl -fsSLO https://github.com/restic/restic/releases/download/v0.19.1/restic_0.19.1_linux_amd64.bz2
curl -fsSLO https://github.com/restic/restic/releases/download/v0.19.1/SHA256SUMS
sha256sum --check --ignore-missing SHA256SUMS
bunzip2 restic_0.19.1_linux_amd64.bz2
sudo install -m 0755 restic_0.19.1_linux_amd64 /usr/local/bin/restic
restic version
Choose where the repository lives, on another machine or provider: restic supports many backends, such as SFTP, a REST server or an S3 bucket. Create a directory for the backup’s settings, readable by root only, and a random repository password:
sudo install -d -m 0700 /etc/ess-backup
openssl rand -base64 32 | sudo tee /etc/ess-backup/restic-password > /dev/null
sudo chmod 600 /etc/ess-backup/restic-password
Keep a copy of that password somewhere other than this machine, such as a password manager. As restic’s documentation warns, losing the password means the data in the repository is irrecoverably lost.
Save the following as /etc/ess-backup/restic.env (as root), with your repository and your home directory’s values path. Add the environment variables your backend needs, such as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY for S3:
RESTIC_REPOSITORY=sftp:backup@backup-host.example:/srv/restic-ess
RESTIC_PASSWORD_FILE=/etc/ess-backup/restic-password
ESS_VALUES_DIR=/home/alice/ess-config-values
sudo chmod 600 /etc/ess-backup/restic.env
Initialise the repository:
sudo bash -c 'set -a; . /etc/ess-backup/restic.env; restic init'
The backup script exports what lives only in Kubernetes to files, finds the media volume’s directory, then backs everything up. It finds the directory from the volume rather than hard-coding it, because the path includes the volume’s generated name: k3s’s local-path provisioner names it <volume>_<namespace>_<claim> under /var/lib/rancher/k3s/storage. The exports are:
- the secrets ESS generated, and the ConfigMap of deployment markers the chart uses to refuse unsafe changes, selected by the labels the maintenance guide gives
- the database credentials and object store key from steps 6 and 7, which CloudNativePG’s backups don’t include
Save it as /usr/local/sbin/ess-backup (as root):
#!/usr/bin/env bash
set -euo pipefail
umask 077
export_dir=/var/backups/ess
mkdir -p "$export_dir"
k3s kubectl get secrets -n ess \
-l app.kubernetes.io/managed-by=matrix-tools-init-secrets -o yaml \
> "$export_dir/generated-secrets.yaml"
k3s kubectl get configmap -n ess \
-l app.kubernetes.io/managed-by=matrix-tools-deployment-markers -o yaml \
> "$export_dir/deployment-markers.yaml"
k3s kubectl get secret -n ess \
synapse-db-credentials mas-db-credentials backup-object-store -o yaml \
> "$export_dir/homelab-secrets.yaml"
media_pv=$(k3s kubectl get pvc -n ess ess-synapse-media -o jsonpath='{.spec.volumeName}')
media_dir=$(k3s kubectl get pv "$media_pv" -o jsonpath='{.spec.hostPath.path}')
restic backup --tag ess "$export_dir" "$ESS_VALUES_DIR" "$media_dir"
restic forget --tag ess --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune
The exported secrets sit unencrypted in /var/backups/ess, readable by root only; in the repository, restic encrypts them with everything else. The forget line keeps a week of daily snapshots, a month of weekly ones and six months of monthly ones, then deletes the rest.
sudo chmod 700 /usr/local/sbin/ess-backup
Restic has no scheduler and suggests systemd or cron; this guide uses a systemd timer. Restic also advises making sure a scheduled run doesn’t start while the previous one is still going.
TODO: confirm, from systemd’s documentation, that a timer won’t start a second instance of a oneshot service that’s still running, and say so here.
Save the service as /etc/systemd/system/ess-backup.service:
[Unit]
Description=Back up ESS media, values and secrets with restic
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
EnvironmentFile=/etc/ess-backup/restic.env
ExecStart=/usr/local/sbin/ess-backup
Save the timer as /etc/systemd/system/ess-backup.timer. It runs at 03:30, after the database backups; Persistent=true runs a missed backup when the machine next starts:
[Unit]
Description=Run the ESS backup every night
[Timer]
OnCalendar=*-*-* 03:30:00
Persistent=true
[Install]
WantedBy=timers.target
Enable the timer, run the backup once now, and check its log and the next scheduled run:
sudo systemctl daemon-reload
sudo systemctl enable --now ess-backup.timer
sudo systemctl start ess-backup.service
journalctl -u ess-backup.service --no-pager
systemctl list-timers ess-backup.timer
11. Prove the backups restore
This step restores a database into a new cluster and the restic snapshot into a scratch directory, and checks your user and your image are in them. It doesn’t touch the running ESS.
CloudNativePG never restores in place: it bootstraps a new cluster from the backup. Restore the MAS database, where the user you created in step 9 lives. First take an on-demand backup, so the user is certainly in a completed backup. Save it as ~/ess-homelab/backup-now.yaml:
apiVersion: postgresql.cnpg.io/v1
kind: Backup
metadata:
name: mas-db-restore-test
namespace: ess
spec:
cluster:
name: mas-db
method: plugin
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
kubectl apply -f ~/ess-homelab/backup-now.yaml
kubectl wait --for=jsonpath='{.status.phase}'=completed backup/mas-db-restore-test -n ess --timeout=15m
Save the restored cluster as ~/ess-homelab/restore-test.yaml. It reads from the same object store, with serverName naming the cluster whose backups to use, as in the plugin’s restore example. The database, owner and secret fields reuse the original credentials once recovery completes:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: mas-db-restore
namespace: ess
spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgresql:17.11-standard-trixie
storage:
size: 5Gi
bootstrap:
recovery:
source: mas-db-backup
database: mas
owner: mas
secret:
name: mas-db-credentials
externalClusters:
- name: mas-db-backup
plugin:
name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: homelab-backups
serverName: mas-db
kubectl apply -f ~/ess-homelab/restore-test.yaml
kubectl wait --for=condition=Ready cluster/mas-db-restore -n ess --timeout=20m
kubectl exec -n ess mas-db-restore-1 -c postgres -- psql -d mas -c 'SELECT username FROM users;'
The query lists the user you created in step 9. That’s the database, restored from object storage alone. Restoring Synapse’s database works the same way, with synapse-db in place of mas-db.
Now restore the latest restic snapshot into a scratch directory:
sudo bash -c 'set -a; . /etc/ess-backup/restic.env; restic snapshots --tag ess'
sudo bash -c 'set -a; . /etc/ess-backup/restic.env; restic restore latest --tag ess --target /var/tmp/ess-restore-test'
sudo find /var/tmp/ess-restore-test -path '*media_store/local_content/*' -type f
sudo ls /var/tmp/ess-restore-test/var/backups/ess
Restic restores each path under the target with its full original path. The find lists the image you uploaded in step 9, in Synapse’s local_content layout, and the last command lists the three exported files.
Remove the test restore when you’re done:
kubectl delete cluster mas-db-restore -n ess
kubectl delete backup mas-db-restore-test -n ess
sudo rm -rf /var/tmp/ess-restore-test
For a real recovery on a rebuilt machine, the order follows the ESS maintenance guide: steps 2 to 6 again, then the exported secrets and ConfigMap back into the ess namespace, then the database clusters bootstrapped from the object store as above (with their names and plugins sections adjusted, since a restored cluster doesn’t archive WAL until you add them), then the chart with your values files, and the media copied into the new volume’s directory.
TODO: run a full recovery onto a fresh machine and turn the paragraph above into tested steps, including the serverName for the restored clusters’ own WAL archive and the postgresql.yaml changes for the new cluster names.
Upgrades
Upgrades are a helm upgrade with a new pinned version, and Synapse and MAS restart, which is the downtime this setup accepts. Before you upgrade, read the release notes and CHANGELOG for every version between yours and the new one, as the maintenance guide asks, and adjust your values files if they say so. Run the restic backup first, so the values and secrets in the repository match what you’re upgrading from, then upgrade to the version you’ve read about:
sudo systemctl start ess-backup.service
read -r -p 'New chart version: ' ESS_VERSION
helm upgrade --install --namespace ess ess \
oci://ghcr.io/element-hq/ess-helm/matrix-stack \
--version "$ESS_VERSION" \
-f ~/ess-config-values/hostnames.yaml \
-f ~/ess-config-values/tls.yaml \
-f ~/ess-config-values/postgresql.yaml \
--wait
k3s, cert-manager, CloudNativePG and the Barman Cloud plugin each have their own upgrade notes: k3s, cert-manager, CloudNativePG and the plugin.
Clean up
To remove the setup, stop the backup timer first, then remove ESS, its databases and their secrets with the namespace:
sudo systemctl disable --now ess-backup.timer
sudo rm /etc/systemd/system/ess-backup.service /etc/systemd/system/ess-backup.timer /usr/local/sbin/ess-backup
sudo systemctl daemon-reload
helm uninstall ess -n ess
kubectl delete namespace ess
Uninstalling k3s removes everything else on the machine, including every persistent volume under /var/lib/rancher/k3s/storage, so make sure you no longer need the data:
/usr/local/bin/k3s-uninstall.sh
sudo rm -rf /etc/ess-backup /var/backups/ess
rm -rf ~/ess-config-values ~/ess-homelab ~/.kube
The object store bucket and the restic repository are on other machines, and keep your backups until you delete them there.
Where the open-source products end
ESS Community is Element’s open-source distribution for non-professional use, evaluations and deployments of up to about 100 users. Element doesn’t support it: questions go to the issue tracker or the ESS Community Matrix room, and the CloudNativePG, restic and systemd parts of this setup are yours to run. Element’s page for ESS Community says it comes with no performance guarantees, certifications or Software Bill of Materials (SBOM), isn’t Cyber Resilience Act compliant, and has no vendor responsibility or security update management.
What this setup skips, and ESS Pro covers, according to the ESS README:
- in-cluster high availability and automatic scaling, through Synapse Pro, instead of one node and downtime
- S3 storage for media, instead of a local volume copied by restic
- L3 support, long-term support releases and security advisories
- the Secure Border Gateway for federation controls, LDAP and SCIM for user management, a content scanner for media, and AuditBot and AdminBot
Element’s comparison of editions has the full list.
Going further
- The ESS chart’s advanced setup, for configuring Synapse, MAS and Element Call, and its values file
- CloudNativePG’s backup and recovery documentation, including point-in-time recovery
- Restic’s documentation, including how to check a repository for damage