# Self-host Mattermost

> Self-hosted team chat and collaboration platform with channels, workflow automation, voice calling and screen sharing. Run your own Mattermost on an always-on EnvHaven workspace by asking its coding agent: one request installs it, puts it on an HTTPS address and locks it down. What the agent takes care of, and the manual route.

_Updated November 23, 2026_

Running your own Mattermost usually means a list of server chores: a machine that stays on, Docker or a runtime, a reverse proxy with certificates, a domain, and the settings that make Mattermost behave behind all of it. On an EnvHaven workspace you skip the list. You ask the coding agent, and it does the work while you watch.

## Just ask your agent

Open a Plus workspace (Mattermost runs in Docker, which Plus and Pro include), tap **Launch** to start any coding agent (Claude Code, Codex, OpenCode or another), and ask it:

```text
Set up Mattermost on this workspace and give me the link. Follow https://envhaven.com/self-host/mattermost.md
```

Then open the link it sends and create your Mattermost account straight away, before anyone else finds the address. That is the whole request: the address in it is this page's Markdown copy, and the agent follows the instructions for it further down, with every setting Mattermost's docs require.

## Or keep it private with Tailscale

The preview URL puts Mattermost on the public internet, which suits something other people need to reach. For an app only you and your household use, your tailnet is the better home: Tailscale gives Mattermost an HTTPS address that only your own devices, signed in to your Tailscale account, can open. Save a Tailscale auth key in the workspace's **Vars** pane as `TS_AUTHKEY`, and ask the agent:

```text
Set up Mattermost on my tailnet instead of the preview URL. Follow https://envhaven.com/self-host/mattermost.md and https://envhaven.com/guides/self-host-privately-with-tailscale.md
```

- A Tailscale container runs beside Mattermost, so it keeps its private address through workspace restarts and updates, and every app you set up this way gets an address of its own.
- Anything other services have to reach, such as a webhook, still needs a public address. [Keep self-hosted apps private with Tailscale](https://envhaven.com/guides/self-host-privately-with-tailscale) covers both, and what Tailscale's free plan includes.

| At a glance |  |
| --- | --- |
| What it is | Team chat and messaging |
| License | MIT for compiled binaries from Mattermost, Inc. |
| Runs as | Docker (`mattermost/mattermost-enterprise-edition`) |
| Memory | 2 GB for 1 to 1,000 users; 4 GB for 1,000 to 2,000 users ([docs](https://docs.mattermost.com/deployment-guide/software-hardware-requirements)) |
| Plan that fits | Plus or larger |
| Web port | 8065 |
| Documentation | [docs.mattermost.com/deployment-guide/server/deploy-containers](https://docs.mattermost.com/deployment-guide/server/deploy-containers) |

## What your agent takes care of

- **Installing it.** Mattermost runs from the official image, `mattermost/mattermost-enterprise-edition`, with its data in folders under `~/apps/mattermost`.
- **Putting it on an HTTPS address.** The workspace's preview URL serves it, and your own domain can too.
- **Locking it down first.** What Mattermost's docs say to set before it faces the internet, below.
- **Telling you what to back up**: ./volumes/app/mattermost/config, data, logs, plugins, client/plugins (mounted at /mattermost/...) and ./volumes/db/var/lib/postgresql/data (PostgreSQL) ([docs](https://github.com/mattermost/docker/blob/main/env.example)).

### The settings it needs behind a proxy

- ServiceSettings.SiteURL (env `MM_SERVICESETTINGS_SITEURL`): The public address users type; required, and it may include a port or a subpath. ([docs](https://docs.mattermost.com/administration-guide/configure/environment-configuration-settings))
- DOMAIN (Docker .env): The one value the compose quick start requires you to edit; the bundled NGINX and TLS use it. ([docs](https://docs.mattermost.com/deployment-guide/server/deploy-containers))
- `MM_SERVICESETTINGS_SITEURL` (Docker .env): The env file passes the site URL to the container, built from DOMAIN. ([docs](https://github.com/mattermost/docker/blob/main/env.example))
- ServiceSettings.WebsocketURL (env `MM_SERVICESETTINGS_WEBSOCKETURL`): Tells clients where to open WebSockets; keep it the same as the Site URL. ([docs](https://docs.mattermost.com/administration-guide/configure/environment-configuration-settings))
- ServiceSettings.TrustedProxyIPHeader (env `MM_SERVICESETTINGS_TRUSTEDPROXYIPHEADER`): Header names checked for the client IP, for example X-Real-IP behind NGINX; the default trusts none. ([docs](https://docs.mattermost.com/administration-guide/configure/environment-configuration-settings))
- WebSocket upgrade headers (proxy side): The documented NGINX location for the WebSocket path forwards the upgrade request. ([docs](https://docs.mattermost.com/deployment-guide/server/setup-nginx-proxy))
- X-Forwarded-Proto (proxy side): Tells Mattermost the user connected over HTTPS. ([docs](https://docs.mattermost.com/deployment-guide/server/setup-nginx-proxy))

### Before it faces the internet

- Open sign-up is on by default (email-based accounts), so turn it off or restrict it before exposing the server. ([docs](https://docs.mattermost.com/administration-guide/configure/authentication-configuration-settings))
- Create the first system admin yourself as soon as the server is up. ([docs](https://docs.mattermost.com/deployment-guide/server/deploy-containers))
- The sample env file ships a default database password; change it before the first start. ([docs](https://github.com/mattermost/docker/blob/main/env.example))
- The docs recommend changing the database credentials. ([docs](https://docs.mattermost.com/deployment-guide/server/deploy-containers))
- The default database user is a superuser; a less privileged one is recommended. ([docs](https://github.com/mattermost/docker/blob/main/env.example))
- No client IP header is trusted by default. ([docs](https://docs.mattermost.com/administration-guide/configure/environment-configuration-settings))

## Things to ask next

Everything after the install is one more sentence to the agent. Some that come up:

- "Create channels for engineering, support and random, and give me the invite link."
- "Turn off public sign-ups now that my team is in."
- "Move Mattermost to app.example.com." Add the domain on the dashboard's Domains page with a CNAME to `domains.envhaven.app`, and the agent changes Mattermost's address settings to match.
- "Update Mattermost to the latest release." It pulls the new image and recreates the container, data kept.

## Instructions for the agent

The agent reads these from the page's Markdown copy. They also work pasted on their own, if you would rather give them in your own words.

```text
Set up Mattermost on this workspace and serve it at my preview URL.
- Use Docker Compose with the official image, mattermost/mattermost-enterprise-edition, starting from the docs' compose file: https://github.com/mattermost/docker/blob/main/docker-compose.yml. If `docker compose` is missing, install the Compose plugin into ~/.docker/cli-plugins first.
- The docs' setup includes: PostgreSQL (postgres:18-alpine in env.example).
- Keep the compose file in ~/apps/mattermost and all of its data in folders there (bind mounts, not named volumes), with restart: unless-stopped on every service.
- This server has no firewall, so publish no port on its public IP, and drop host networking and privileged mode from the docs' compose file. Docker runs on the host: connect this workspace to the compose network and relay my preview URL's port to Mattermost's port 8065.
- The preview URL terminates HTTPS in front of Mattermost: serve plain HTTP on its port, and trust the forwarded headers the relay passes on.
- Set what "The settings it needs behind a proxy" lists on https://envhaven.com/self-host/mattermost.md for the preview URL, as Mattermost's docs describe for running behind a proxy; skip any that apply only when Mattermost serves HTTPS itself.
- Before the preview URL serves it, apply what "Before it faces the internet" lists on https://envhaven.com/self-host/mattermost.md.
- When it answers at the preview URL, send me the link and tell me what to back up.
- If I asked for my tailnet instead of the preview URL, set Mattermost up the same way but follow https://envhaven.com/guides/self-host-privately-with-tailscale.md for the network: no preview URL, no relay.
```

## What to know

- In Docker, Mattermost's containers keep running when the workspace restarts or updates. The relay from the preview URL is a process in the workspace, so after a restart or an update, ask the agent to restore it.
- The free Entry mode of the Enterprise Edition image caps visible channel history; older messages stay in the database but cannot be viewed or searched. ([docs](https://docs.mattermost.com/product-overview/editions-and-offerings))
- Without a license the Enterprise Edition image runs in Entry mode. ([docs](https://docs.mattermost.com/product-overview/editions-and-offerings))
- Team Edition is sized for small teams and has no SSO. ([docs](https://docs.mattermost.com/product-overview/editions-and-offerings))
- Calls needs HTTPS, and clients must reach the media service on UDP or TCP 8443 (or a TURN server), so an HTTP-only tunnel alone does not carry it. ([docs](https://docs.mattermost.com/deployment-guide/calls/calls-deployment-guide))
- Default maximum file size is 100 MiB, which sits at or above a 100 MB tunnel body limit; the docs warn about large limits and failed uploads. ([docs](https://docs.mattermost.com/administration-guide/configure/environment-configuration-settings))
- Email needs an SMTP server (outbound). ([docs](https://docs.mattermost.com/deployment-guide/server/prepare-network))
- Mobile push goes out to a push notification server (outbound 443). ([docs](https://docs.mattermost.com/deployment-guide/server/prepare-network))
- Clients use HTTP and WebSocket on the same inbound ports. ([docs](https://docs.mattermost.com/deployment-guide/server/prepare-network))
- MySQL support is being deprecated, so PostgreSQL is the database to plan for. ([docs](https://docs.mattermost.com/deployment-guide/software-hardware-requirements))
- A workspace has one preview URL and one custom domain, both serving the same port, so it puts one app on a public address at a time.

## Without a workspace

The manual route, on a server you run:

1. Rent a Linux VPS, secure SSH, and create a user for the app.
2. Install Docker and write a compose file from the official image.
3. Put a reverse proxy in front (Caddy, nginx or Traefik), get certificates, and point a domain at the server.
4. Set the proxy settings listed above for that domain, and pass WebSocket upgrades through the proxy if the app uses them.
5. Keep the firewall closed except for the proxy, and schedule backups and updates.

Mattermost's own [documentation](https://docs.mattermost.com/deployment-guide/server/deploy-containers) covers each step for its install methods.

## Sources

Facts about Mattermost come from its own documentation, checked on 2026-11-23:

- [docs.mattermost.com/deployment-guide/server/deploy-containers](https://docs.mattermost.com/deployment-guide/server/deploy-containers)
- [docs.mattermost.com/deployment-guide/software-hardware-requirements](https://docs.mattermost.com/deployment-guide/software-hardware-requirements)
- [docs.mattermost.com/administration-guide/configure/environment-configuration-settings](https://docs.mattermost.com/administration-guide/configure/environment-configuration-settings)
- [github.com/mattermost/docker/blob/main/env.example](https://github.com/mattermost/docker/blob/main/env.example)
- [docs.mattermost.com/deployment-guide/server/setup-nginx-proxy](https://docs.mattermost.com/deployment-guide/server/setup-nginx-proxy)
- [docs.mattermost.com/product-overview/editions-and-offerings](https://docs.mattermost.com/product-overview/editions-and-offerings)
- [docs.mattermost.com/deployment-guide/calls/calls-deployment-guide](https://docs.mattermost.com/deployment-guide/calls/calls-deployment-guide)
- [docs.mattermost.com/deployment-guide/server/prepare-network](https://docs.mattermost.com/deployment-guide/server/prepare-network)
- [docs.mattermost.com/administration-guide/configure/authentication-configuration-settings](https://docs.mattermost.com/administration-guide/configure/authentication-configuration-settings)

## Keep reading

- [Self-host any app with your agent](https://envhaven.com/self-host)
- [Self-host Buzz by Block](https://envhaven.com/self-host/buzz)
- [Self-host Rocket.Chat](https://envhaven.com/self-host/rocket-chat)
- [Self-host Matrix Synapse](https://envhaven.com/self-host/matrix-synapse)
- [AI agent hosting](https://envhaven.com/guides/ai-agent-hosting)

Source: https://envhaven.com/self-host/mattermost
