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
- Pull the Mattermost preview container image:
$ podman image pull docker.io/mattermost/mattermost-preview
- Deploy the Mattermost container:
$ podman run -d \ --name mattermost \ --publish 8065:8065 \ --network host \ mattermost/mattermost-preview
- 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
. - 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."
- 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. ]
Plugins
- 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.
- Among the 30 available plugins, locate the Memes Plugin, then click Install.
- 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.
- Return to the team page by clicking the Back to red-fedora link near the top left.
- 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.
Integrations
- Navigate your way to the main menu and go to Integrations -> Outgoing Webhooks -> Add Outgoing Webhook.
- 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 : //127.0.0.1:8080/
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.
- 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.
- 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 127.0.0.1 localhost under Allow untrusted internal connections to.
- 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
andjson
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_response(200) self.send_header("Content-type", "application/json") self.end_headers() c_length = int(self.headers.get('content-length')) data_rcv = json.loads(self.rfile.read(c_length)) mm_token = data_rcv['token'] data_snd = {"text": "| OS Build | Tests Run | Issues Detected |\n" "|:---------|:----------|:---------------------|\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) web_server.serve_forever()
- Take the above code block and pop it into a file called
http_server.py
somewhere on your container host. You may need to adjustfirewalld
and SELinux configuration to allow it to run correctly. - To start the webserver, run
python http_server.py
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 onstdout
until aPOST
is sent to the server. - 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.
About the author
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. Always looking to discover something (or somewhere) new, Thomas prefers to either be travelling or working on a project. More recently he has combined these passions into an ongoing van conversion project, featuring IoT connectivity built on top of Raspberry Pi's with Open Source software!
Browse by channel
Automation
The latest on IT automation for tech, teams, and environments
Artificial intelligence
Updates on the platforms that free customers to run AI workloads anywhere
Open hybrid cloud
Explore how we build a more flexible future with hybrid cloud
Security
The latest on how we reduce risks across environments and technologies
Edge computing
Updates on the platforms that simplify operations at the edge
Infrastructure
The latest on the world’s leading enterprise Linux platform
Applications
Inside our solutions to the toughest application challenges
Original shows
Entertaining stories from the makers and leaders in enterprise tech
Products
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud services
- See all products
Tools
- Training and certification
- My account
- Customer support
- Developer resources
- Find a partner
- Red Hat Ecosystem Catalog
- Red Hat value calculator
- Documentation
Try, buy, & sell
Communicate
About Red Hat
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Select a language
Red Hat legal and privacy links
- About Red Hat
- Jobs
- Events
- Locations
- Contact Red Hat
- Red Hat Blog
- Diversity, equity, and inclusion
- Cool Stuff Store
- Red Hat Summit