We're Hiring!

Mattermost, Inc.

Migrating config.json to DB

Summary
I followed the Configuration in the Mattermost Database instructions but at the very end, the command SELECT * FROM Configurations WHERE Active = 1; fails with ERROR: relation "configurations" does not exist

Observed behavior
I used my GUI client to connect to the DB and sure enough there is a table called configurations with 2 records. One record has a null value for active, while the other has the string t. Strangely, I cannot change the value t to 1. Even stranger, from the CLI, SELECT * FROM configurations; yields the same error message as above. But I see it in my GUI client!

Any help would be appreciated. Many thanks in advance to all!

Hi, @mmadmin

Can you please provide more details to your environment so I can confirm if this is a bug or something else?

  • Mattermost Server version

  • Database type and version

Instead of using lower case, can you provide the output of the SELECT * FROM Configurations from your GUI client?

Also, can you also share the content the following by removing sensitive information such as password?

  • /opt/mattermost/config/mattermost.environment
  • mattermost.service
  • bin/mattermost config get SqlSettings.DataSource

Did you run the command bin/mattermost config migrate as the mattermost user?

Hi there @ahmaddanial, thanks for your help. Here you go:

  1. Mattermost Version: 5.36.0

  2. Database Schema Version: 5.36.0

  3. postgres v10

  4. from GUI, SELECT * FROM Configurations returns the 2 aforementioned records (of course the value column is a big json, not shown in the screenshot):

  5. cat /opt/mattermost/config/mattermost.environment:

MM_CONFIG='postgres://mmuser:redacted@127.0.0.1:5432/mattermost?sslmode=disable&connect_timeout=10'
  1. cat /lib/systemd/system/mattermost.service
[Unit]
Description=Mattermost
After=network.target
After=postgresql.service
Requires=postgresql.service

[Service]
Type=notify
EnvironmentFile=/opt/mattermost/config/mattermost.environment
ExecStart=/opt/mattermost/bin/mattermost
TimeoutStartSec=3600
Restart=always
RestartSec=10
WorkingDirectory=/opt/mattermost
User=mattermost
Group=mattermost
LimitNOFILE=49152

[Install]
WantedBy=postgresql.service
  1. Result of bin/mattermost config get SqlSettings.DataSource run as mattermost user:
    SqlSettings.DataSource: "postgres://mmuser:redacted@127.0.0.1:5432/mattermost?sslmode=disable&connect_timeout=10"

  2. I did indeed run the bin/mattermost config migrate command as mattermost user.

Thank you so much!

@streamer45 @agnivade Could this be a regression?

I think the documentation assumes a MySQL deployment.
The equivalent query for PostgreSQL would be:

SELECT * FROM configurations WHERE Active = 't';

Looking at the provided screenshots everything looks in order.

1 Like

Ah, thank you for the assessment. Iā€™m more used to mysql, so the t threw me off. I guess the documentation could use a bit more clarification between mysql and postgres (it already does so for most all the steps). But it puzzled me as I wanted to verify the migration was successful. Thanks again!