Mattermost, Inc.

[Solved] No System Console when logging in with GitLab

I’ve done a view “production” installs to test out mattermost and the Gilab integration.

Well, if I do a Mattermost with GitLab integration Installation, I won’t have no “system console”.
To get it right. The Installation works and I can login through GitLab.

But there is no “system console” option.

If I manually create a group and login through Mattermost, then I have a system console.

my question is, how do I get the system console when using GitLab authentication?

Hi @zwarag,

Thanks for the question,

The first user account created after a new install is given the System Admin role, which provides access to the System Console.

My guess is the GitLab SSO account you’re using doesn’t have the System Admin role. To add it, use your first account, with the System Admin role, and go to System Console > Teams > [TEAM_NAME] to provide the account you’re using for GitLab SSO the System Admin role and it should be able to see the System Console.

1 Like

You can also add yourself via the mattermost command line with ./platform -assign_role -team_name="yourteam" -email="you@example.com" -role="system_admin"

1 Like

Thanks a bucket. Was easy as pie!

What directory should this be run inside on a gitlab install from the ubuntu aptitude package manager? thanks!

cd /opt/gitlab/embedded/bin
./mattermost -assign_role -team_name="yourteam" -email="you@example.com" -role="system_admin"

awesome, @coreyhulen, thanks for the quick reply! Unfortunately, it looks like there is an error finding config.json when running that i pasted the output below for reference.

root@git01kwd01:/opt/gitlab/embedded/bin# sudo ./mattermost -assign_role -team_name="offtopic2" -email="redacted@example.com" -role="system_admin"
panic: Error opening config file=config.json, err=open config.json: no such file or directory

goroutine 1 [running]:
github.com/mattermost/platform/utils.LoadConfig(0xb7a310, 0xb)
        /home/travis/gopath/src/github.com/mattermost/platform/utils/config.go:136 +0x158
main.main()
        /home/travis/gopath/src/github.com/mattermost/platform/mattermost.go:44 +0x46

goroutine 5 [runnable]:
code.google.com/p/log4go.ConsoleLogWriter.run(0xc20805c060, 0x7fb9659c4180, 0xc20802e008)
        /home/travis/gopath/src/github.com/mattermost/platform/Godeps/_workspace/src/code.google.com/p/log4go/termlog.go:23
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 6 [runnable]:
os/signal.loop()
        /usr/local/go/src/os/signal/signal_unix.go:19
created by os/signal.init·1
        /usr/local/go/src/os/signal/signal_unix.go:27 +0x35

I’m really excited to get mattermost working for our teams to use, i welcome any ideas about how to get access to the system console! thanks!

edit: i figured i’d also add that I do have this file which has other changes from the /etc/gitlab/gitlab.rb file that are applied when i run gitlab-ctl reconfigure
-rw-r–r-- 1 mattermost root 3226 Oct 22 11:23 /var/opt/gitlab/mattermost/config.json

You can pass in the path to the config file, and have to run the command as user mattermost. This is what worked for me:

sudo -u mattermost ./mattermost -assign_role -team_name=“yourteam” -email="you@example.com" -role=“system_admin” -config=/var/opt/gitlab/mattermost/config.json

Note that you have to log out and back into Mattermost for the system admin permissions to be picked up

gitlab-ce 8.1.0 / mattermost 1.1.0:

cd /opt/gitlab/embedded/service/mattermost
/opt/gitlab/embedded/bin/mattermost -config=/var/opt/gitlab/mattermost/config.json -assign_role -team_name="yourteam" -email="you@example.com" -role="system_admin"

But I had to grant access to the DB temporarely in /var/opt/gitlab/postgresql/data/pg_hba.conf

1 Like

WOOHOO! It looked like it errored out, but it worked after logging in and out of the web frontend like you suggested, @sgvandijk!

for reference, here is the error output.

root@git01kwd01:/opt/gitlab/embedded/bin# sudo -u mattermost ./mattermost -assign_role -team_name="offtopic2" -email="ddamstra@cuanswers.com" -role="system_admin" -config=/var/opt/gitlab/mattermost/config.json
[10/22/15 14:50:35] [EROR] Failed to parse server templates html/template: pattern matches no files: `./*.html`
[10/22/15 14:50:35] [EROR] Failed to parse templates html/template: pattern matches no files: `./*.html`

I really apprecaite your help! Getting into the console also stopped me from seeing the Preview mode message on the frontend about email not being configured! (email was configured and working before the apt-get update/install this morning)

figured it out thank you all.

Hi all,

Thanks for this thread. I’d been struggling with the new email configuration after upgrading to Gitlab 8.1 this morning. Posting what worked for me in the hope it’s helpful to anyone else stumbling across this issue!

Gitlab 8.1 Omnibus Edition

Like @pka, I needed to temporarily grant access to the db. This can be done by adding the following line to pg_hba.conf:

# /var/opt/gitlab/postgresql/data/pg_hba.conf
# ...
local    all    all    peer map=gitlab_mattermost

Then on the command line:

$ gitlab-ctl restart postgresql
$ cd /opt/gitlab/embedded/bin
$ sudo -u mattermost ./mattermost -assign_role -team_name="yourteam" -email="your@emailaddress.com" -role="system_admin" -config=/var/opt/gitlab/mattermost/config.json

Next, log out of Mattermost and log back in to see the System Console menu option:

Once everything’s working, reconfigure and restart Gitlab to remove the database permissions:

$ gitlab-ctl reconfigure
$ gitlab-ctl restart

It seems that changes made to at least some settings in the system console get steamrolled when gitlab-ctl reconfigure is run. (i’m running the ubuntu package manager installed version. To get my desired settings to stick, i had to set them explicitly in the gitlab.rb file or the defaults from https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template would be applied. settings you want to change can be copied to gitlab.rb and modified to desired values that will be applied when gitlab-ctl reconfigure runs.

a few examples of specific ones i had to explicitly set are

mattermost['email_feedback_name'] = "Mattermost"
mattermost['email_feedback_email'] = "noreply@example.com"
mattermost['service_enable_incoming_webhooks'] = true
mattermost['service_enable_post_username_override'] = true
mattermost['service_enable_post_icon_override'] = true
mattermost['log_enable_file'] = true

hope this helps somebody else!

Hello there!

I solved this by editing the users table in the mattermost_production database; A query like this:

UPDATE users SET roles = "admin system_admin" where username = "your_username";

To access the mattermost database in the omnibus installation:
sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d mattermost_production

Cheers!

Hi,
I also ran to the issue after following the steps. can you help me to revert the setting and get rid of these errors before i proceed with your suggestions?

I ran the following command
sudo -u mattermost ./mattermost -assign_role -team_name=“yourteam” -email="your@emailaddress.com" -role=“system_admin” -config=/var/opt/gitlab/mattermost/config.json

hi @pmsudhi
I’m not an expert on this, but my inclination is that you don’t have permissions to run the restart, so I would “sudo” the command. if you didn’t previously need to do it that way before running the other command, you might check if it changed your config file permissions.

I still cannot get it to work. I get a bunch of errors.

@ywecur, please see http://www.mattermost.org/troubleshoot/ and share your repro steps?

Running the reasonably up-to-date GitLab v8.5.3 with Mattermost v2.0.0 Build 5950.

I had the System Console appearing in my menu…then it disappeared. Only thing I can think of that may have caused it to disappear was I changed my email address in my GitLab account that the Mattermost account was twinned to through SSO. I changed my GitLab email address back to what it was originally but this did not fix the problem.

So I followed the suggestion above to execute the “./mattermost -assign_role -team_name=“TeamName” -email=“myaddress.com” -role=“system_admin”” command to re-assign the admin role to the team but it fails with the error message “panic: runtime error: invalid memory address or nil pointer dereference”.

Based on another error report I then tried with the “sudo -u” prefix and the “-config=”/var/opt/gitlab/mattermost/config.json" option but got the “panic: Failed to load system translations for ‘en’” error.

So, based on yet another error report I copied the en.json file over to the /opt/gitlab/embedded/bin/ directory and now it fails with the “panic: invalid character ‘<’ looking for beginning of value” error.

Sigh…there has to be an easier way to get logged in as admin in Mattermost!

What do I try next…any suggestions?

There was a bug in the command line tool from localization in 2.0 that is fixed in Mattermost 2.1 which ships tomorrow.