Search code examples
postgresqlubuntu-16.04mattermost

Mattermost 3.6.2 Ubuntu 16.04 pgsql 9.5 db dial err issue


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 !! :)


Solution

  • 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!