Feed abonnieren

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 docker.io/mattermost/mattermost-preview
  2. Deploy the Mattermost container:
     $ podman run -d \
    --name mattermost \
    --publish 8065:8065 \
    --network host \
    mattermost/mattermost-preview
  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. ]

Plugins

  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.
Gatsby Meme

Integrations

  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 : //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.
  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 127.0.0.1 localhost under Allow untrusted internal connections to. Allow untrusted internal connections to
  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_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()
  6. Take the above code block and pop it into a file called http_server.py 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 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 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.


Über den Autor

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!

Read full bio
UI_Icon-Red_Hat-Close-A-Black-RGB

Nach Thema durchsuchen

automation icon

Automatisierung

Das Neueste zum Thema IT-Automatisierung für Technologien, Teams und Umgebungen

AI icon

Künstliche Intelligenz

Erfahren Sie das Neueste von den Plattformen, die es Kunden ermöglichen, KI-Workloads beliebig auszuführen

open hybrid cloud icon

Open Hybrid Cloud

Erfahren Sie, wie wir eine flexiblere Zukunft mit Hybrid Clouds schaffen.

security icon

Sicherheit

Erfahren Sie, wie wir Risiken in verschiedenen Umgebungen und Technologien reduzieren

edge icon

Edge Computing

Erfahren Sie das Neueste von den Plattformen, die die Operations am Edge vereinfachen

Infrastructure icon

Infrastruktur

Erfahren Sie das Neueste von der weltweit führenden Linux-Plattform für Unternehmen

application development icon

Anwendungen

Entdecken Sie unsere Lösungen für komplexe Herausforderungen bei Anwendungen

Original series icon

Original Shows

Interessantes von den Experten, die die Technologien in Unternehmen mitgestalten