What is Mattermost?
“Open source, private cloud Slack-alternative”
Not too long ago, I switched my team from using Slack to HipChat Server (it’s now called HipChat Data Center) because I’d like to keep my team’s private conversations within our own infrastructure. After using HipChat Server for few months, I decided HipChat Server doesn’t fit out team’s needs.
There are few things that I missed from Slack.
- Real-time communication (shorter delay)
- Links preview
- Code snippet
- Theming/customizations
- Multi-person ad-hoc chat (I’m not talking about channels)
So I decided to give Mattermost a try. I explored few different options on installing Mattermost and after significant amount of testing, I decided to go with the Bitnami Installer way. The Bitnami way is perfect for what I’m looking for:
- Simple to setup
- Single-node setup (not multi-server setup)
- Easy to version update process
- Easy to manage (restart server, etc.)
It took me quite some time to install Mattermost into my server. I noticed few bugs in the installation package and I had to troubleshoot few issues. However, I managed to get it working eventually 🙂 Let me share how I accomplished this on my Ubuntu 16.04 server, so you’ll have an easier time.
I tried these steps on an Ubuntu 16.04.3 LTS server.
Download and install Mattermost Team Edition using Bitnami Installer
# Get latest version here: https://bitnami.com/stack/mattermost wget https://downloads.bitnami.com/files/stacks/mattermost/4.1.0-0/bitnami-mattermost-4.1.0-0-linux-x64-installer.run chmod +x bitnami-mattermost-4.1.0-0-linux-x64-installer.run # Launch installer then follow the prompts ./bitnami-mattermost-4.1.0-0-linux-x64-installer.run
Setup Let’s Encrypt SSL
# From: https://community.bitnami.com/t/mattermost-letsencrypt-not-working/47679/5 sudo apt install git git clone https://github.com/certbot/certbot cd certbot # Request certificate - follow the prompts sudo ./certbot-auto certonly # Install the new SSL certificates cd /opt/mattermost/apps/mattermost/conf/certs/ mv server.crt tmp-server.crt mv server.key tmp-server.key ln -s /etc/letsencrypt/live/*/fullchain.pem server.crt ln -s /etc/letsencrypt/live/*/privkey.pem server.key # Restart Nginx to apply changes /opt/mattermost/ctlscript.sh restart nginx
Fix Outdated Bitnami Nginx Setup
This fixes the “Please check connection, Mattermost unreachable. If issue persists, ask administrator to check WebSocket port” issue.
# Open the file nano /opt/mattermost/nginx/conf/vhosts/mattermost.conf
Add the following lines
location /api/v4/websocket { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-Ssl on; client_max_body_size 50M; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Frame-Options SAMEORIGIN; proxy_buffers 256 16k; proxy_buffer_size 16k; proxy_read_timeout 600s; proxy_pass http://backend; }
Before these lines:
location /api/v3/users/websocket { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-Ssl on; client_max_body_size 50M; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Frame-Options SAMEORIGIN; proxy_buffers 256 16k; proxy_buffer_size 16k; proxy_read_timeout 600s; proxy_pass http://backend; }
Then execute this command
# Restart Nginx to apply changes /opt/mattermost/ctlscript.sh restart nginx
Setup Cron for SSL Auto Renewal
# Open Crontab Editor crontab -e # Select an editor. To change later, run 'select-editor'. # 1. /bin/ed # 2. /bin/nano <---- easiest # 3. /usr/bin/vim.basic # 4. /usr/bin/vim.tiny # # Choose 1-4 [2]: 2 # add the following line at the end of the line: # modify the cron schedule as you please 17 2 1 * * /root/certbot/certbot-auto renew --post-hook "/opt/mattermost/ctlscript.sh start nginx" --pre-hook "/opt/mattermost/ctlscript.sh stop nginx"
Setup Mobile Push Notification
- Open System Console
- Configure Push Notifications
Further documentation: https://docs.bitnami.com/installer/apps/mattermost/
Enjoy!
Never miss new posts
Get the latest tech innovation news from Ryan delivered straight to your inbox!