Self-Hosting Guide: Deploy Mattermost on Your Own Server
·OSSAlt Team
mattermostteam chatself-hostingdockerguide
Self-Hosting Guide: Deploy Mattermost on Your Own Server
Mattermost is the open source Slack alternative. Self-hosting gives you unlimited users, full data ownership, and costs only the price of a VPS. Here's the complete production setup.
Requirements
- VPS with 4 GB RAM minimum
- Docker and Docker Compose
- Domain name (e.g.,
chat.yourdomain.com) - 20+ GB disk for file attachments
Step 1: Clone the Official Docker Setup
git clone https://github.com/mattermost/docker.git mattermost-docker
cd mattermost-docker
# Create data directories
mkdir -p ./volumes/app/mattermost/{config,data,logs,plugins,client/plugins,bleve-indexes}
sudo chown -R 2000:2000 ./volumes/app/mattermost
# Copy environment
cp env.example .env
Step 2: Configure
Edit .env:
# Domain
DOMAIN=chat.yourdomain.com
# Database
POSTGRES_USER=mmuser
POSTGRES_PASSWORD=your-strong-password
POSTGRES_DB=mattermost
# Mattermost
MM_SQLSETTINGS_DRIVERNAME=postgres
MM_SQLSETTINGS_DATASOURCE=postgres://mmuser:your-strong-password@db:5432/mattermost?sslmode=disable&connect_timeout=10
# File storage
MM_FILESETTINGS_DRIVERNAME=local
MM_FILESETTINGS_DIRECTORY=/mattermost/data
# SMTP (for email notifications)
MM_EMAILSETTINGS_SMTPSERVER=smtp.resend.com
MM_EMAILSETTINGS_SMTPPORT=587
MM_EMAILSETTINGS_SMTPUSERNAME=resend
MM_EMAILSETTINGS_SMTPPASSWORD=re_your_api_key
MM_EMAILSETTINGS_CONNECTIONSECURITY=STARTTLS
MM_EMAILSETTINGS_FEEDBACKEMAIL=mattermost@yourdomain.com
Step 3: Start Mattermost
docker compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d
Step 4: Reverse Proxy (Caddy)
# /etc/caddy/Caddyfile
chat.yourdomain.com {
reverse_proxy localhost:8065
}
sudo systemctl restart caddy
Step 5: Initial Setup
- Open
https://chat.yourdomain.com - Create admin account
- Create your first team
- Configure System Console → Environment → verify settings
Step 6: Essential Configuration
System Console settings to configure:
| Setting | Recommendation |
|---|---|
| Site URL | https://chat.yourdomain.com |
| Max file size | 100 MB |
| Enable plugins | ✅ |
| Enable integrations | ✅ |
| Session length | 720 hours (30 days) |
| Rate limiting | Enable for production |
Step 7: Install Plugins
| Plugin | Purpose |
|---|---|
| Calls | Voice/video calls (built-in) |
| Playbooks | Incident management |
| GitHub | Notifications, PR reviews |
| Jira | Issue tracking integration |
| GitLab | MR notifications |
| Zoom | Meeting integration |
| Calendar | Shared team calendar |
Install via System Console → Plugin Marketplace.
Step 8: Invite Team
- Main Menu → Invite People
- Generate invite link or send email invitations
- Share desktop/mobile app download links:
- Desktop: mattermost.com/apps
- iOS: App Store
- Android: Google Play
Production Hardening
Backups:
# Database backup (daily cron)
docker compose exec db pg_dump -U mmuser mattermost > /backups/mm-$(date +%Y%m%d).sql
# File attachments backup
tar czf /backups/mm-files-$(date +%Y%m%d).tar.gz ./volumes/app/mattermost/data
Updates:
cd mattermost-docker
docker compose pull
docker compose up -d
Monitoring:
- Monitor port 8065 with Uptime Kuma
- Set up disk space alerts (file attachments grow)
- Monitor PostgreSQL connections
Resource Usage
| Users | RAM | CPU | Disk |
|---|---|---|---|
| 1-50 | 4 GB | 2 cores | 20 GB |
| 50-100 | 8 GB | 4 cores | 50 GB |
| 100-500 | 16 GB | 8 cores | 100 GB |
VPS Recommendations
| Provider | Spec (50 users) | Price |
|---|---|---|
| Hetzner | 4 vCPU, 8 GB RAM | €8/month |
| DigitalOcean | 2 vCPU, 4 GB RAM | $24/month |
| Linode | 2 vCPU, 4 GB RAM | $24/month |
Compare team chat platforms on OSSAlt — features, self-hosting guides, and community health side by side.