[SOLVED] Connect mattermost to Postgresql

I am attempting to connect Mattemost to Postgresql DB via the Unix socket and NOT the tcp one as described in the docs.
1- I modified the pg_hba.conf and pg_ident.conf postgresql files accordingly to allow a local connection to mattermost DB from user mmuser, which is mapped to mattermost Unix user.

local   mattermost          mmuser                      peer       map=mattermap

mattermap      mattermost              mmuser

2- I changed the URI in config.json this way:


  • I know this command is correct as I tested it with the unix psql command.
  • from postgresql docs, sslmode is ignored for Unix domain socket communication.

When running # ./plateform, I have this error:
Failed to ping db err:pq: SSL is not enabled on the server

Why do this arise ?

The correct URI to write in config.json is the following one:


where mattermost_db is the database name and /run/postgresql the directory of Postgresql unix socket is.

Thanks for sharing the solution @gabx!