Gitlab/Mattermost external database problem

We’re trying to use integrated Mattermost on Gitlab CE Omnibus installation. Since this is a production machine, the Gitlab database is an external PostGreSQL.
According to the docs https://docs.gitlab.com/omnibus/gitlab-mattermost/ we enabled

mattermost_external_url 'https://mattermost.my.company'

and reconfigured. After that the mattermost.log shows failures like

[CRIT] Failed to ping db err:dial unix /var/opt/gitlab/postgresql/.s.PGSQL.5432: connect: no such file or directory 

How can we get the integrated Mattermost to work?

So once the mattermost URL is set in gitlab.rb, it will start mattermost and then it’s failing when it connects to the db?
You didn’t set any of the other mattermost[‘x’] items in your gitlab.rb? On my working omnibus install on Ubuntu I didn’t have to do anything to get mattermost to work, it created a default mattermost database, and on my first attempt to use it, I simply had to create a team.

Did you configure some specific mattermost postgres configuration settings? What version of Linux?

If there’s anything interesting in sudo gitlab-rake gitlab:check output, you might want to post that.

There ought to be but is not yet a gitlab-mattermost command line app. I have hacked my own together the script looks like this for my ubuntu omnibus install:

#!/bin/sh
cd /opt/gitlab/embedded/service/mattermost
sudo -u mattermost /opt/gitlab/embedded/bin/mattermost -config=/var/opt/gitlab/mattermost/config_alt.json $@

I use it like this:

sudo ./gitlab-mattermost -version

sudo ./gitlab-mattermost -help

Note that gitlab-mattermost’s admin tool it references itself as “platform”, wherever you see that in the help, you would actually substitute sudo ./gitlab-mattermost and then put params after that. If your system has never been online and you don’t mind resetting the database you could try -reset-database.

You can also force a gitlab omnibus install to repeat it’s configuration of the mattermost database, which also causes complete database loss this way:

Workarounds that might apply to your case might be found elsewhere in the forum here and over on the mattermost gitlab forum here
but you might consider getting omnibus to regenerate your mattermost postgres database if you don’t mind nuking it and starting over you could do something like this, at your own risk:

Login to the database interactive with gitlab embedded psq, as user gitlab-psql:

sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production

Drop mattermost DB

drop database mattermost_production;

Exit (\q) and run (perhaps with sudo)…

gitlab-ctl reconfigure

You will now have a postgres mattermost database perhaps it will fix your issue, the above steps were borrowed from another post on here by 3rdcycle, thanks dude.

W

I’ve set up Mattermost with the only configuration option

mattermost_external_url 'https://mattermost.my.company' 

All other mattermost options are commented out.

When I use bundled database all is fine, but using a different database config - even on localhost - fails

gitlab_rails['db_adapter'] = "postgresql"
gitlab_rails['db_encoding'] = "unicode"
gitlab_rails['db_database'] = "gitlabhq_production"
gitlab_rails['db_username'] = "postgres"
gitlab_rails['db_password'] = "secret"
gitlab_rails['db_host'] = "localhost"
gitlab_rails['db_port'] = 5432
postgresql['enable'] = false

The failure is logged in mattermost.log

[2016/10/12 09:04:15 CEST] [CRIT] Failed to ping db err:dial unix /var/opt/gitlab/postgresql/.s.PGSQL.5432: connect: no such file or directory

I even used a clean fresh database populated only by

sudo gitlab-rake gitlab:setup

But as stated, this does not work for mattermost. Gitlab is working fine.