- Mattermost là Slack open source thuần Go + React, self-host trên VPS Ubuntu dễ dàng.
- VPS 2GB đủ cho team 50 user. 4GB cho team 200 user.
- Tiết kiệm 90% so với Slack Pro (8$/user/tháng -> 80$/tháng team 10).
- Có mobile app iOS/Android, desktop Mac/Win/Linux. Push notification qua Mattermost Push Service.
- Plugin Jira, GitHub, GitLab, Zoom, Confluence sẵn. Bot framework đầy đủ.
Slack đã thành xương sống team chat 2026 nhưng pricing 7.25$/user/tháng cho 90+ ngày message giữ lại là gánh nặng cho startup VN. Team 30 người = 217$/tháng = 5.5tr VND. Mattermost open source thay thế đầy đủ tính năng, tự host VPS chỉ 250-500k/tháng. Bài này hướng dẫn full setup production-ready.
Mattermost dùng stack Go (backend) + React (web) + RN (mobile). Performance tốt, scale tới team 1000+ user trên VPS 16GB. Có Enterprise tier với SAML SSO, audit log nâng cao - team <50 user không cần. Team Edition free cover 95% nhu cầu.
Mục tiêu cuối bài: bạn có Mattermost chạy HTTPS trên domain riêng, user team login, mobile push notification hoạt động, plugin GitHub gắn vào dev channel, backup hằng ngày.
1. Mattermost vs Slack vs Rocket.Chat
| Tính năng | Mattermost | Slack | Rocket.Chat |
|---|---|---|---|
| License | MIT (Team Edition) | Closed SaaS | MIT |
| Pricing 30 user | 250-500k VPS | 217$/tháng | 250-500k VPS |
| Performance | Go - rất nhanh | SaaS | Node.js - chậm hơn |
| Mobile app | Có (iOS/Android) | Có | Có |
| Channel limit | Không | 10000+ | Không |
| Message history | Không giới hạn | 90 ngày free | Không giới hạn |
| Plugin ecosystem | 50+ | 2000+ | 100+ |
Mattermost nhỉnh Rocket.Chat ở performance (Go nhanh hơn Node.js 2-3x), UI giống Slack hơn (team chuyển sang dễ). Rocket.Chat hỗ trợ video call WebRTC built-in tốt hơn. Cá nhân mình recommend Mattermost cho team dev VN.
2. Yêu cầu VPS
- RAM: 2GB cho 50 user, 4GB cho 200 user, 8GB cho 500+.
- vCPU: 2-4.
- SSD: 40-100GB (file upload chiếm phần lớn).
- Ubuntu 22/24 LTS.
- Domain: chat.your-domain.com.
- Network: 200Mbps đủ cho team 100 user concurrent.
3. Cài qua Docker Compose
curl -fsSL https://get.docker.com | sh
mkdir -p /opt/mattermost/{postgres,mm-data,mm-config,mm-logs,mm-plugins}
cd /opt/mattermost# .env
POSTGRES_PASSWORD=$(openssl rand -base64 32 | tr -d /=+)
MM_USERNAME=mmuser
MM_DBNAME=mattermost# docker-compose.yml
services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: $MM_DBNAME
POSTGRES_USER: $MM_USERNAME
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
volumes:
- ./postgres:/var/lib/postgresql/data
mattermost:
image: mattermost/mattermost-team-edition:latest
restart: unless-stopped
depends_on: [postgres]
environment:
MM_SQLSETTINGS_DRIVERNAME: postgres
MM_SQLSETTINGS_DATASOURCE: "postgres://${MM_USERNAME}:${POSTGRES_PASSWORD}@postgres:5432/${MM_DBNAME}?sslmode=disable"
MM_BLEVESETTINGS_INDEXDIR: /mattermost/bleve-indexes
MM_SERVICESETTINGS_SITEURL: https://chat.your-domain.com
volumes:
- ./mm-data:/mattermost/data
- ./mm-config:/mattermost/config
- ./mm-logs:/mattermost/logs
- ./mm-plugins:/mattermost/plugins
ports:
- "127.0.0.1:8065:8065"
caddy:
image: caddy:2-alpine
restart: unless-stopped
ports: ["80:80", "443:443"]
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
volumes:
caddy_data:# Caddyfile
chat.your-domain.com {
reverse_proxy mattermost:8065
encode gzip
request_body {
max_size 100MB
}
}docker compose up -d
docker compose logs -f mattermost
# Truy cập https://chat.your-domain.com
# Setup wizard: tạo admin owner, tên team, channel "Town Square" default4. Cấu hình System Console
- Login admin, vào Settings -> System Console.
- General -> Configuration -> Site URL: https://chat.your-domain.com (quan trọng cho email link).
- Notifications -> Email -> setup SMTP (Gmail App Password hoặc Mailgun) để gửi invitation.
- Files -> Storage -> Maximum File Size 100MB (mặc định 50MB).
- Customization -> Site Name, Favicon - branding theo company.
5. Cấu hình OAuth Google/GitLab
- Google Cloud Console -> Create OAuth Client. Redirect: https://chat.your-domain.com/signup/google/complete.
- System Console -> Authentication -> Google OAuth 2.0 -> paste Client ID + Secret.
- Restrict domain (Yêu cầu email kết thúc với @your-company.com).
- Test: logout, login lại bằng Google.
Team Edition free hỗ trợ Google + GitLab OAuth. Enterprise có SAML, Okta. Với team dev VN, Google + GitHub OAuth là đủ.
6. Mobile push notification
Push notification iOS/Android cần proxy server (Mattermost Push Notification Service). Self-host hoặc dùng MM hosted free:
- System Console -> Notifications -> Push -> select "Use HPNS connection with uptime SLA" (free, Mattermost host).
- Hoặc self-host MM Push Server riêng (cần Apple Push cert, FCM token Google).
- Test trên Mattermost mobile app (App Store / Google Play), connect tới chat.your-domain.com.
7. Plugin GitHub/Jira integration
- System Console -> Plugins -> Plugin Marketplace.
- Install GitHub plugin (free), configure webhook GH repo -> Mattermost channel #engineering.
- Lúc PR opened, merge, comment -> auto post vào channel.
- Jira plugin: connect Jira instance, link issue trong message với JIRA-123 auto unfurl.
- Zoom plugin: tạo meeting Zoom từ command /zoom trong chat.
8. Bot và webhook
# Tạo incoming webhook
# Main Menu -> Integrations -> Incoming Webhooks -> Add
# URL: https://chat.your-domain.com/hooks/xxx-xxx-xxx
curl -X POST https://chat.your-domain.com/hooks/xxx-xxx-xxx
-H "Content-Type: application/json"
-d '{
"channel": "engineering",
"username": "DeployBot",
"icon_emoji": ":rocket:",
"text": "Deploy v1.2.3 to production successful"
}'Webhook tích hợp với GitHub Actions, n8n, Jenkins, Prometheus alert. Slash command tự định nghĩa qua System Console.
9. Search và performance
Mattermost Team dùng Bleve full-text search Go-native. Đủ cho team <200 user, 1M message. Lớn hơn cần Elasticsearch (chỉ Enterprise).
- Search hỗ trợ from:user, in:channel, before:date, after:date.
- Index file attachment (PDF, DOCX) cho searchable.
- Tối ưu: cleanup message cũ >1 năm nếu DB quá lớn (System Console -> Data Retention).
10. Backup hằng đêm
# /opt/mattermost/backup.sh
#!/bin/bash
DATE=$(date +%F)
mkdir -p /backup/mm
docker compose -f /opt/mattermost/docker-compose.yml exec -T postgres
pg_dump -U mmuser mattermost | gzip > /backup/mm/db-$DATE.sql.gz
tar -czf /backup/mm/data-$DATE.tar.gz -C /opt/mattermost mm-data mm-config
find /backup/mm -mtime +14 -delete
# Cron
0 3 * * * /opt/mattermost/backup.shFile upload chiếm 80-90% disk. VPS 100GB SSD cho team 50 user 1 năm là đủ. Backup tar.gz có thể sync R2/S3 cho disaster recovery cross-region.
11. Migrate từ Slack
- Slack Workspace -> Settings -> Import/Export Data -> Export.
- Tải file ZIP message + user list.
- Mattermost mmctl CLI:
mmctl import slack.slack-export.zip - Verify channels, user mapping, file attachment.
- Communicate team chuyển sang, give 1-2 tuần parallel run.
12. Monitor và logs
- Bật metric Prometheus: System Console -> Performance Monitoring.
- Scrape /metrics endpoint với Prometheus, dashboard Grafana official.
- Alert: latency > 500ms, concurrent user spike, DB connection pool full.
- Logs xem qua docker logs mattermost, ship lên Loki nếu cần search.
VPS 2-4GB chạy Mattermost cho team 50-200 người
Cloud VPS TND Ubuntu 24.04, SSD CEPH, snapshot 1-click, backup hằng ngày, network 200Mbps trong nước. Latency thấp tới user VN dưới 30ms, mượt cho team chat realtime, file upload nhanh, mobile push hoạt động ổn định.
Xem 8 cấu hình Cloud VPS →FAQ
Mattermost Team Edition free có giới hạn gì so với Enterprise?
Team free: không SAML SSO, không Elasticsearch search, không compliance export, không read-only channel. Đủ cho 95% team SME <200 user. Enterprise (~10$/user/tháng) chỉ cần khi compliance nghiêm (finance, healthcare) hoặc team >500 user cần SSO Okta/Azure AD.
Mattermost có voice/video call không?
Có plugin Mattermost Calls (free, dùng WebRTC peer-to-peer hoặc rfc5766 TURN server). Voice call 1-1 hoặc nhóm 8-10 người ổn. Video call chất lượng kém Zoom/Meet, không phù hợp meeting chính thức. Cho daily standup hoặc quick chat tốt. Cần TURN server riêng cho user qua NAT.
Có thể migrate ngược từ Mattermost sang Slack được không?
Khó. Mattermost không có official export sang Slack format. Có thể export JSON message + file, viết script convert. Mất công vài ngày cho dataset trung bình. Suy nghĩ kỹ trước khi switch để tránh lock-in lại lần nữa.
Push notification iOS có hoạt động ổn không?
Với HPNS (Mattermost hosted push, free), iOS push hoạt động tốt, delay 1-3s. Android delay 0.5-2s qua FCM. Reliability ~99%. Self-host push server phức tạp (Apple cert, FCM), chỉ cần nếu compliance không cho phép data đi qua server thứ ba.
Mattermost có ăn nhiều RAM khi team đông?
Go runtime nhẹ. Mattermost server idle 300-500MB, peak 1GB cho 200 concurrent user. Postgres ~400MB cho DB 5GB. VPS 4GB chạy thoải mái team 200 active user. VPS 8GB cho 500-1000 user. Scale ngang qua HA cluster (Enterprise only).
Có bot framework để tự code custom integration không?
Có. Bot framework đầy đủ qua mattermost-bot-sample-golang hoặc mattermost.js (Node.js). Tạo bot account trong System Console, lấy access token, bot subscribe event qua WebSocket. Phù hợp viết bot deploy automation, alert from Prometheus, daily standup reminder.
- Backup VPS hằng ngày bằng restic + Backblaze B2: rẻ, tự động
- Proxy cho Claude Code, Cline, Aider AI agent 2026
- codex --dangerously-bypass-approvals-and-sandbox
- Migrate server từ Việt Nam sang US: checklist 2026
- PingPong Payments: Giải Pháp Ngân Hàng - Thanh Toán Quốc Tế Cross-border e-commerce
- Bản quyền phần mềm là gì? Hiểu OEM, FPP, Volume License đúng luật Việt Nam 2026


