Mattermost, Inc.

[Solved] Initial setup problems with connection to database

I’m following the instructions here. I’m on ubuntu 14.04 server, and it was a fresh install with nothing on it.

When I got to step 8 under “Setup Mattermost Server” and run ./platform I get an error:

[CRIT] Failed to ping db err:dial tcp 192.168.1.2:5432: connection refused
panic: Failed to open sql connection dial tcp 192.168.1.2:5432: connection refused

goroutine 1 [running]:
github.com/mattermost/platform/store.setupConnection(0xb4ddf0, 0x6, 0xc20800bc88, 0x8, 0xc208054120, 0x5d, 0xa, 0xa, 0x4e0500, 0x95d960)
    /home/travis/gopath/src/github.com/mattermost/platform/store/sql_store.go:146 +0x581
github.com/mattermost/platform/store.NewSqlStore(0x0, 0x0)
    /home/travis/gopath/src/github.com/mattermost/platform/store/sql_store.go:52 +0x106
github.com/mattermost/platform/api.NewServer()
    /home/travis/gopath/src/github.com/mattermost/platform/api/server.go:33 +0x15a
main.main()
    /home/travis/gopath/src/github.com/mattermost/platform/mattermost.go:55 +0x4d8

goroutine 6 [syscall]:
os/signal.loop()
    /usr/local/go/src/os/signal/signal_unix.go:21 +0x1f
created by os/signal.init·1
    /usr/local/go/src/os/signal/signal_unix.go:27 +0x35

goroutine 7 [chan receive]:
code.google.com/p/log4go.ConsoleLogWriter.run(0xc208054240, 0x7f4746a23ff0, 0xc20802c008)
    /home/travis/gopath/src/github.com/mattermost/platform/Godeps/_workspace/src/code.google.com/p/log4go/termlog.go:27 +0x7a
created by code.google.com/p/log4go.NewConsoleLogWriter
    /home/travis/gopath/src/github.com/mattermost/platform/Godeps/_workspace/src/code.google.com/p/log4go/termlog.go:19 +0x6b

goroutine 8 [select]:
code.google.com/p/log4go.func·002()
    /home/travis/gopath/src/github.com/mattermost/platform/Godeps/_workspace/src/code.google.com/p/log4go/filelog.go:84 +0xa53
created by code.google.com/p/log4go.NewFileLogWriter
    /home/travis/gopath/src/github.com/mattermost/platform/Godeps/_workspace/src/code.google.com/p/log4go/filelog.go:116 +0x3da

goroutine 9 [chan receive]:
database/sql.(*DB).connectionOpener(0xc20803d540)
    /usr/local/go/src/database/sql/sql.go:589 +0x4c
created by database/sql.Open
    /usr/local/go/src/database/sql/sql.go:452 +0x31c

This problem is almost identical to this one, but they just say they were able to fix that first problem, and never said how.

my 5432 port is open;

sudo netstat -tulpn

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      922/sshd        
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      1028/postgres   
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1121/nginx      
tcp6       0      0 :::22                   :::*                    LISTEN      922/sshd        
tcp6       0      0 ::1:5432                :::*                    LISTEN      1028/postgres   

Any ideas?

Is the db on a different box? can you connect via the psql command?

maybe something like http://www.thegeekstuff.com/2014/02/enable-remote-postgresql-connection/

Hi, thanks for the response. I’m setting up Mattermost all on a single machine, including the db. From the instructions, I set up a postgres user on my machine, and I am able to run psql and connect and view the database.

I am a postgres noob, so I’ll link my pg_hba.conf just to make sure I don’t have something obviously wrong there.

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

Can you past in the db connection string in config.json minus the username/pwd ? It looks like it’s trying to connect to 192.168.1.2. I think you can probably have 127.0.0.1 instead. What psql cmd did you run?

Well that was simple enough. I appreciate the help. If I change it to 127.0.0.1 it works fine. I tried that earlier, but I think I tried it when I had another setting incorrect. Thanks again!