Mattermost, Inc.

Disobey database host configuration?

Summary

In my configuration, the DB host is on the remote host

root@public:/opt/mattermost# ./bin/mattermost config get "SqlSettings"
DataSource: "mattermost:password@tcp(192.168.1.200:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s"
DataSourceReplicas: "[]"
MaxIdleConns: "20"
MaxOpenConns: "300"
AtRestEncryptKey: "ezw39cnq7rjafxegq4nguk3rgzy3audp"
QueryTimeout: "30"
DriverName: "mysql"
DataSourceSearchReplicas: "[]"
ConnMaxLifetimeMilliseconds: "3600000"
Trace: "false"

But when I run the program, it always to try to connect local host IP address (192.168.1.204) instead of remote DB host (192.168.1.200):

root@public:/opt/mattermost# ./bin/mattermost 
{"level":"info","ts":1561978741.348163,"caller":"utils/i18n.go:83","msg":"Loaded system translations for 'en' from '/opt/mattermost/i18n/en.json'"}
{"level":"info","ts":1561978741.3484783,"caller":"app/server_app_adapters.go:58","msg":"Server is initializing..."}
{"level":"info","ts":1561978741.356139,"caller":"sqlstore/supplier.go:224","msg":"Pinging SQL master database"}
{"level":"error","ts":1561978741.3588479,"caller":"sqlstore/supplier.go:236","msg":"Failed to ping DB retrying in 10 seconds err=Error 1045: Access denied for user 'mattermost'@'192.168.1.204' (using password: YES)"}

Steps to reproduce

  • Setup database on other machine (192.168.1.200)

  • Configure the config.json to pointing the remote DB machine

    ./bin/mattermost config set SqlSettings.DataSource mattermost:password@tcp(192.168.1.200:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s
    
  • Run ./bin/mattermost

Expected behavior

Target DB host should be same in as written in the config file (192.168.1.200)

Observed behavior

Target DB host same as the local host (192.168.1.204)