Mattermost, Inc.

Ubuntu 16.04 support

There’s interest in Ubuntu 16.04 support, along with someone to help test (thanks @amokleben!).

Starting a thread to discuss the differences between Ubuntu 14.04 and 16.04, steps are:

  1. Document differences in setup
  2. Have community help either drafting a community 16.04 guide or (depending on differences) updating 14.04 guide to support both
  3. Consider naming new guides “official” for 16.04 support (needs to be discussed internally, tested, automation setup, etc. May take some time, but community help with initial steps gets us going a lot faster)

1 Like

Hi,

thanks for the kind introduction.

I set up mattermost on Ubuntu 16.04.1 following the guide for an installation under Ubuntu 14.04.

Differences

General setup

My setup was done running all services on one machine. Therefore I did not specify an IP for the server but used localhost or 127.0.0.1 (if an IP was required) instead.

I installed the latest release - 3.4.0.

apt instead of apt-get

One small difference is that I used apt instead of apt-get which is more a personal liking instead of a requirement.

Commands now are i.e. apt install nginx instead of apt-get install nginx.

apt-get still works like it used to.

Postgres

Postgres on Ubuntu 16.04 is 9.5 and therefore the paths to the configs are:

  • /etc/postgresql/9.5/main/postgresql.conf
  • /etc/postgresql/9.5/main/pg_hba.conf

The configs for multi-server setup seem to still apply but I did not test this.

Init-System

Ubuntu 16.04 makes use of systemd. Therefore we need a unitfile that works.
I used the unit found at https://gist.github.com/misje/3f1bfe8dffd060994605 as a template and ended up with the following:

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

[Service]
Type=simple
ExecStart=/home/mattermost/mattermost/bin/platform
Restart=always
RestartSec=10
WorkingDirectory=/home/mattermost/mattermost
User=mattermost
Group=mattermost

[Install]
WantedBy=multi-user.target

This has to be saved at /lib/systemd/system/mattermost.service with root-rights.
To make systemd read in the file we issue systemctl daemon-reload.
If everything works we see some output from systemctl status mattermost.service that looks like this:

● mattermost.service - Mattermost
Loaded: loaded (/lib/systemd/system/mattermost.service; disabled; vendor pres
Active: inactive (dead)

We see the service was loaded but is inactive.
We can now activate the service (so it will be started automatically after a reboot): systemctl enable mattermost.service

We can now start the service via systemctl start mattermost.service.
If we now issue systemctl status mattermost.service the service should be Active (running).
Also the output from curl http://localhost:8065 should contain <title>Mattermost</title>.

For any maintenance we can use systemctl:

  • systemctl stop mattermost.service
  • systemctl restart mattermost.service

nginx

Everything works as displayed. For full use of systemd we can make use of systemctl again for managing the service:

  • sudo systemctl stop nginx.service
  • sudo systemctl start nginx.service
  • sudo systemctl restart nginx.service

For now I did not test setting up SSL for nginx.

Conclusion

So far the only greater change seems to be using systemd instead of Upstart.
Other than that I did not find any roadblocks and was able to set up an instance that I could create teams on and chat with myself (how intriguing ;)).

Hi @amokleben, this is awesome, much appreciated! Based on these differences would you recommend a separate doc for Ubuntu 16.04 or modifying the 14.04 guide with a section to add 16.04 support?

Hi @eric,

since the only real difference is the init system I’d like to go with one guide for both Ubuntu LTS versions.

For that I’d like to rewrite the daemon management-commands to use the general service-command as this works with Upstart and systemd.

I’ll probably will find some time next week to create a branch from https://github.com/mattermost/docs to work on this. If someone else starts working on this before please let me know so we can coordinate us.

Thanks so much @amokleben for adding the differences.

I want to share my experience using 14.04 instructions on 16.04. I was able to follow the 14.04 instructions until I got to the Upstart section. Since 16.04 doesn’t have Upstart, I installed it. At first it wasn’t working. When I typed sudo start mattermost, it gave the following error:

start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused

I had to properly install Upstart (which I found by searching for this error message on google). After this change, things seemed to work properly afterwards.

But your instructions sound like they are better.

I think the one big reason to avoid Upstart is that it is not maintained by Ubuntu anymore because nearly everyone switched to systemd. There may be dragons in Upstart :wink:
Also this is a huge plus for mainiting software in terms of supporting different distributions because, well, everyone uses the same system.