Deployment guide

Host Mattermost on your own VPS

Deploy on a VPS Cloud →

Self-hosting8 min read

Host Mattermost on your own VPS

Mattermost is an open source team messaging platform, often presented as the self-hosted alternative to Slack. Deploying it on your VPS guarantees that your professional conversations stay on your infrastructure. Here is a complete Docker deployment with PostgreSQL, a reverse proxy and SSL.

Why self-host Mattermost on a VPS

SaaS messaging tools bill per active user and keep the history of your exchanges on their servers. Mattermost reverses this logic: a self-hosted instance on a VPS hosts entire teams with no per-seat cost on the Team edition, with unlimited history and file storage that you control. For an agency or a company subject to confidentiality constraints, hosting your messaging in-house means that neither the messages, nor the shared files, nor the metadata pass through a third party. Mattermost also integrates natively with Git forges, CI/CD tools and inbound/outbound webhooks, making it a central communication hub for technical teams.

Concrete benefits of a self-hosted Mattermost

  • Unlimited message history, with no cutoff at a few thousand messages as on free SaaS offerings.
  • Storage of shared files on your VPS or an S3 bucket you control.
  • Inbound/outbound webhooks and slash commands to hook up CI, monitoring and alerts.
  • Enterprise authentication: LDAP/AD, SAML and OAuth depending on the edition.
  • Official desktop and mobile apps pointing to your own domain.
  • Data compliance and sovereignty: no conversation outside your infrastructure.

Hardware and software prerequisites

Mattermost is more demanding than a Git forge because it maintains persistent WebSocket connections. Count on a VPS with 2 vCPU and 4 GB of RAM for a team of up to 50 active users; aim for 8 GB beyond that or if you enable advanced search. PostgreSQL is the recommended database. Plan for at least 30 GB of SSD, more if you store many files locally. On the software side: Docker and Docker Compose, a chat.yourdomain.com subdomain with an A record, and a reverse proxy able to relay WebSocket connections correctly (Upgrade/Connection).

Deploy Mattermost with Docker and SSL

01

Prepare the VPS

Install Docker and Compose, then fetch the official mattermost-docker repository or create /opt/mattermost. Increase vm.max_map_count and the open file limits if needed; Mattermost opens many simultaneous connections.

02

Configure PostgreSQL and the volumes

In the docker-compose.yml, declare a postgres service with a strong password and persistent volumes for /var/lib/postgresql/data. For Mattermost, mount dedicated volumes for config, data, logs and plugins to keep everything outside the container.

03

Launch the Mattermost stack

Fill in the MM_SQLSETTINGS_DATASOURCE and MM_SERVICESETTINGS_SITEURL (in HTTPS) variables, then run docker compose up -d. Follow docker compose logs -f until the message indicating that the server is listening on port 8065.

04

Configure the reverse proxy with WebSocket

With Nginx, proxy to http://127.0.0.1:8065 and be sure to add proxy_set_header Upgrade $http_upgrade; and proxy_set_header Connection "upgrade";, otherwise real time will not work. With Caddy, reverse_proxy localhost:8065 handles the WebSocket automatically.

05

Enable the SSL certificate

Obtain the certificate with certbot --nginx -d chat.yourdomain.com or let Caddy provision it on its own. Check that SiteURL is indeed in https:// in the configuration, otherwise mobile clients will refuse to connect.

06

Create the team and harden the instance

Open https://chat.yourdomain.com, create the system administrator account and your first team. Disable open registration, configure SMTP for notification emails, and restrict team creation to administrators.

For shared files, do not store everything on the VPS disk in the long run: configure Mattermost in S3-compatible object storage mode. This decouples the data volume from the size of your VPS, radically simplifies backups (the bucket is versioned independently) and eases possible horizontal scaling. Also consider enabling data retention to automatically purge old messages and control PostgreSQL growth.

The official documentation

For advanced configuration and options specific to the tool, refer to the official Mattermost documentation. This guide covers going live on a VPS; the vendor's docs remain the reference for fine-tuning, major upgrades and specific use cases.

Set up your private Mattermost on a ServOrbit Cloud VPS

A Cloud VPS with Docker preconfigured and a fixed IP lets you deploy Mattermost, PostgreSQL and the WebSocket reverse proxy without friction. Your conversations stay with you.

Need help?

Browse our help center and FAQ, or write to our team — support in French, English and Arabic.