heyer.systems Open Source

Mattermost

Open-source team chat (Team Edition) with channels, threads, file sharing and integrations, with PostgreSQL.

Install

On the Proxmox node as root:

bash -c "$(curl -fsSL https://iac.heyer.systems/mattermost/ct.sh)"

Container from the Debian 13 template · default: 2 CPU, 2048 MiB RAM, 12 GiB disk

Customise the commandYour own values for CPU, RAM, network and modules – no dialog

Then: Web: http://<IP>:8065/ (private networks; put an HTTPS reverse proxy in front) – login: admin, password in the guest: grep mattermost_admin_password /etc/iac/settings.env

More steps are needed outside the guest – see the setup guide.

Settings per instance

SettingMeaning
mattermost_urlSite URL – Public address users open, e.g. https://chat.example.org – needed for links in e-mails and notifications.
mattermost_admin_emailAdministrator e-mail – E-mail of the first administrator (login: admin); default admin@mattermost.local.

When creating a container, as var_<setting>:

var_mattermost_url="<value>" bash -c "$(curl -fsSL https://iac.heyer.systems/mattermost/ct.sh)"

Set or change later, in the guest (for VMs the only way so far): a line mattermost_url=<value> in /etc/iac/settings.env – no quotes, the last line of a setting wins – then:

update

With NetBox: the same line mattermost_url=<value> in the field Settings of the VM – it takes effect at the next update. Secrets stay in the guest.

Missing or empty = the app's default. Do not edit the configuration files iac writes – update overwrites them; their first lines name the file for local changes.

Setup guide

Mattermost runs in the guest on plain HTTP (port 8065, private networks only). For users outside your network – and for the mobile apps – it needs an HTTPS reverse proxy in front, the site URL, and for e-mails an SMTP server.

browser / app ──HTTPS :443──▶ reverse proxy ──HTTP + WebSocket :8065──▶ Mattermost guest

1. Create the guest

On the Proxmox node:

var_mattermost_url=https://chat.example.org \
  bash -c "$(curl -fsSL https://iac.heyer.systems/mattermost/ct.sh)"

For a VM add mattermost_url=https://chat.example.org to /etc/iac/settings.env in the guest afterwards and run update.

The site URL is the address users open – exactly, with https:// and without a trailing slash. Links in e-mails, notifications and OAuth callbacks are built from it.

2. Reverse proxy

Mattermost keeps a WebSocket open per browser tab and app (/api/v4/websocket); the proxy must pass the upgrade.

Traefik

A file for the dynamic configuration, e.g. /etc/traefik/conf.d/mattermost.yaml (name, guest IP and certificate resolver adjusted) – Traefik passes WebSockets without extra settings:

http:
  routers:
    mattermost:
      rule: Host(`chat.example.org`)
      entryPoints: [websecure]
      service: mattermost
      tls:
        certResolver: letsencrypt
  services:
    mattermost:
      loadBalancer:
        servers:
          - url: "http://192.0.2.30:8065"

nginx

location ~ /api/v[0-9]+/(users/)?websocket$ {
    proxy_pass http://192.0.2.30:8065;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_read_timeout 600s;
}
location / {
    proxy_pass http://192.0.2.30:8065;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    client_max_body_size 100M;
}

client_max_body_size limits uploads at the proxy; Mattermost’s own limit is under System Console → Environment → File Storage.

3. First login

Open the site URL.

  • Login: admin
  • Password, in the guest: grep mattermost_admin_password /etc/iac/settings.env

There is no setup wizard: iac creates this administrator over the local API socket while the server has no system admin. Change the password in the profile, create a team, and invite people with the invite link of the team (Main menu → Invite people). Open sign-up stays off.

4. E-mail

Without SMTP, Mattermost sends no invitations, password resets or notifications by e-mail. Set it under System Console → Environment → SMTP (stored in config.json, iac does not touch it) and use Test Connection. Without an own mail server, the mail-relay module of iac gives the guest a local relay.

5. Mobile apps and push notifications

The apps connect to the site URL. Push notifications of the Team Edition go through Mattermost’s free test push service (System Console → Environment → Push Notification Server): it works, but without a delivery guarantee. The message text can be left out of pushes under Site Configuration → Notifications → Push Notification Contents.

6. Calls (optional)

Voice and screen sharing (the built-in Calls plugin) send their media directly, not through the reverse proxy: UDP 8443 (and TCP 8443 as fallback) must reach the guest. The guest keeps that port closed by default – open it in /etc/nftables.d/90-local.nft:

cat >>/etc/nftables.d/90-local.nft <<'NFT'
add rule inet iac input udp dport 8443 accept comment "Mattermost Calls"
add rule inet iac input tcp dport 8443 accept comment "Mattermost Calls"
NFT
nft -c -f /etc/nftables.conf && systemctl reload nftables

Forward the port on the router and set System Console → Plugins → Calls → ICE Host Override to your public address, so clients outside your network know where to send the media.

Updates and the way back

update stays within the installed major version. Before it switches, it stops Mattermost for a moment and dumps the database to /var/lib/mattermost-backup/mattermost-<old version>-<time>.dump (the three newest stay); the new version migrates the database when it starts. The way back with that dump is in the README.

A new major version is only announced – read the changelog of Mattermost before switching.

Troubleshooting

SymptomCause
“Cannot connect to the server” / messages only appear after a reloadthe WebSocket does not pass the proxy – check the upgrade headers
Links in e-mails point to the wrong addressmattermost_url missing or different from the address in the browser
Banner “Site URL is not set”set mattermost_url, then update
A setting in the System Console is greyed outiac sets it in /etc/mattermost/mattermost.env (database, paths, site URL) – change it through the settings of iac
Calls connect, but no audioUDP 8443 does not reach the guest, or the ICE host override is missing

Logs: journalctl -u mattermost in the guest.

Source: docs/GUIDE.md of iac-mattermost – corrections welcome.

Update

In the guest:

update

Debian packages, Mattermost, modules and the iac configuration. Major versions never change automatically.

Add modules – any time, in containers and VMs alike:

update --list-modules
update --add-modules node-exporter

All modules · More about update