Skip to main content

Mattermost Operations Runbook

Operational reference for the Mattermost Team Edition deployment that powers Equa team messaging.

Infrastructure Overview

Services

Domains

Volumes


Credentials Inventory

All credentials are stored as Railway environment variables. Never commit credentials to source control.

Mattermost Admin Account

Admin Bot Account

PostgreSQL

Environment Variables on equa-server


DNS Configuration

DNS is managed in Google Cloud DNS, project equa-production, zone equa-cc-zone.

Modifying DNS


Monitoring

Health Check

Admin Token Verification

Despite the env var name MATTERMOST_ADMIN_BOT_TOKEN, this is a personal access token belonging to the equa-admin regular user, not the bot account.

Check Teams


Common Operations

Restart Mattermost

Via Railway CLI:
Via Railway GraphQL API:

View Deployment Logs

Update Mattermost Version

Update the Docker image tag in Railway:
Then redeploy the service.

Rotate Admin Token

MATTERMOST_ADMIN_BOT_TOKEN is a personal access token belonging to the equa-admin regular user, not the bot account. Bot tokens cannot create PATs for other users due to a Mattermost platform limitation.
Standard rotation (zero downtime):
  1. Log into Mattermost as equa-admin (shawn@owenent.com)
  2. Go to Profile > Security > Personal Access Tokens
  3. Click Create Token, give it a description (e.g., Equa session 2026-03)
  4. Copy the new token value
  5. In Railway (equa-server-so project), update MATTERMOST_ADMIN_BOT_TOKEN to the new token
  6. Wait for equa-server to redeploy
  7. Verify: POST /api/v1/mattermost/session succeeds
  8. Revoke the old token in Mattermost (Profile > Security > Personal Access Tokens)
The old token continues working until explicitly revoked, so there is no downtime window between steps 5 and 8. Emergency recovery (admin locked out):
  1. Enable the TCP proxy (see TCP Proxy Management below)
  2. Connect to the Mattermost database:
  1. Reset the admin password:
  1. Log in with the new password, create a new PAT
  2. Update MATTERMOST_ADMIN_BOT_TOKEN in Railway
  3. Disable the TCP proxy

Full Member Sync

If member state is out of sync between Equa and Mattermost:

Mattermost Environment Variables

Key configuration on the Mattermost Railway service:

Nginx Reverse Proxy

Mattermost returns X-Frame-Options: SAMEORIGIN by default, which blocks cross-origin iframe embedding. Since equa-web embeds Mattermost in an iframe, an nginx reverse proxy sits in front of the Mattermost service to strip this header and add permissive Content-Security-Policy: frame-ancestors rules.

Architecture

Configuration

Source: equa-server/infra/mattermost-proxy/

Environment Variables

Deployment

  1. In the equa-mattermost Railway project, create a new service from equa-server/infra/mattermost-proxy/
  2. Set MATTERMOST_UPSTREAM to the internal Mattermost URL
  3. Move the chat.equa.cc custom domain from the Mattermost service to the proxy service
  4. The proxy listens on port 8080 (auto-detected from the Dockerfile EXPOSE)

Verification

If the proxy is bypassed or removed, the messaging iframe will show a blank page. The X-Frame-Options header is set by Mattermost itself and cannot be disabled via Mattermost configuration.

TCP Proxy Management

The Mattermost PostgreSQL database has a TCP proxy for emergency direct access.

When to Enable

  • Password resets for locked-out admin accounts
  • Direct role modifications not possible via the API
  • Database migration troubleshooting
  • One-time data corrections

When to Disable

Disable the TCP proxy whenever it is not actively needed for admin operations.

How to Toggle

  1. Open the equa-mattermost Railway project
  2. Navigate to the PostgreSQL service
  3. Go to Settings > Networking > Public Networking
  4. Toggle the TCP proxy off (disable) or on (enable)

Risk Assessment

Recommendation: Keep disabled by default. Enable only for specific admin tasks, then disable immediately after.

Scaling Considerations

Mattermost Team Edition on Railway Hobby plan: For production scale (50+ concurrent users), consider:
  • Upgrading to Railway Pro plan
  • Adding Redis for session caching (MM_CACHEETTINGS_CACHETYPE=redis)
  • Configuring S3 for file storage (MM_FILESETTINGS_DRIVERNAME=amazons3)
  • Setting up log aggregation