1

I'm facing of an issue when trying to test mattermost server

sudo -u mattermost ./platform

[2017/02/04 11:19:31 CET] [INFO] Loaded system translations for 'en' from '/opt/mattermost/i18n/en.json'
[2017/02/04 11:19:31 CET] [INFO] Current version is 3.6.0 (3.6.2/Tue Jan 31 21:02:59 UTC 2017/1a9891f0f5671551d28be54a99155b907480cc5c/a704f18b1b14f56588a8a57042517fc51a826658)
[2017/02/04 11:19:31 CET] [INFO] Enterprise Enabled: true
[2017/02/04 11:19:31 CET] [INFO] Current working directory is /opt/mattermost/bin
[2017/02/04 11:19:31 CET] [INFO] Loaded config file from /opt/mattermost/config/config.json
[2017/02/04 11:19:31 CET] [INFO] Server is initializing...
[2017/02/04 11:19:31 CET] [INFO] Pinging SQL master database
[2017/02/04 11:19:31 CET] [CRIT] Failed to ping DB err:dial tcp 164.132.196.160:5432: getsockopt: connection refused

I connect directly into mattermost db via 'mmuser' meaning that credentials re ok

Both mattermost and db are on the same machine (nevertheless I tried to modify the hba config putting the same ip without success)

2nd time I reinstall the vps

Any idea ? Help !! :)

dahrens
  • 3,879
  • 1
  • 20
  • 38

1 Answers1

0

The listen_address of postgres is configured in /etc/postgresql/9.5/main/postgresql.conf - it should be localhost, if you run both on the same host.

You have to tell mattermost in its config at /opt/mattermost/config/config.js to talk to postgres on localhost, too. Here is a snip from the file:

{
  "SqlSettings": {
    "DataSource": "postgres://mmuser:password@localhost:5432/mmdatabasename"
  }
}

The corresponding entry in /etc/postgresql/9.5/main/pg_hba.conf might look like that:

host    mmdatabasename      mmuser      localhost               md5

When you move over to production, make sure to run mattermost not as root!

dahrens
  • 3,879
  • 1
  • 20
  • 38
  • Many thanks dahrens it works ! at least it listens will see for the next steps :) from newbe point of view, why doesn't it worked as normally it targeted the same server isn't it ? should have asked yesterday ^^ – user7394067 Feb 04 '17 at 11:39
  • services on hosts are always bound to sockets - which is in fact an interface together with a port. For local communication you use `localhost` also known as `127.0.0.1` - the corresponding interface is called `lo` (use `ifconfig` to check current server setup) - your mattermost was configured to talk to your servers public ip address, most likely bound to the interface `eth0` - i guess the postgres was by default configured to listen on `localhost`, wasn't it? Sometimes you want a service to listen anywhere, this is usually called `0.0.0.0` or `*`. Debugging can be done with `netstat -tulpen` – dahrens Feb 04 '17 at 16:43
  • PGSQL was originally set to listen on 'localhost' but I updated to '*' as described during the install process... Again many thanks for your help ;) – user7394067 Feb 04 '17 at 18:09