Skip to content

Mattermost

Team communication for the platform, served at mattermost.prod.skatzi.com.

Overview

Deployed by the mattermost component (components/mattermost/base/helmrelease.yaml) on hetzner-mgmt: the mattermost chart from helm.mattermost.com with one replica of mattermost/mattermost-enterprise-edition, whose tag is pinned in mattermostApp.image.tag.

Renovate proposes only image versions below 11.11 (allowedVersions in renovate.json). From 11.11 on, an unlicensed server sends its push notifications to push-test.mattermost.com, a test service with no SLA and no data processing agreement, and the platform has no Mattermost licence. Raise the cap only on a new owner decision. The chart is not capped.

Dependencies

  • CloudNativePG Cluster mattermost-db (one instance, 10 GiB), with daily backups and WAL archiving to the backup store (CloudNativePG). Mattermost reads its configuration from the same database: the chart sets MM_CONFIG to the connection string in mattermost-db-secret.
  • The volume mattermost-data for files (File storage).
  • The backup-store secret and the scratch namespace cnpg-drill, for the upgrade gate and the restore drill.

Exposed Services

  • HTTP via Gateway API (mattermost.prod.skatzi.com), service mattermost:8065.

File storage

Uploaded files, attachments and plugin bundles live on the volume mattermost-data (components/mattermost/base/persistent-volume-claim.yaml, 10 GiB, hcloud-volumes), mounted at /mattermost/data through the chart's mattermostApp.extraVolumes and extraVolumeMounts. They survive pod restarts, upgrades, the upgrade gate's stop, node drains and evictions. Plugins installed through the System Console are stored there as well: Mattermost keeps their bundles in the file store (plugins/) and unpacks them into the chart's emptyDir on every start (Mattermost channels/app/plugin.go, syncPlugins).

  • Driver pinned in Git. global.features.fileStore.driver is local, and extraEnv sets MM_FILESETTINGS_DRIVERNAME=local and MM_FILESETTINGS_DIRECTORY=/mattermost/data/. Environment variables override the configuration stored in the database, so the System Console cannot move the files off the volume, where the backup gate would no longer find them.
  • One pod at a time. The volume is ReadWriteOnce, so the Deployment uses strategy: Recreate. A rolling update could not start the new pod on another node while the old one held the volume. securityContext.fsGroup: 2000 makes the volume writable for the image's mattermost user (uid and gid 2000, Mattermost server/build/Dockerfile).
  • Provisioning. hetzner-csi provisions the volume dynamically. Its reclaim policy is Delete, so the claim carries kustomize.toolkit.fluxcd.io/prune: disabled: removing it from Git, or a Flux prune, does not delete the files. Deleting the claim or the namespace by hand still does, and loses the uploads since the last daily backup. The database volume, by contrast, is a Terraform volume behind a Retain PersistentVolume.
  • Not Retain. The PersistentVolume is created by the driver, so its reclaim policy can only be changed by patching it on the cluster, outside Git. The other way is a Retain StorageClass, which needs a new claim and a copy of the files. With a daily backup, an accidental delete loses at most a day of uploads, and a retained volume would cost money until a person deletes it. So the policy stays Delete.
  • Backups. The daily file backup copies the volume to the backup store while Mattermost runs. The upgrade gate copies it while Mattermost is stopped. The weekly drill restores the newest copy, the gate's restore check restores its own, and the rollback puts the gate's copy back.

Why a volume and not the chart's amazons3 driver: a volume needs no new bucket or credentials, and both would be Terraform and OpenBao work outside the cluster. It also lets the backup follow the Gitea and Harbor gates (tar, upload with Content-MD5, aside volume). With one replica, nothing needs shared storage.

Backups and upgrades

A Mattermost upgrade is applied only after the running version has been backed up and the backup restored and started. The files are also backed up every day, a weekly drill restores the latest database and the newest files and starts them, and a failed upgrade is rolled back automatically by restoring the gate's backup. See Backups, Upgrade Gate, Drill and Rollback.