gitlab-ctl reconfigure fails when running mattermost under a subpath
Summary
mattermost fails to configure static files for subpath.
What is the current bug behavior?
mattermost user doesnt have sufficient permission.
Temporary Fix
Manually going into the docker container and run these commands seem to fix the issue.
chown -R mattermost:mattermost /opt/gitlab/embedded/service/mattermost/client/*
su -s /bin/bash mattermost
cd /opt/gitlab/service/mattermost
# GitLab 14.6 and above
/opt/gitlab/embedded/bin/mmctl --config /var/opt/gitlab/mattermost/config.json config subpath --assets-dir /opt/gitlab/embedded/service/mattermost/client --path /mattermost
exit
gitlab-ctl hup mattermost
Note:
The mmctl command above won't work for versions of GitLab prior to 14.6. If that is the case, use this command instead:
/opt/gitlab/embedded/bin/mattermost -c /var/opt/gitlab/mattermost/config.json config subpath --path /mattermost
Additionally you will need to update the GitLab Mattermost system application with the OAuth redirect URIs containing the subpath (under Admin area > Applications > GitLab Mattermost):
https://gitlab.example.com/mattermost/signup/gitlab/complete
https://gitlab.example.com/mattermost/login/gitlab/complete
Relevant logs
{"level":"error","ts":1564160649.7075214,"caller":"web/static.go:27","msg":"Failed to update assets subpath from config","error":"failed to update root.html with subpath /mattermost: open /opt/gitlab/embedded/service/mattermost/client/root.html: permission denied","errorVerbose":"open /opt/gitlab/embedded/service/mattermost/client/root.html: permission denied\nfailed to update root.html with subpath /mattermost\ngithub.com/mattermost/mattermost-server/utils.UpdateAssetsSubpath\n\t/go/src/github.com/mattermost/mattermost-server/utils/subpath.go:117\ngithub.com/mattermost/mattermost-server/utils.UpdateAssetsSubpathFromConfig\n\t/go/src/github.com/mattermost/mattermost-server/utils/subpath.go:156\ngithub.com/mattermost/mattermost-server/web.(*Web).InitStatic\n\t/go/src/github.com/mattermost/mattermost-server/web/static.go:26\ngithub.com/mattermost/mattermost-server/web.New\n\t/go/src/github.com/mattermost/mattermost-server/web/web.go:39\ngithub.com/mattermost/mattermost-server/cmd/mattermost/commands.runServer\n\t/go/src/github.com/mattermost/mattermost-server/cmd/mattermost/commands/server.go:83\ngithub.com/mattermost/mattermost-server/cmd/mattermost/commands.serverCmdF\n\t/go/src/github.com/mattermost/mattermost-server/cmd/mattermost/commands/server.go:53\ngithub.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra.(*Command).execute\n\t/go/src/github.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra/command.go:762\ngithub.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra.(*Command).ExecuteC\n\t/go/src/github.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra/command.go:852\ngithub.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra.(*Command).Execute\n\t/go/src/github.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra/command.go:800\ngithub.com/mattermost/mattermost-server/cmd/mattermost/commands.Run\n\t/go/src/github.com/mattermost/mattermost-server/cmd/mattermost/commands/root.go:15\nmain.main\n\t/go/src/github.com/mattermost/mattermost-server/cmd/mattermost/main.go:30\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:200\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1337"}
Details of package version
I'm running gitlab with docker using gitlab/gitlab-ce:latest.
Configuration details
The relevant part in omnibus_config.rb
mattermost_external_url 'https://example.com'
mattermost_nginx['listen_port'] = 8000
mattermost_nginx['listen_https'] = false
mattermost_nginx['redirect_http_to_https'] = true
mattermost['env'] = {
'MM_SERVICESETTINGS_SITEURL' => "https://example.com/mattermost/"
}
Edited by Anton Smith