Deploy Mattermost | (Just Updated) Slack Alternative Nobody Else Can Claim
Seeds the admin a stock deploy never creates. Files on a volume.
mattermost
Just deployed
/mattermost/data
postgres
Just deployed
/var/lib/postgresql
Deploy and Host Mattermost on Railway
Mattermost Team Edition is an open-source, self-hosted Slack alternative: channels, threads, direct messages, file sharing, search, integrations and mobile and desktop clients, running on infrastructure you control. This template deploys it with the system administrator account already created, because a stock Mattermost deploy contains no user and hands the system_admin role to whoever opens the URL first.
About Hosting Mattermost
This template runs Mattermost Team Edition 11.10.0 as two services: the server itself with its file store on a persistent volume, and PostgreSQL for messages, channels, users and the server configuration. The administrator is created while the server is still bound to loopback, so the first request the public URL ever answers is against a claimed instance, and the password is re-applied on every boot, which makes a redeploy a working password reset. The volume's ownership is repaired before the server starts, because Railway mounts volumes as root while the Mattermost image runs as an unprivileged user. Plugins and the search index live on that same volume, and the server configuration is stored in PostgreSQL so System Console changes survive a redeploy.
Why Deploy Mattermost on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Mattermost on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
- Nobody else can claim your instance — a Mattermost server with an empty user table grants the
system_adminrole to the first anonymous account creation, and stock deploys start empty. Here the administrator exists before the public port is open, and anonymous sign-up is refused. - Your files survive a redeploy — uploads and avatars are written to a volume, not to the container filesystem where a redeploy discards them while the message that references them stays in the database.
- Uploads actually work — Railway mounts volumes as root and Mattermost runs as an unprivileged user; without an ownership repair the server passes its healthcheck and fails every upload with a permission error.
- Password reset by redeploy — change the variable and redeploy, which is the only recovery path a deployment with no SMTP account has.
- Pinned and prebuilt — a fixed upstream version on an app that migrates its schema forward on boot, pulled as an image rather than tracked as a moving tag.
Common Use Cases
- A private team chat your company owns — messages, files and audit history stay on your own infrastructure instead of a vendor's.
- A chat backend for tooling — incoming and outgoing webhooks, slash commands and bot accounts drive alerts, deploy notifications and ChatOps.
- A community or client workspace — invite-only teams and channels with per-channel membership, without a per-seat bill.
Dependencies for Mattermost Hosting
- PostgreSQL (included in this template) for messages, channels, users and the server configuration.
- A volume mounted at
/mattermost/data(included) for uploads, plugins and the search index.
Deployment Dependencies
- Mattermost — the upstream project
- bon5co/mattermost-railway — the Railway wrapper image this template deploys
Implementation Details
Sign in at your deployment's URL with MM_ADMIN_EMAIL and the generated MM_ADMIN_PASSWORD from the service variables. To rotate the password, change MM_ADMIN_PASSWORD and redeploy; the new value is applied during boot.
Open sign-up is disabled. Invite people from the System Console, or turn on open sign-up there once you have decided who should be able to join.
Template Content
MM_SQLSETTINGS_DRIVERNAME
postgres
postgres:17.10-alpinePOSTGRES_DB
