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
Clustermattermost-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 setsMM_CONFIGto the connection string inmattermost-db-secret. - The volume
mattermost-datafor files (File storage). - The
backup-storesecret and the scratch namespacecnpg-drill, for the upgrade gate and the restore drill.
Exposed Services¶
- HTTP via Gateway API (
mattermost.prod.skatzi.com), servicemattermost: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.driverislocal, andextraEnvsetsMM_FILESETTINGS_DRIVERNAME=localandMM_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 usesstrategy: Recreate. A rolling update could not start the new pod on another node while the old one held the volume.securityContext.fsGroup: 2000makes the volume writable for the image'smattermostuser (uid and gid 2000, Mattermostserver/build/Dockerfile). - Provisioning.
hetzner-csiprovisions the volume dynamically. Its reclaim policy isDelete, so the claim carrieskustomize.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 aRetainPersistentVolume. - 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 aRetainStorageClass, 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 staysDelete. - 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.