Deploy Mattermost
Slack Alternative. Chat, channels, threads, file sharing, search & more
Mattermost
Just deployed
Just deployed
/var/lib/postgresql/data
mattermost-files
Bucket
Just deployed

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.

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.

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
- Mattermost —
mattermost/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
| Variable | Description | Required |
|---|---|---|
MM_SQLSETTINGS_DRIVERNAME | Database driver, always postgres | Yes |
MM_SQLSETTINGS_DATASOURCE | PostgreSQL connection string | Yes |
MM_CONFIG | Same DSN — stores server config in PostgreSQL | Yes |
MM_SERVICESETTINGS_SITEURL | Public URL; wrong values break invites and links | Yes |
MM_FILESETTINGS_DRIVERNAME | amazons3 for bucket storage, local for disk | Yes |
MM_FILESETTINGS_AMAZONS3ENDPOINT | Storage host without https:// | Yes |
MM_EMAILSETTINGS_SMTPSERVER | SMTP host for invites and password resets | No |
MM_TEAMSETTINGS_ENABLEOPENSERVER | Set true to allow public signup | No |
Deployment Dependencies
- GitHub: github.com/mattermost/mattermost
- Docker Hub: mattermost/mattermost-team-edition
- Docs: docs.mattermost.com. No runtime to install — the image is a self-contained Go binary.
Minimum Hardware Requirements for Self-Hosting Mattermost
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU | 2–4 vCPU |
| RAM | 1 GB | 4 GB+ |
| Storage | Database only | Object storage for files |
| PostgreSQL | 14 | 18 |
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
| Mattermost | Slack | Rocket.Chat | |
|---|---|---|---|
| Open source | Yes (MIT/Apache core) | No | Yes (MIT) |
| Self-hostable | Yes | No | Yes |
| Free tier limits | Unlimited history | 90-day history | Unlimited history |
| Database | PostgreSQL | n/a | MongoDB |
| 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
Mattermost
mattermost/mattermost-team-edition:11.9mattermost-files
Bucket
