Railway

Deploy Mattermost

Slack Alternative. Chat, channels, threads, file sharing, search & more

Deploy Mattermost

/var/lib/postgresql/data

mattermost-files

Bucket

Just deployed

Mattermost logo

Deploy and Host Mattermost on Railway

Mattermost is an open source messaging platform for teams that need conversations to stay on infrastructure they control — channels, threaded replies, file sharing, full-text search and plugins, across web, desktop and mobile. Engineering, defence, healthcare and public-sector teams use it for a Slack-style workspace without handing message history to a SaaS vendor.

Deploy Mattermost on Railway with the database and file storage already wired up. The template runs the official mattermost/mattermost-team-edition image alongside managed PostgreSQL and a Railway object storage bucket. PostgreSQL holds messages, users and the server configuration itself; the bucket holds uploads, thumbnails, avatars and plugin bundles. Nothing durable touches local disk, so you self-host Mattermost with no volume to size or maintain, and redeploys keep every message, setting and file. Source: github.com/mattermost/mattermost.

Mattermost Railway architecture

Getting Started with Mattermost on Railway

Once the deploy finishes, open the generated Railway URL. There are no default credentials — open signup ships disabled, and the first account created becomes the System Admin. You land on the account-creation screen: enter an email, username and a password of at least 8 characters. The setup wizard then asks for your organisation name, offers integrations (safe to skip), and shows an invite link for teammates.

You are dropped into the Town Square channel of your first team. Post a message to confirm the database is writing, then create a channel from the + button and drag a file into the message box — if the image renders inline, object storage works end to end. System Console in the gear menu manages users, permissions and notifications. Anonymous signups after your own are rejected, so add teammates via the invite link.

Mattermost channel showing a posted message with an attached diagram Mattermost Town Square channel with a formatted team conversation Mattermost search panel listing matching messages across two channels

About Hosting Mattermost

Mattermost is a single Go binary serving the web client, REST API and WebSockets from one port, backed by PostgreSQL. Self-host it when message history is regulated data, when you must run inside a private network, or when per-seat pricing stops adding up.

  • Public, private and direct-message channels with threaded replies
  • Markdown, code blocks, emoji and reactions
  • File attachments with inline image previews, and full-text message and file search
  • Plugin ecosystem with prepackaged GitHub, GitLab, Jira, Zoom and Playbooks integrations
  • Incoming and outgoing webhooks, slash commands and a documented REST API
  • Web, desktop and iOS/Android clients against the same server

Only the Mattermost service has a public domain. PostgreSQL sits on Railway's private network and holds application data plus the configuration Mattermost would otherwise keep in config.json. The bucket takes every upload, and Mattermost proxies downloads through its own API, so files stay behind your login.

Why Deploy Mattermost on Railway

Railway removes the infrastructure work around self-hosted chat.

  • No volumes to provision, size or back up
  • Managed PostgreSQL with private networking between services
  • Managed TLS and a public domain out of the box
  • Object storage without running MinIO yourself
  • One-click redeploys; configuration survives every restart

Common Use Cases

  • Replacing Slack where message history must stay in your own infrastructure for compliance or data residency
  • Running an incident-response workspace, with Playbooks for repeatable runbooks
  • Per-channel access control for a contractor-heavy organisation, with no per-seat bill
  • Piping CI, monitoring and on-call alerts into channels via incoming webhooks

Dependencies for Mattermost

  • Mattermostmattermost/mattermost-team-edition:11.9, the free Team Edition build, serving HTTP on port 8065.
  • PostgreSQL 18 — messages, channels, users, sessions and the server configuration. Mattermost 11 needs PostgreSQL 14+; MySQL support was removed in v11.
  • Object storage bucket — S3-compatible storage for uploads, thumbnails, avatars and plugin bundles.

Environment Variables Reference

VariableDescriptionRequired
MM_SQLSETTINGS_DRIVERNAMEDatabase driver, always postgresYes
MM_SQLSETTINGS_DATASOURCEPostgreSQL connection stringYes
MM_CONFIGSame DSN — stores server config in PostgreSQLYes
MM_SERVICESETTINGS_SITEURLPublic URL; wrong values break invites and linksYes
MM_FILESETTINGS_DRIVERNAMEamazons3 for bucket storage, local for diskYes
MM_FILESETTINGS_AMAZONS3ENDPOINTStorage host without https://Yes
MM_EMAILSETTINGS_SMTPSERVERSMTP host for invites and password resetsNo
MM_TEAMSETTINGS_ENABLEOPENSERVERSet true to allow public signupNo

Deployment Dependencies

Minimum Hardware Requirements for Self-Hosting Mattermost

ResourceMinimumRecommended
CPU1 vCPU2–4 vCPU
RAM1 GB4 GB+
StorageDatabase onlyObject storage for files
PostgreSQL1418

Roughly 1 vCPU and 2 GB of RAM serves under 1,000 users. Message volume drives database growth far more than user count.

How to Self-Host Mattermost Outside Railway

The smallest useful self-hosted setup is the official image plus PostgreSQL:

docker run -d --name mm-db -e POSTGRES_USER=mmuser -e POSTGRES_PASSWORD=change-me \
  -e POSTGRES_DB=mattermost -v mm-db:/var/lib/postgresql/data postgres:18-alpine

docker run -d --name mattermost -p 8065:8065 --link mm-db:postgres \
  -e MM_SQLSETTINGS_DRIVERNAME=postgres \
  -e MM_SQLSETTINGS_DATASOURCE="postgres://mmuser:change-me@postgres:5432/mattermost?sslmode=disable" \
  -e MM_SERVICESETTINGS_SITEURL="https://chat.example.com" \
  -v mm-data:/mattermost/data -v mm-config:/mattermost/config \
  mattermost/mattermost-team-edition:11.9

Upstream also maintains a compose install with nginx and TLS:

git clone https://github.com/mattermost/docker && cd docker
cp env.example .env   # set DOMAIN
mkdir -p ./volumes/app/mattermost/{config,data,logs,plugins,client/plugins,bleve-indexes}
sudo chown -R 2000:2000 ./volumes/app/mattermost
docker compose up -d

The chown to UID 2000 matters: the container runs as non-root mattermost and cannot write host-owned directories.

Is Mattermost Free?

Mattermost Team Edition is free and open source, and it is what this template deploys — unlimited users, message history and channels, no per-seat cost. On Railway you pay only for the compute, database and storage you use. Paid tiers target larger organisations: Professional is around $10 per user per month billed annually (SSO, AD/LDAP, MFA), and Enterprise is custom-priced (HA clustering, compliance exports, Elasticsearch).

Mattermost vs Slack vs Rocket.Chat

MattermostSlackRocket.Chat
Open sourceYes (MIT/Apache core)NoYes (MIT)
Self-hostableYesNoYes
Free tier limitsUnlimited history90-day historyUnlimited history
DatabasePostgreSQLn/aMongoDB
Paid entry price~$10/user/mo~$8.75/user/mo~$4/user/mo

Mattermost tracks Slack's interface and shortcuts most closely, easing migration. Rocket.Chat covers more surfaces but runs on MongoDB, which needs a replica set in production.

FAQ

What is Mattermost? Mattermost is an open source, self-hostable team messaging platform with channels, threads, file sharing and search. It is a Slack alternative you run on your own infrastructure.

What does this Railway template deploy? It deploys the Mattermost Team Edition server, a managed PostgreSQL 18 database, and an object storage bucket for file uploads — all pre-wired, with a public domain and health check configured.

Why does the template include a PostgreSQL database? Mattermost stores all messages, users, channels and sessions in PostgreSQL, and this template also points MM_CONFIG at the same database so the server configuration lives there too. That means System Console changes survive redeploys without any attached volume.

How do I create the first admin account in self-hosted Mattermost? Open the deployed URL and register. The first account on a fresh server is automatically granted System Admin even though public signup is disabled; every later signup needs an invite.

Do I need SMTP to run Mattermost? No. The server works without it and logs one harmless mail-connection warning. Set MM_EMAILSETTINGS_SMTPSERVER and friends for invitations, password resets and notifications.

Can I use Mattermost Calls on Railway? Voice and screen-sharing calls need inbound UDP, which Railway does not route, so the bundled Calls plugin will not connect. Messaging, files and search work normally.


Template Content

More templates in this category

View Template
Rocky Linux
[Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
41
View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
71
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta
51