Mattermost, Inc.

[SOLVED] Initial mattermost setup - psql errors: relation X does not exist

Hi,

I’m running into some trouble while trying to set-up a mattermost server with Gitlab oauth.
Gitlab runs on a bare system, mattermost and psql each in their own docker containers.

I’m getting the exact same errors as shown here: https://github.com/mattermost/platform/issues/2478 However, the `solution´ does not seem to work for me.

tried mattermost 3.0.3 in combination with gitlab 8.8 and psql 9.5 and 9.6.

How can I continue debugging this in order to make it work?

kind regards,
Chris

Relevant parts of mattermost dockerfile:
RUN wget https://releases.mattermost.com/3.0.3/mattermost-team-3.0.3-linux-amd64.tar.gz \
ENTRYPOINT ["/opt/mattermost/bin/platform","-config=/opt/mattermost/config/config.json"]

obfuscated config.json
{ "ServiceSettings": { "ListenAddress": ":8065", "MaximumLoginAttempts": 10, "SegmentDeveloperKey": "", "GoogleDeveloperKey": "", "EnableOAuthServiceProvider": false, "EnableIncomingWebhooks": false, "EnableOutgoingWebhooks": false, "EnableCommands": false, "EnableOnlyAdminIntegrations": true, "EnablePostUsernameOverride": false, "EnablePostIconOverride": false, "EnableTesting": false, "EnableDeveloper": false, "EnableSecurityFixAlert": true, "EnableInsecureOutgoingConnections": false, "EnableMultifactorAuthentication": false, "AllowCorsFrom": "", "SessionLengthWebInDays": 30, "SessionLengthMobileInDays": 30, "SessionLengthSSOInDays": 30, "SessionCacheInMinutes": 10, "WebsocketSecurePort": 443, "WebsocketPort": 80, "WebserverMode": "regular" }, "TeamSettings": { "SiteName": "Mattermost@mycompany", "MaxUsersPerTeam": 50, "EnableTeamCreation": false, "EnableUserCreation": true, "EnableOpenServer": false, "RestrictCreationToDomains": "", "RestrictTeamNames": true, "EnableCustomBrand": false, "CustomBrandText": "", "RestrictDirectMessage": "any" }, "SqlSettings": { "DriverName": "postgres", "DataSource": "postgres://user:pass@1234.mydomain:2288/mattermost?sslmode=disable\u0026connect_timeout=10", "DataSourceReplicas": [], "MaxIdleConns": 10, "MaxOpenConns": 10, "Trace": false, "AtRestEncryptKey": "..." }, "LogSettings": { "EnableConsole": true, "ConsoleLevel": "DEBUG", "EnableFile": true, "FileLevel": "INFO", "FileFormat": "", "FileLocation": "" }, "FileSettings": { "DriverName": "local", "Directory": "./data/", "EnablePublicLink": false, "PublicLinkSalt": "...", "ThumbnailWidth": 120, "ThumbnailHeight": 100, "PreviewWidth": 1024, "PreviewHeight": 0, "ProfileWidth": 128, "ProfileHeight": 128, "InitialFont": "luximbi.ttf", "AmazonS3AccessKeyId": "", "AmazonS3SecretAccessKey": "", "AmazonS3Bucket": "", "AmazonS3Region": "", "AmazonS3Endpoint": "", "AmazonS3BucketEndpoint": "", "AmazonS3LocationConstraint": false, "AmazonS3LowercaseBucket": false }, "EmailSettings": { "EnableSignUpWithEmail": false, "EnableSignInWithEmail": false, "EnableSignInWithUsername": true, "SendEmailNotifications": false, "RequireEmailVerification": false, "FeedbackName": "", "FeedbackEmail": "", "SMTPUsername": "", "SMTPPassword": "", "SMTPServer": "", "SMTPPort": "", "ConnectionSecurity": "", "InviteSalt": "...", "PasswordResetSalt": "...", "SendPushNotifications": false, "PushNotificationServer": "", "PushNotificationContents": "generic" }, "RateLimitSettings": { "EnableRateLimiter": true, "PerSec": 10, "MemoryStoreSize": 10000, "VaryByRemoteAddr": true, "VaryByHeader": "" }, "PrivacySettings": { "ShowEmailAddress": true, "ShowFullName": true }, "SupportSettings": { "TermsOfServiceLink": "https://about.mattermost.com/default-terms/", "PrivacyPolicyLink": "https://about.mattermost.com/default-privacy-policy/", "AboutLink": "https://about.mattermost.com/default-about/", "HelpLink": "https://about.mattermost.com/default-help/", "ReportAProblemLink": "https://about.mattermost.com/default-report-problem/", "SupportEmail": "..." }, "GitLabSettings": { "Enable": true, "Secret": "...", "Id": "...", "Scope": "", "AuthEndpoint": "https://gitlab-t.mydomain/oauth/authorize", "TokenEndpoint": "https://gitlab-t.mydomain/oauth/token", "UserApiEndpoint": "https://gitlab-t.mydomain/api/v3/user" }, "GoogleSettings": { "Enable": false, "Secret": "", "Id": "", "Scope": "", "AuthEndpoint": "", "TokenEndpoint": "", "UserApiEndpoint": "" }, "LdapSettings": { "Enable": false, "LdapServer": "", "LdapPort": 389, "ConnectionSecurity": "", "BaseDN": "", "BindUsername": "", "BindPassword": "", "UserFilter": "", "FirstNameAttribute": "", "LastNameAttribute": "", "EmailAttribute": "", "UsernameAttribute": "", "NicknameAttribute": "", "IdAttribute": "", "SkipCertificateVerification": false, "QueryTimeout": 60, "LoginFieldName": "" }, "ComplianceSettings": { "Enable": false, "Directory": "./data/", "EnableDaily": false } }

psql container
see https://github.com/docker-library/postgres.git
The only addition I made was to create the user/database + privileges which are being used in the config.json from mattermost.

Hi @crucidal,

Can you provide the full errors that you get? Or are you missing the ‘Type’ column for the ‘Preference’ table just like in that GitHub issue?

I am getting the same errors. It appears that the database is not being created?

I am using mattermost-docker:

git clone https://github.com/mattermost/mattermost-docker
cd mattermost-docker
docker-compose build
docker-compose up -d
docker logs mattermost_db_1

I am able to reproduce it on more than one host. :confused:

Hi Jwil,

Sorry for the fact that I didn’t respond in such a long time!
The issue is still relevant for me so here’s the full errors that I’m seeing:

error logs

ERROR: relation “systems” does not exist at character 19
STATEMENT: SELECT Value FROM Systems WHERE Name='Version’
ERROR: relation “idx_teams_name” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_teams_invite_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_teammembers_team_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_teammembers_user_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_channels_team_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_channels_name” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_channelmembers_channel_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_channelmembers_user_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_posts_update_at” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_posts_create_at” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_posts_channel_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_posts_root_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_posts_message_txt” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_posts_hashtags_txt” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_users_email” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_audits_user_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_sessions_user_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_sessions_token” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_oauthapps_creator_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_oauthaccessdata_client_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_oauthaccessdata_user_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_oauthaccessdata_refresh_token” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_oauthauthdata_client_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_incoming_webhook_user_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_incoming_webhook_team_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_outgoing_webhook_team_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_command_team_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_preferences_user_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_preferences_category” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_preferences_name” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_password_recovery_code” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_status_user_id” does not exist
STATEMENT: SELECT $1::regclass
ERROR: relation “idx_status_status” does not exist
STATEMENT: SELECT $1::regclass

Currently I’m on mattermost version 3.3.0.
The fact that I’m using Oauth does not seem to make a difference. (the errors also occur when I start a completely new mattermost instance + new DB with oauth disabled)

It seems like mattermost is not properly populating the empty database and tries to query for non-existing relations.
The question is: How do I fix this? :slight_smile:

edit: The preview properly shows my errors embedded in a “details” section but the actual post does not.
Sorry if I messed up :o

Kind Regards,
Chris

Have you tried following the steps in the install guide (this is for Ubuntu but we have other install guides in the sidebar)? I just ran through them and they worked for me when setting up a postrgres database.

The only minor issue I had was setting:
local all all peer
to:
local all all md5
under the local connections section in my /etc/postgresql/9.3/main/pg_hba.conf file, since I was running the postgres box off my localhost.

Same issue here? [Solved] PostgreSQL error after Mattermost upgrade from 3.2.0 to 3.4.0: some relation does not exist