Contents
In order to upgrade your deployment, you should:
- Read the release notes of the new version and check if there are any breaking changes. The file CHANGELOG.md should be your first stop.
- Adjust your values if necessary.
- Re-run the install command. It will upgrade your installation to the latest version of the chart.
You need to backup a couple of things to be able to restore your deployment:
- Stop Synapse and Matrix Authentication Service workloads:
kubectl scale sts -l "app.kubernetes.io/component=matrix-server" -n ess --replicas=0
kubectl scale deploy -l "app.kubernetes.io/component=matrix-authentication" -n ess --replicas=0
- The database. You need to backup your database and restore it on a new deployment.
- If you are using the provided Postgres database, build a dump using the command
kubectl exec --namespace ess -it sts/ess-postgres -- pg_dumpall -U postgres > dump.sql
. Adjust to your own kubernetes namespace and release name if required. - If you are using your own Postgres database, please build your backup according to your database documentation.
- Your values files used to deploy the chart
- The chart will generate some secrets if you do not provide them. To copy them to a local file, you can run the following command:
kubectl get secrets -l "app.kubernetes.io/managed-by=matrix-tools-init-secrets" -n ess -o yaml > secrets.yaml
. Adjust to your own kubernetes namespace if required. - The media files: Synapse stores media in a persistent volume that should be backed up. On a default K3s setup, you can find where synapse media is stored on your node using the command
kubectl get pv -n ess -o yaml | grep synapse-media
. - Run the
helm upgrade --install....
command again to restore your workload's pods.
- Recreate the namespace and the backed-up secret in step 3:
kubectl create ns ess
kubectl apply -f secrets.yaml
- Redeploy the chart using the values backed-up in step 2.
- Stop Synapse and Matrix Authentication Service workloads:
kubectl scale sts -l "app.kubernetes.io/component=matrix-server" -n ess --replicas=0
kubectl scale deploy -l "app.kubernetes.io/component=matrix-authentication" -n ess --replicas=0
- Restore the postgres dump. If you are using the provided Postgres database, this can be achieved using the following commands:
# Drop newly created databases and roles
kubectl exec -n ess sts/ess-postgres -- psql -U postgres -c 'DROP DATABASE matrixauthenticationservice'
kubectl exec -n ess sts/ess-postgres -- psql -U postgres -c 'DROP DATABASE synapse'
kubectl exec -n ess sts/ess-postgres -- psql -U postgres -c 'DROP ROLE synapse_user'
kubectl exec -n ess sts/ess-postgres -- psql -U postgres -c 'DROP ROLE matrixauthenticationservice_user'
kubectl cp dump.sql ess-postgres-0:/tmp -n ess
kubectl exec -n ess sts/ess-postgres -- bash -c "psql -U postgres -d postgres < /tmp/dump.sql"
Adjust to your own kubernetes namespace and release name if required.
- Restore the synapse media files using
kubectl cp
to copy them in Synapse pod. If you are using K3s, you can find where the new persistent volume has been mounted withkubectl get pv -n ess -o yaml | grep synapse-media
and copy your files in the destination path. - Run the
helm upgrade --install....
command again to restore your workload's pods.