Mattermost Server: Questions about Installation

Hi there,

I apologize in advance in case this is a stupid question, but I could need some help installing Mattermost server on Ubuntu 20.04 LTS (I tried to follow the instructions from here).

  1. So my first question is about the docs:
  • Set DataSource to "postgres://mmuser:<mmuser-password>@<host-name-or-IP>:5432/mattermost?sslmode=disable&connect_timeout=10" replacing mmuser, <mmuser-password>, <host-name-or-IP> and mattermost with your database name.

So just as an example, let’s say we have a user blub with password 1234 and the DB name is mattermost, then is this the right format:

"postgres://blub:1234@<host-name-or-IP>:5432/mattermost?sslmode=disable&connect_timeout=10"

Is that correct, or should it be <1234>?

  1. I was also wondering what to choose as the <host-name-or-IP>? Can I get this printed out somehow?

  2. It also states in the docs to add amongst others After=postgresql.service to the systemd unit file. In my case, the systemd unit file contained After=network.service, should I have both, or replace the After=network.service by After=postgresql.service?

Thanks a lot,
Imahn

Hi Imahn,

Welcome to the Mattermost community forums!

And no worries, there’s no such thing as a stupid question! I’m here to help you out with your Mattermost installation on Ubuntu 20.04 LTS.

Regarding your first question about the database configuration, you’re on the right track. If you have a user named “blub” with password “1234” and the database name is “mattermost,” the correct format for the DataSource would be:

“postgres://blub:1234@:5432/mattermost?sslmode=disable&connect_timeout=10”

So you don’t need to include angle brackets (“< >”) around the password. Just replace “” with the actual hostname or IP address of your PostgreSQL server.

To find the hostname or IP address of your PostgreSQL server, you can typically use the command:

$ hostname -I

This will display the IP address of your server. Alternatively, if you know the hostname of your server, you can use that instead.

Regarding the systemd unit file, you should have both “After=network.service” and “After=postgresql.service” in the file. The “After=network.service” directive ensures that the network is up before starting Mattermost, while “After=postgresql.service” ensures that PostgreSQL is started before Mattermost.

I hope this helps! Let me know if you have any further questions.

Best regards,
~Matterbot 2.0 :robot:

[Disclaimer: This is a beta AI assisted response powered by ChatGPT. Were any of the above suggestions inaccurate? Let us know by replying to this comment!]

Hi @john.combs, thanks for the answer.

When I type hostname -I, I got a lot of numbers as output (I think it’s partially the IP), so I guess it looks good.

I copy-pasted the output into the file /opt/mattermost/config/config.json (under SiteURL), but when I do sudo systemctl start mattermost, the output is

Job for mattermost.service failed because the control process exited with error code.
See “systemctl status mattermost.service” and “journalctl -xeu mattermost.service” for details.

Looking into the latter file, I see the following error:

[…] “level”:“error”,“msg”:“Failed to ping DB”,“caller”:“sqlstore/store.go:254”,“error”:“parse "postgres://<user_name>:@<host_name_or_IP>:5432/mattermost?sslmode=disable&connect_timeout=10": invalid port ":d" after host”,“retrying in seconds”:10}

Any idea on what is going wrong? I find the error invalid port ":d" after host unhelpful (the password does start with a d, but it seems mattermost somehow confuses it with the port)?

@john.combs Can you take a quick look at my last post?

Hi Imahn, did you resolve the error “invalid port” ?