Mattermost is an open-source team collaboration platform that can be self-hosted to enhance communication and collaboration within teams. In this blog post, we will guide you through the process of setting up a Mattermost server on an AWS EC2 instance. We’ll cover the steps from launching an EC2 instance to customizing the Mattermost configuration.

customized mattermost backend repo

customized mattermost android app repo

Setting up and Deploying a WebRTC Server for Mattermost Link to heading

In order to enable WebRTC functionality in Mattermost for audio and video calls, you need to set up and deploy a WebRTC server. Here, we’ll explore the process of setting up a WebRTC server using Janus Gateway and integrating it with your Mattermost installation.

Step 1: Installing and Configuring Janus Gateway Link to heading

  • Install Janus Gateway by following the official documentation: Janus Gateway Installation
  • Configure Janus Gateway to use the desired ports and enable necessary modules such as the Audio Bridge and Video Call.
  • Generate SSL certificates for secure communication. You can use tools like Let’s Encrypt to obtain SSL certificates.

Step 2: Configuring Mattermost to Use the WebRTC Server Link to heading

  • Open the Mattermost configuration file for customization.
sudo vi /opt/mattermost/config/config.json
  • Modify the WebrtcSettings section to specify the WebRTC server address and ports.
"WebrtcSettings": {
    ...
    "GatewayWebRTC": "your-webrtc-server-address:your-webrtc-server-port",
    "GatewayAdminWebRTC": "your-webrtc-server-address:your-webrtc-server-admin-port",
    ...
},

Step 3: Deploying the WebRTC Server Link to heading

  • Copy the SSL certificates generated in Step 1 to the appropriate location on the WebRTC server.
  • Start the Janus Gateway server.
janus -F your-janus-config-file.cfg
  • Configure firewall rules to allow incoming connections on the specified ports.

If you’ve reached this point, you’ve successfully set up and deployed a WebRTC server for Mattermost. Now, Mattermost will use the WebRTC server for audio and video calls.

Step 4: Launching an EC2 Instance Link to heading

  • Login to your AWS Management Console.
  • Navigate to EC2 service.
  • Click on “Launch Instance” and select an appropriate Amazon Machine Image (AMI) with Linux.
  • Choose an instance type and configure the instance details.
  • Configure security groups to allow inbound traffic for HTTP (port 80) and HTTPS (port 443) from any source or as per your requirements.
  • Review the instance details and launch the instance.

Step 5: Connecting to the EC2 Instance Link to heading

  • Once the instance is launched, obtain the public IP or DNS of the instance.
  • Open a terminal or SSH client and connect to the EC2 instance using SSH.
ssh -i <your_key_pair.pem> ec2-user@<public_ip_or_dns>

Step 6: Installing and Configuring Mattermost Link to heading

  • Update the package manager and install the required dependencies.
sudo yum update -y
sudo yum install -y wget
  • Download the latest stable version of Mattermost using wget.
wget https://releases.mattermost.com/<version>/mattermost-<version>-linux-amd64.tar.gz
  • Extract the downloaded archive.
tar -xvzf mattermost-<version>-linux-amd64.tar.gz
  • Move the extracted directory to the appropriate location.
sudo mv mattermost /opt
  • Create a system user for Mattermost.
sudo useradd --system --user-group mattermost
sudo chown -R mattermost:mattermost /opt/mattermost
  • Configure the Mattermost server by editing the configuration file.
sudo vi /opt/mattermost/config/config.json
  • Customize the TeamSettings section to configure data types for your team.
"TeamSettings": {
    ...
    "EnableOpenServer": true,
    "EnableUserCreation": true,
    "EnableCustomUserStatuses": true,
    "EnableCustomEmoji": true,
    "EnableExternalFileStorage": true,
    ...
},
  • Enable Calls over WebRTC by modifying the WebrtcSettings section.
"WebrtcSettings": {
    ...
    "Enable": true,
    "GatewayWebRTC": "media.example.com:443",
    "GatewayAdminWebRTC": "media.example.com:443",
    ...
},

Customize the necessary settings such as server URL, database connection, and email configuration.

Step 7: Starting the Mattermost Server Link to heading

  • Change the ownership of the Mattermost data directory.
sudo chown -R mattermost:mattermost /opt/mattermost/data
  • Start the Mattermost server.
sudo systemctl enable mattermost
sudo systemctl start mattermost

Step 8: Accessing Mattermost Link to heading

  • Open a web browser and enter the URL or IP address of your Mattermost server.
  • Follow the initial setup wizard to create an admin account and configure your team.
  • Once the setup is complete, you can invite team members and start collaborating on Mattermost.
  • To enable calls over WebRTC, configure your network to forward ports 443 and 80 to the Mattermost server.
  • Open a web browser and enter the URL or IP address of your Mattermost server.

You have successfully set up a Mattermost server on an AWS EC2 instance. You can now customize the Mattermost server further by configuring data types and enabling calls over WebRTC. Remember to configure SSL/TLS encryption and enable firewall rules for secure communication. Additionally, consider following best practices for server administration to ensure the reliability and security of your Mattermost server.