User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Mattermost Team Server is installable, and performs well in Ubuntu 20.04 64bit

Tue Mar 31, 2020 12:38 pm

Working from home, due to COVID-19? Need to come up with new ways to work with your team? Have a spare RPi4 kicking around? This might be just the sort of fun project to do to ward off your cabin fever.

I have an RPi 4B, 4GB of RAM. After dozens and dozens of hours of tinkering, I was able to set up my Pi as a useful team chat server, very similar to Slack (where the end user experience is actually likeable).

The Raspberry Pi has both the horsepower and the RAM to serve a decent number of clients (like a family, or a medium-sized team), using Mattermost "Team server" (not to be confused with Mattermost "Enterprise server", the paid version).

Mattermost Team Server features are things like:
  • good desktop support. There is a snap package for "mattermost-desktop", in Linux. Also desktop clients in Windows and MacOS. These all have nice desktop notifications, properly integrated into your Desktop environment's notification service.
  • good mobile support; has a WhatsApp-like, free chat App for Android and iOS. Has push notifications. Has a better mobile experience than can be had on PHPBB, or Discourse.
  • Slack-like “channels”
  • Fun things like file/image attachments, emojis, reactions, flagging, pinning, etc.
Other OSS chat forum/messaging servers (like Zulip, and Discourse) are too heavyweight for the Pi 4, by contrast.

Mattermost on ARM is very unsupported, from the official Mattermost project. But I eventually found this, which was a bit outdated, but (eventually) worked great on my Pi 4!

Note: use Ubuntu 64bit (20.04 at present), not Raspbian 32bit!! There is some weird (golang-related) quirk about 32bit, which will make image uploads very painfully slow, to process thumbnails. The quirk doesn't exist in 64-bit Ubuntu!!
Last edited by esbeeb on Tue Nov 10, 2020 8:01 pm, edited 16 times in total.

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Ubuntu 20.04 64-bit install instructions for Mattermost

Wed Apr 01, 2020 2:07 am

Here are the Ubuntu 64-bit installation instructions I followed.

Note: These instructions used, as their basis, Justine Geffen's Raspbian Jesse "recipe".

Once again, use Ubuntu 64-bit 20.04!! The performance is night and day faster than 32bit!!


===================
The official Mattermost Team server builds do not support any ARM platform. In order get a build which will run on our ARM-based Raspberry Pi, we'll be installing from an unofficial build of Mattermost, built by SmartHoneyBee.

These (unofficial) Mattermost Team Server builds are updated regularly, and automatically. To determine what the latest release is - currently 5.28.0, at the moment of this posting - visit the Release page for SmartHoneyBee's unofficial Mattermost Team Server here . Note: The wonderful magic of TravisCI makes this build-automation possible. There are installers for quite a few architectural platforms, and OS'. The version to install on a Raspberry Pi (64-bit OS) has a filename ending in "-linux-arm64.tar.gz" You can check to see that 64-bit ARM is indeed called for, by running:

Code: Select all

uname --kernel-name --kernel-release --machine
Note the "aarch64" amongst the output seen:

Code: Select all

Linux 5.4.0-xxxx-raspi aarch64  
That "aarch64" on the end effectively means "64-bit ARM".

Setting up MariaDB
---------------------------
Before you install Mattermost, you need to set up MariaDB. The Official, full instructions are on the Installing Mattermost on Ubuntu page and cover PostgreSQL and MySQL. Here, we'll use MariaDB (a drop-in replacement of MySQL):
  1. Log into the server that will host the database, and open a terminal window.
  2. Update your local package list

    Code: Select all

    sudo apt update
    
  3. Install MariaDB

    Code: Select all

    sudo apt install mariadb-server
    
  4. Log in to MariaDB as root. (Yes, the command to do so is still called "mysql" in MariaDB, that's not a typo).

    Code: Select all

    sudo mysql -u root -p
    
  5. Create the Mattermost user 'mmuser', replacing 'mmuser-password' in the command below with the password you plan to use. Don't use punctuation characters in the password, and please pick a long one.

    Code: Select all

    mysql> create user 'mmuser'@'localhost' identified by 'mmuser-password';
    
    The ‘localhost’ means that 'mmuser' can connect only on that Raspberry Pi itself. This is to say, we're planning to run both the back-end database, and the front-end mattermost server code on the same Raspberry Pi. If you were to install Mattermost on a separate computer (say, a second Raspberry Pi, to split the load across two Raspberry Pi's, hint, hint) with IP address 10.10.10.2, then use:

    Code: Select all

    mysql> create user 'mmuser'@'10.10.10.2' identified by 'mmuser-password';
    
  6. Create the Mattermost database

    Code: Select all

    mysql> create database mattermost;
    
  7. Grant access privileges to the user 'mmuser'

    Code: Select all

    mysql> grant all privileges on mattermost.* to 'mmuser'@'localhost';
    
  8. Log out of MySQL

    Code: Select all

    mysql> exit
    
Install Mattermost Server
---------------------------
  1. Download the appropriate install file, note the "arm64" in the filename (for aarch64):

    Code: Select all

    wget https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/v5.28.0/mattermost-v5.28.0-linux-arm64.tar.gz
    
  2. Extract the Mattermost Server files from the .tar.gz file

    Code: Select all

    tar -xvzf mattermost*.gz
    
  3. Move the extracted file to the /opt directory

    Code: Select all

    sudo mv mattermost /opt
    
  4. Create the storage directory for files

    Code: Select all

    sudo mkdir /opt/mattermost/data
    The storage directory will contain all the files and images that your users post to Mattermost, so you need to make sure that the drive is large enough to hold the anticipated number of uploaded files and images.
  5. Create the Mattermost system user and group

    Code: Select all

    sudo useradd --system --user-group mattermost
    
  6. Set the user and group "mattermost" as the owner of the Mattermost files

    Code: Select all

    sudo chown -R mattermost:mattermost /opt/mattermost
    
  7. Give write permissions to the "mattermost" group

    Code: Select all

    sudo chmod -R g+w /opt/mattermost
    
  8. Set up the database driver in the file /opt/mattermost/config/config.json . Open the file as root in a text editor and make the following changes:
    1. Set DriverName to mysql. (not mariadb)
    2. Set DataSource to the following value, replacing <mmuser-password> and <host-name-or-IP> with the appropriate values.

    Code: Select all

    mmuser:mmuser-password@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s
    
Start the Mattermost Server
---------------------------
  1. Change to the bin directory

    Code: Select all

    cd /opt/mattermost
    
  2. Start the Mattermost server as the user mattermost

    Code: Select all

    sudo -u mattermost ./bin/mattermost
    
  3. To test that you can access the server, navigate to:

    Code: Select all

    http://<your-Raspberry-Pi-IP-address>:8065
    
    When the server starts the output log generates information, including the current version of Mattermost and the listening port (8065). You can stop the server by pressing CTRL+C on your keyboard.
Set up Mattermost to Use systemd for Starting and Stopping.
--------------------------------------------------------------------
If you want your Mattermost server to start up automatically on boot, you can create a systemd file to install it as a service.
  1. Create a systemd unit file

    Code: Select all

    sudo touch /lib/systemd/system/mattermost.service
    
  2. Open the unit file as root in a text editor, and copy the following lines into the file:

    Code: Select all

    [Unit]
    Description=Mattermost
    After=network.target
    After=mariadb.service
    Requires=mariadb.service
    
    [Service]
    Type=notify
    ExecStart=/opt/mattermost/bin/mattermost
    TimeoutStartSec=3600
    Restart=always
    RestartSec=10
    WorkingDirectory=/opt/mattermost
    User=mattermost
    Group=mattermost
    LimitNOFILE=49152
    
    [Install]
    WantedBy=multi-user.target
    
    Note: If you are using PostgreSQL, replace mariadb.service with postgresql.service.

    If you have installed MariaDB or PostgreSQL on a dedicated server then you need to remove the "After=postgresql.service" and "Requires=postgresql.service" or "After=mariadb.service" and "Requires=mariadb.service" lines in the [Unit] section, or the Mattermost service will not start.
  3. Make systemd load the new unit

    Code: Select all

    sudo systemctl daemon-reload
    
  4. Check to make sure that the unit was loaded

    Code: Select all

    sudo systemctl status mattermost.service
    
    Since we haven't started Mattermost yet, you should see an output similar to the following:
    mattermost.service - Mattermost
    Loaded: loaded (/lib/systemd/system/mattermost.service; disabled; vendor preset: enabled)
    Active: inactive (dead)
  5. Start the service

    Code: Select all

    sudo systemctl start mattermost.service
    
  6. Verify that Mattermost is running

    Let's check the status again, shown on the command line, so you can see what it looks like, when running normally:

    Code: Select all

    sudo systemctl status mattermost.service
    
    Output should look like:
    ● mattermost.service - Mattermost
    Loaded: loaded (/lib/systemd/system/mattermost.service; enabled; vendor preset: enabled)
    Active: active (running) since Sun 2020-04-05 02:27:11 UTC; 1s ago
    Main PID: 8536 (mattermost)
    Tasks: 14 (limit: 4440)
    CGroup: /system.slice/mattermost.service
    └─8536 /opt/mattermost/bin/mattermost

    Apr 05 02:27:11 ubuntu mattermost[8536]: {"level":"info","ts":1586053631.2193584,"caller":"app/server.go:2
    Apr 05 02:27:11 ubuntu mattermost[8536]: {"level":"info","ts":1586053631.219408,"caller":"app/server.go:24
    Apr 05 02:27:11 ubuntu mattermost[8536]: {"level":"info","ts":1586053631.2650342,"caller":"sqlstore/post_s
    Apr 05 02:27:11 ubuntu mattermost[8536]: {"level":"info","ts":1586053631.3531165,"caller":"jobs/workers.go
    Apr 05 02:27:11 ubuntu mattermost[8536]: {"level":"info","ts":1586053631.3568313,"caller":"jobs/schedulers
    Apr 05 02:27:11 ubuntu mattermost[8536]: {"level":"info","ts":1586053631.380791,"caller":"app/web_hub.go:7
    Apr 05 02:27:11 ubuntu mattermost[8536]: {"level":"info","ts":1586053631.455799,"caller":"app/server.go:47
    Apr 05 02:27:11 ubuntu mattermost[8536]: {"level":"info","ts":1586053631.456481,"caller":"app/server.go:53
    Apr 05 02:27:11 ubuntu mattermost[8536]: {"level":"info","ts":1586053631.4566355,"caller":"commands/server
    Apr 05 02:27:11 ubuntu systemd[1]: Started Mattermost.
  7. Web-based Mattermost first-time setup, from the web admin interface:

    In a web browser, visit:
    http://<your-Raspberry-Pi-IP-address>:8065
    You should see a web page which asks you to set a Mattermost username, password, and email address. Go through the steps, until you're logged in, and can access the Web-based "System Console" of Mattermost (from the "burger menu", in the upper left, which looks like 3 horizontal white bars).
  8. Finally, set Mattermost to start on boot

    Code: Select all

    sudo systemctl enable mattermost.service
    
    The output should indicate that a symlink has been successfully created.
Inviting Team Members
---------------------------
The last step in the process is to make the Mattermost server available to team members so they can join the server. Back in your Web Browser, open the main menu, select Get Team Invite Link, copy the link, and send it out.

Note: Now that you've got Mattermost running with no SSL encryption, you'll probably also want to take a look at the Official Install instructions for Mattermost, for Ubuntu. It has some final steps you might want to do, which will add SSL protection, and maybe set up a web-proxy using a web server like Nginx.
Last edited by esbeeb on Wed Dec 30, 2020 3:41 pm, edited 15 times in total.

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Once you've got it working, back it up!

Sun Apr 05, 2020 12:39 pm

I've posted a couple of further RPi server maintenance tips (to back up the installation, and choose a long-lasting MicroSD card) here.

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

New: Mattermost Team Server 5.23 is installable, and performs well in Raspbian w/ 64bit kernel and Mattermost binaries

Fri Apr 10, 2020 1:41 am

New development! It's possible to run Mattermost in a performant manner, in Raspbian, if you do 2 things:
  1. You have to use the 64-bit kernel
  2. You have to use the 64-bit pre-compiled Mattermost binaries
Please see here on how to do that.

Be warned, you'll end up with a strange mix of 32-bit and 64-bit. One thing which will stop working properly is Wireguard, should you need that.
Last edited by esbeeb on Tue May 19, 2020 7:17 am, edited 2 times in total.

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

How trustworthy are the unofficial "SmartHoneyBee" builds of Mattermost?

Wed Apr 15, 2020 11:17 pm

For those who might be hesitant to install an unofficial build of Mattermost, I asked the current Build maintainer of Mattermost, named Harrison Healy (in the "Mattermost Community Contributors" Mattermost instance):
I have a question for the build maintainers of Mattermost. I'm the person who wrote an unofficial guide to installing Mattermost Team Server on a Raspberry Pi 4 (on Ubuntu 64bit). This installed an unofficial build of Mattermost Team Server, built by "SmartHoneyBee", using a TravisCI config seen here:

https://travis-ci.org/github/SmartHoney ... 503/config . My question is this: How much would you trust the "SmartHoneyBee" unofficial Mattermost builds? Is it really just as straightforward simple as the TravisCI config seen there? (And there is no secret sauce beyond that?) I think the (understandable) motivation behind this unofficial build is to avoid the current build system's reliance on Docker (saving lots of scarce RAM on a Raspberry Pi), and to avoid how there is no Docker image available for MySQL (on AMD64).
He replied:
I don't know anything about TravisCI builds, but SmartHoneyBee used to be pretty active around here a while back. I haven't heard from them recently, but I'd generally trust stuff with their name on it.

That repository doesn't appear to be stable though judging by the git repo https://github.com/SmartHoneybee/ubiquitous-memory
Then I replied:
Thanks for that context. I too saw the "build: failing" badge at Github. But so far, I haven't been able to cause Mattermost to behave unstably in any way (on ARM64), compared to a hand-installed (not Docker install of) Mattermost Team Server in an AMD64 VM (using an official build). I haven't tried each and every feature of Mattermost on both, but I thoroughly kicked the tires, trying out virtually every feature that looked interesting (I think I tried virtually all the user-facing features, but only maybe half of the administrator-facing features, being the most common ones, as I needed them).
Also note: another user I met there, who runs Mattermost team server on a Raspberry Pi 3, named "B3lt3r", noted that all the current Mattermost plugins (akin to how Add-Ons work in Firefox) won't work in ARM64, as they are compiled for AMD64. Perhaps this might be a possible cause of that "Build: failing" status seen at Github?

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Re: Mattermost Team Server 5.23 is installable, and performs well in Ubuntu 18.04.4/20.04 64bit

Wed Apr 29, 2020 2:08 am

Now that Ubuntu 20.04 is out for the Raspberry Pi, I tried a fresh install. Yes, it worked! So I updated the instructions above for 20.04.

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Instructions updated to Mattermost Team Server 5.23

Tue May 19, 2020 7:20 am

A worse-than-normal security vulnerability in Mattermost was announced on May 15, 2020, here:
https://mattermost.com/security-updates/

:o

For those who need to upgrade from a version older than 5.23, here is how to do that:
https://docs.mattermost.com/administration/upgrade.html

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Re: Mattermost Team Server 5.25.2 is installable, and performs well in Ubuntu 18.04.4/20.04 64bit

Fri Aug 07, 2020 3:13 am

To determine what the latest release is (currently 5.25.2, at the moment of this posting), visit the Release page for SmartHoneyBee's unofficial Mattermost Team Server here.

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Mattermost is hiring for a HUGE number of positions!!

Fri Aug 07, 2020 3:23 am

Umm, slightly OT, but Mattermost is hiring for a HUGE number of positions!! Those of you who actually followed this tutorial, and gained some Mattermost experience are in a favorable position to apply. :)

https://mattermost.com/careers/

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Open File limit increase for MariaDB

Tue Oct 27, 2020 3:12 pm

There's a subtle MariaDB-related wart which I though I had better document. When starting MariaDB with systemd, error messages like this were appearing:
Oct 27 15:00:06 ubuntu mysqld[102359]: 2020-10-27 15:00:06 0 [Warning] Could not increase number of max_open_files to more than 16384 (request: 32186)
To make these error messages go away, I had to create a file, as root, called "/etc/systemd/system/mariadb.service", containing the following text:

Code: Select all

.include /usr/lib/systemd/system/mariadb.service
[Service]
LimitNOFILE=33000
...then I had to run the command, as root:

Code: Select all

systemctl daemon-reload
...for these changes to take effect. Then the next time I stopped and started MariaDB, no error message, as shown above. 8-)

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Maximum attached file size of 14MB or less is recommended, in case an .mp4 gets uploaded, causing transcoding crunching

Wed Nov 04, 2020 11:51 pm

Just FYI: my Mattermost server has about 60 real-world, human users, and the RPi4 handled all the traffic easily. Note that the traffic demand on this server has been quite light.

Personally, after some testing, I found it's best to set a maximum file upload size of 14MB or less, for an RPi4. Why? Because if any user uploads an .mp4 video, a 14MB .mp4 will require the RPi4 to crunch hard for about a minute, as it generates an internal (transcoded) video preview, and then attached .mp4 can be viewed right within Mattermost, using an embedded video viewer right in the browser (no file download first, then open the downloaded video in an external browser).

Unfortunately, that 1ish minute of video crunching is a single-threaded process.

To dodge around this "transcoding time penalty", you'd do well to upload .mkv files, not .mp4 files! A good Linux app for recording video files straight to .mkv is guvcview.
Last edited by esbeeb on Tue Dec 22, 2020 3:21 pm, edited 2 times in total.

parnic-sks
Posts: 2
Joined: Fri Nov 13, 2020 3:08 pm

Re: Mattermost Team Server is installable, and performs well in Ubuntu 20.04 64bit

Fri Nov 13, 2020 3:11 pm

Thanks, @esbeeb! This information has been super helpful for us setting up Mattermost on an RPi4.

I'm maintaining arm64 versions of a few different Mattermost plugins that we use. The changes to get an RPi-compatible build made are very straightforward, so feel free to check the arm64-support branch of any of my Mattermost plugin repositories: https://github.com/parnic-sks

Draky
Posts: 1
Joined: Thu Nov 26, 2020 10:39 am
Location: France

Re: Mattermost Team Server is installable, and performs well in Ubuntu 20.04 64bit

Thu Nov 26, 2020 10:47 am

Hi !

Thanks, it worked for me on Rpi3, with 32 bits Ubuntu Server 20.04.

One thing to change though, is the service file code :

Code: Select all

[Unit]
Description=Mattermost
After=network.target
After=mariadb.service
Requires=mariadb.service

[Service]
Type=notify
ExecStart=/opt/mattermost/bin/mattermost
TimeoutStartSec=3600
Restart=always
RestartSec=10
WorkingDirectory=/opt/mattermost
User=mattermost
Group=mattermost
LimitNOFILE=49152

[Install]
WantedBy=multi-user.target
It is not "mariadb.service" but "mysql.service" twice ;)

Will now see how to enable SSL with NGinx, seems awfully hard for a noob like me...

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Mattermost Team Server is installable, and performs well in **Raspberry Pi OS** 64bit as well

Tue Dec 22, 2020 3:05 pm

I've also tried out my above install instructions for Raspberry Pi OS 64bit beta, as downloaded from here:
https://downloads.raspberrypi.org/raspi ... 020-08-24/
...and everything seems to also work as expected after some initial testing.

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Re: Mattermost Team Server is installable, and performs well in Ubuntu 20.04 64bit

Tue Dec 22, 2020 3:16 pm

parnic-sks wrote:
Fri Nov 13, 2020 3:11 pm
Thanks, @esbeeb! This information has been super helpful for us setting up Mattermost on an RPi4.

I'm maintaining arm64 versions of a few different Mattermost plugins that we use. The changes to get an RPi-compatible build made are very straightforward, so feel free to check the arm64-support branch of any of my Mattermost plugin repositories: https://github.com/parnic-sks
You're welcome! Thanks for contributing those compiled-for-ARM modules! :)

User avatar
esbeeb
Posts: 168
Joined: Sun Feb 05, 2012 12:23 am

Re: Mattermost Team Server is installable, and performs well in Ubuntu 20.04 64bit

Tue Dec 22, 2020 3:27 pm

Draky wrote:
Thu Nov 26, 2020 10:47 am
Thanks, it worked for me on Rpi3, with 32 bits Ubuntu Server 20.04.
You're welcome.

I had serious CPU boggage-down when I uploaded images into Mattermost (when the install was performed in a 32bit OS). See here:
https://forum.mattermost.org/t/what-doe ... ver/1893/6
Draky wrote:
Thu Nov 26, 2020 10:47 am
One thing to change though, is the service file code :
...
It is not "mariadb.service" but "mysql.service" twice ;)
My instructions above had no mistake in them, as you say. My install used Mariadb up there, not mysql (however backwards-compatible mysql syntax still gets utilized a number of times).

parnic-sks
Posts: 2
Joined: Fri Nov 13, 2020 3:08 pm

Re: Mattermost Team Server is installable, and performs well in Ubuntu 20.04 64bit

Tue Dec 22, 2020 3:34 pm

esbeeb wrote:
Tue Dec 22, 2020 3:16 pm
parnic-sks wrote:
Fri Nov 13, 2020 3:11 pm
Thanks, @esbeeb! This information has been super helpful for us setting up Mattermost on an RPi4.

I'm maintaining arm64 versions of a few different Mattermost plugins that we use. The changes to get an RPi-compatible build made are very straightforward, so feel free to check the arm64-support branch of any of my Mattermost plugin repositories: https://github.com/parnic-sks
You're welcome! Thanks for contributing those compiled-for-ARM modules! :)
Plugins are going to be somewhat simpler to maintain once https://github.com/mattermost/mattermos ... pull/14682 is merged in, which it seems is imminent!

Return to “Ubuntu”