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

Mattermost Team Server 5.23 is installable, and performs well in Ubuntu 18.04.4/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 (18.04.4, or 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 May 19, 2020 7:15 am, edited 13 times in total.

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

Ubuntu 18.04.4/20.04 64-bit install instructions for Mattermost 5.23

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 18.04.4, or 20.04!! The performance is night and day faster!!


===================
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 (automatically) updated regularly, so the most recent version of Mattermost (5.23) is available. 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" in the output seen: Linux 5.3.0-1021-raspi2 aarch64 (seen on 18.04.4), or Linux 5.4.0-1008-raspi aarch64 (seen on 20.04). That "aarch64" 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.

    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.23.0/mattermost-v5.23.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. Don't use punctuation characters in the password, and please pick a nice, long one.

    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 Mon Jun 22, 2020 10:04 pm, edited 8 times in total.

User avatar
esbeeb
Posts: 142
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: 142
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: 142
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: 142
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: 142
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

Return to “Ubuntu”