πŸ—’οΈ
UPDATE: 21/08/2022 - added Mattermost with MySQL docker-compose to the article. Blackvoid support chat platform of choice from now on is Mattermost in favor of Rocket.chat.

Even though I am a Rocket.Chat user myself, before I settled on it I looked into other collaboration platforms that are self-hosted and open source. In this short article, I would like to focus on Mattermost.

I won't spend too much time talking about the platform itself, but rather just give you steps on how to run it inside Docker using your favorite database platform of choice (this tutorial will focus on using PostgresDB). Let's see how to set it all up.

STEP01 - setting up the database (PostgresDB)

As with most chat platforms you will need to have some sort of database running and storing all the data. Mattermost (MM further in the text) can use MySQL or Postgres as its backed platform. I will use PostgresDB.

To get Postgres running, in case you already don't have it, you can use steps from my previous article here, specifically the title named PostgreSQL container to get you started. After you have set up your PostgresDB and configured your database it is time to configure MM in its container.

STEP02 - setup MM Docker container

There are multiple Docker repos for MM and I will be using the free version called mattermost/mattermost-team-edition. As you can see from the repo description there is not much to go on, so be sure to consult this wiki site for more details on MM and Docker setup should you need it.

After you have downloaded your repo it is time to configure it:

docker run \
--name=mattermost \
-p 8065:8065
-p 8067:8067
-p 8074:8074
-p 8075:8075
-v /volume1/docker/mattermost/config:/mattermost/config
-v /volume1/docker/mattermost/client_plugins:/mattermost/client_plugins
-v /volume1/docker/mattermost/plugins:/mattermost/plugins
-v /volume1/docker/mattermost/logs:/mattermost/logs
-v /volume1/docker/mattermost/data:/mattermost/data
-e MM_SERVICESETTINGS_SITEURL=https://mmsite.yourdomain.something
-e MM_SQLSETTINGS_DATASOURCE=postgres://username:pass@NASIPADDRESS:5432/mattermost_databasename?sslmode=disable&connect_timeout=10
-e MM_SQLSETTINGS_DRIVERNAME=postgres
-e DB_HOST=your DB IP address
-e DB_PORT_NUMBER=5432
-e MM_DBNAME=MM database name
-e MM_PASSWORD=MM DB password
-e MM_USERNAME=MM DB username
mattermost/mattermost-team-edition

Few notes about some of the variables.

MM_SQLSETTINGS_DATASOURCE can work for both MySQL and Postgres DB. There are examples of how to run it with both.

MySQL connection string example:

mmuser:mmuser_password@tcp(mysqlIP:3306)/mattermost?charset=utf8mb4,utf8&writeTimeout=30s

PostgresDB connection string example:

postgres://mmuser:[email protected]:5432/mattermostdb?sslmode=disable&connect_timeout=10

Depending on what database platform you are using, you will need to adjust the MM_SQLSETTINGS_DRIVERNAMEvariable as well with MySQL or Postgres.

STEP02 (alternative) - running Mattermost via docker-compose

This particular compose is running Mattermost against a MySQL database instance!

version: "3.5"

services:
  app:
    image: mattermost/mattermost-team-edition:latest
    container_name: mattermost
    network_mode: bridge
    volumes:
    - /volume1/docker/mattermost/config:/mattermost/config
    - /volume1/docker/mattermost/client_plugins:/mattermost/client_plugins
    - /volume1/docker/mattermost/plugins:/mattermost/plugins
    - /volume1/docker/mattermost/logs:/mattermost/logs
    - /volume1/docker/mattermost/data:/mattermost/data
    environment:
    - TZ=Zagreb/Europe
    - MM_SERVICESETTINGS_SITEURL=Public URL of your instance
    - MM_SQLSETTINGS_DATASOURCE=mmuser:mmuser_password@tcp(mysqlIP:3306)/mattermost?charset=utf8mb4,utf8&writeTimeout=30s
    - MM_SQLSETTINGS_DRIVERNAME=mysql
    - DB_HOST=MYSQLIPADDRESS
    - DB_PORT_NUMBER=3306
    - MM_DBNAME=mattermost_database_name
    - MM_USERNAME=mmuser
    - MM_PASSWORD=mmuser_password
    ports:
    - 8065:8065
    - 8067:8067
    - 8074:8074
    - 8075:8075
    restart: always
πŸ—’οΈ
NOTE: before using the docker-compose above, be sure to have the SQL instance up and running (database, user, password)!

If you want to use Postgres DB instead of MySQL/Maria, you can use the same compose with two changes. MMSQLSETTINGS_DATASOURCE and MM_SQLSETTINGS_DRIVERNAME variables need to be changed to the values noted earlier in the article!

STEP03 - running MM behind a reverse proxy (Synology Application portal)

πŸ—’οΈ
NOTE: This will only be important if you want to run this service outside your LAN and for production usage

Once you have it all set up and the container is up and running we need to do one final configuration to complete the setup. If you look at the docker run command above you will notice that there is an MM_SERVICESETTINGS_SITEURL variable set that should point to your HTTPS URL for your MM instance.

In order to get this up and running, you will need to register your domain and get a valid SSL certificate for it. You can check my previous articles on the matter of getting a valid SSL certificate here, as well as setting up any Docker-hosted service using a Synology reverse proxy here.

πŸ—’οΈ
If on the other hand, you are looking for a complete reverse proxy solution that is not part of the DSM itself, with a bit more freedom and functionality, have a look at how to run your own NGINX reverse proxy.

So, the final step is to configure your MM instance to respond to an HTTPS URL that will match the one that you have configured in your variable.

Keep in mind that if you do decide to run this service behind a reverse proxy you will need to configure WebSocket (Upgrade and Connection) parameters in your reverse proxy configuration for MM. If you are using the Synology Application portal (reverse proxy) feature you can do that using the user interface.

Configure the WebSocket header for your MM reverse proxy entry

Now you are ready to access your MM instance using your browser and the URL that you have configured.

πŸ’‘
Since Mattermost version 7, the platform now supports Calls. Still in beta, but it offers audio calls, and screen share options. Video calls might be coming in the future.

Audio quality is top quality with zero interrupts and drops. That will depend on the participant's Internet and network connection, but all in all, it works very well. Screen share is also fast with no visible problems.

At the moment (MM 7.3) audio calls over 4G do not work (at least not in my testing) as the app just crashes. Also, call transfer from one platform to the next (phone to computer) is also not supported. So if you are connected with one device you can't connect with another one as well. I will do some more testing and if any changes come along (and when), I will update this section.

If you have any questions or comments, please share them in the comment section or use the live chat feature in the bottom right corner of this (or any other ) article.