Skip to main content

A sysadmin's guide to setting up collaboration with Mattermost

Mattermost offers sysadmins an open source, on-premises collaboration suite that can be customized easily to suit a team's specific needs.

Photo by fauxels from Pexels

Good collaboration is often a key contributing factor in high-performing teams. Collaboration is the process of working together towards a common goal, with teams working as one towards a common purpose, adapting as needed by using the available resources.

Providing the right tools to facilitate collaboration can mean the difference between an efficient and an inefficient workplace. In the open source and closed source spheres, you'll find an abundance of collaboration tools. Some offer up a no-frills platform with the basics of instant messaging and voice calling. Others take it a step further and throw in video conferencing, custom plugins, continuous integration/continuous development (CI/CD) integrations, bot accounts, and more.

Choosing a collaboration suite that is both open source and hosted on premises provides a number of advantages for sysadmins. Open source software often comes with the convenience of faster innovation, improved security, and more flexibility. Having the option to host a solution in-house instead of being forced onto a cloud-based solution can also be a huge plus for some companies, especially those with strict security policies.

It may be challenging to find a solution that addresses all your needs out-of-the-box, and it comes down to what product gives you the flexibility to adapt it to your specific requirements.

Mattermost is one such product. It provides:

  • An excellent launchpad
  • A base, no-frills collaboration platform that offers up a plethora of ready-to-use integrations
  • An architecture that allows plugins
  • A developer toolkit to help you tailor a solution to address your specific requirements

Marketed as an open source alternative to Slack and Teams, Mattermost has a clean and recognizable interface and includes many features you find in its closed source counterparts. So without further ado, let's get started with a preview of a Mattermost container.

Deploying the Mattermost container

  1. Pull the Mattermost preview container image:
    $ podman image pull
  2. Deploy the Mattermost container:
     $ podman run -d \
    --name mattermost \
    --publish 8065:8065 \
    --network host \
  3. It will take approximately 30 seconds for the container to start up, after which you can open up a web browser and head over to http : //localhost:8065.
  4. On the welcome page, enter your email address, username, and password. On the next page, you are prompted with a list of Teams to join. This being a fresh installation, you will not find any teams, so create one straight off the bat. Click Create a team, enter the desired Team Name, and accept the default URL generated on the last page. I used the team name "Red Fedora."
  5. Finally, a three-step tutorial appears, but feel free to skip this.

Welcome to your brand new Mattermost deployment. Take a look around and familiarize yourself with the Mattermost interface. You can access everything you need from the hamburger icon (three horizontal lines) at the top left, and be sure to check out the System Console to get an understanding of how you can configure Mattermost under the hood.

Exploring other features

When deploying a production instance of Mattermost, many knobs and switches need to be flicked, such as SSL configuration, SMTP, webserver fine-tuning, and so on. To keep this concise, I will skip all of that and focus on some of Mattermost's other features available through plugins and integrations.

[ Enhance your career by developing 5 essential soft skills for sysadmin self-improvement. ]


  1. Open the Settings menu with the hamburger icon and go to Marketplace. As of this writing, the preview image lists 30 plugins that you can install directly from the Marketplace, but this is by no means all of the available plugins. You can find a complete list of available plugins over at the Marketplace webpage.
  2. Among the 30 available plugins, locate the Memes Plugin, then click Install.
  3. Once the plugin installs, click Configure, which will take you to the System Console configuration page for this plugin. Since it's only a basic plugin, you can only enable or disable it, so select True followed by Save.
  4. Return to the team page by clicking the Back to red-fedora link near the top left.
  5. Go to any available channels, and in the chat field, type /meme followed by a space; this will give you a list of available memes. I chose the Gatsy meme by typing /meme gatsby.
Mattermost Gatsby Meme plugin
(Thomas Tuffin, CC BY-SA 4.0)


  1. Navigate your way to the main menu and go to Integrations -> Outgoing Webhooks -> Add Outgoing Webhook.
  2. Input the values in their respective fields:
    • Title: Fetch build status
    • Content Type: application/json
    • Channel: Off-topic
    • Trigger Words: !buildstatus
    • Trigger When: First word matches a trigger word exactly
    • Callback URLs: http : //
      Note: Feel free to change the port in the callback URL if it conflicts with one already in use on your container host. Just be sure to use the correct port in the remaining steps.
  3. After hitting Save, you'll get a token ID; typically you will take note of and use this ID, but you can just click Done for this walkthrough.
  4. For the integration to work, you'll need to allow untrusted connectivity back to your container host, which you can do by navigating to System Console -> Environment -> Developer and then input localhost under Allow untrusted internal connections to.
    Mattermost integrations
    (Thomas Tuffin, CC BY-SA 4.0)
  5. Next, create a webserver on your container host that listens on port 8080. You can achieve this with a few lines of Python code and by using the http.server and json libraries, which are both included within the Python standard libraries. The following code was tested in Python 3.8.6 but should also work with Python 3.3+:
    from http.server import BaseHTTPRequestHandler, HTTPServer
    import json
    hostname = "localhost"
    http_port = 8080
    class MyHTTPServer(BaseHTTPRequestHandler):
       def do_POST(self):
           self.send_header("Content-type", "application/json")
           c_length = int(self.headers.get('content-length'))
           data_rcv = json.loads(
           mm_token = data_rcv['token']
           data_snd = {"text":
           "| OS Build | Tests Run | Issues Detected      |\n"
           "| RHEL     | 534       | :white_check_mark: 0 |\n"
           "| Fedora   | 856       | :warning: 2          |",
           "mattermost_token": mm_token
           self.wfile.write(bytes(json.dumps(data_snd), "utf-8"))
    if __name__ == "__main__":
       web_server = HTTPServer((hostname, http_port), MyHTTPServer)
  6. Take the above code block and pop it into a file called somewhere on your container host. You may need to adjust firewalld and SELinux configuration to allow it to run correctly.
  7. To start the webserver, run python from a terminal. The webserver runs continuously until you terminate it with Ctrl+C, so remember to do that when you're done. You won't see any output on stdout until a POST is sent to the server.
  8. Head back to Mattermost and switch over to the Off-Topic channel. In the text field, input !buildstatus and press Enter. You should immediately see a response with a nicely formatted table containing the static data you defined in your Python webserver script.

You have the connectivity between Mattermost and your application set up. Now it's up to your application to provide some meaningful data. Feel free to play around with the Python script and update the data_snd["text"] dictionary key to return whatever you fancy.

[ A free guide from Red Hat: 5 steps to automate your business. ]

Wrapping up

This article took an introductory look into the open source collaboration tool Mattermost. A base installation of Mattermost is quick and straightforward and provides a great starting point, but the real power comes in the ability to customize it to your precise requirements. You achieve this by using some of the many available plugins or developing custom integrations that cater to your specific needs.

Mattermost gives you the launchpad to create the perfect collaboration tool for your environment, but now, it's up to you to make it happen.

Topics:   Software   Skills development  
Author’s photo

Thomas Tuffin

Thomas is a Technical Account Manager for Red Hat. An Aussie expat in Sweden, he is passionate about Open Source software and has a keen interest in emerging technologies such as blockchain. More about me

Try Red Hat Enterprise Linux

Download it at no charge from the Red Hat Developer program.