gitlab-arm64 icon indicating copy to clipboard operation
gitlab-arm64 copied to clipboard

Mattermost integration

Open Giattuck opened this issue 8 months ago • 6 comments

Hello, anyone here using the mattermost integration on ARM?

I've tried to enable it on my compose file:

# --- Mattermost Configuration ---
        mattermost_external_url 'https://chat.example.com'
        mattermost_nginx['redirect_http_to_https'] = true
        mattermost['enable'] = true
        
        # --- Mattermost GitLab OAuth Configuration ---
        mattermost['gitlab_enable'] = true
        mattermost['gitlab_id'] = ENV['MATTERMOST_GITLAB_ID']
        mattermost['gitlab_secret'] = ENV['MATTERMOST_GITLAB_SECRET']
        mattermost['gitlab_scope'] = "read_user"
        mattermost['gitlab_auth_endpoint'] = "https://gitlab.example.com/oauth/authorize"
        mattermost['gitlab_token_endpoint'] = "https://gitlab.example.com/oauth/token"
        mattermost['gitlab_user_api_endpoint'] = "https://gitlab.example.com/api/v4/user"
        # --- End Mattermost GitLab OAuth Configuration ---
        
        # --- End Mattermost Configuration ---

the same compose works on intel VM, do not works on ARM, it crashes the containers:


[2025-04-27T23:36:56+00:00] FATAL: ---------------------------------------------------------------------------------------
[2025-04-27T23:36:56+00:00] FATAL: PLEASE PROVIDE THE CONTENTS OF THE stacktrace.out FILE (above) IF YOU FILE A BUG REPORT
[2025-04-27T23:36:56+00:00] FATAL: ---------------------------------------------------------------------------------------
[2025-04-27T23:36:56+00:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: runit_service[mattermost] (mattermost::enable line 140) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/embedded/bin/sv restart /opt/gitlab/service/mattermost ----
STDOUT: timeout: down: /opt/gitlab/service/mattermost: 1s, normally up, want up
STDERR: 
---- End output of /opt/gitlab/embedded/bin/sv restart /opt/gitlab/service/mattermost ----
Ran /opt/gitlab/embedded/bin/sv restart 

in logs/mattermost/current i have anly lines with this error:

fatal: unable to run: /opt/gitlab/embedded/bin/mattermost: exec format error

Any help?

Giattuck avatar Apr 27 '25 23:04 Giattuck

It looks like the error exec format error indeed points to an architecture mismatch with the executable file. Let me take a look into this.

zengxs avatar Apr 29 '25 09:04 zengxs

Hi!

It seems there's indeed an issue with the Mattermost integration on the gitlab-arm64 image. After looking into the GitLab container, I've found that both /opt/gitlab/embedded/bin/mattermost and /opt/gitlab/embedded/bin/mmctl are x86-64 architecture binaries.

Furthermore, it appears that the prepackaged Mattermost plugins also only include pre-built files for the x86-64 architecture, as shown by the amd64 in the filenames:

/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-ai-v1.1.1-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-ai-v1.1.1-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-boards-v9.1.1-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-boards-v9.1.1-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-calls-v1.5.2-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-calls-v1.5.2-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-channel-export-v1.2.1-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-channel-export-v1.2.1-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-github-v2.3.0-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-github-v2.3.0-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-gitlab-v1.9.1-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-gitlab-v1.9.1-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-jira-v4.2.1-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-jira-v4.2.1-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-metrics-v0.5.3-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-metrics-v0.5.3-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-mscalendar-v1.3.4-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-mscalendar-v1.3.4-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-msteams-meetings-v2.2.0-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-msteams-meetings-v2.2.0-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-msteams-v2.1.1-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-msteams-v2.1.1-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-nps-v1.3.3-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-nps-v1.3.3-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-playbooks-v1.40.0-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-playbooks-v1.40.0-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-playbooks-v2.1.1-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-playbooks-v2.1.1-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-servicenow-v2.3.4-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-servicenow-v2.3.4-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-user-survey-v1.1.1-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-user-survey-v1.1.1-linux-amd64.tar.gz.sig
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-zoom-v1.8.0-linux-amd64.tar.gz
/opt/gitlab/embedded/service/mattermost/prepackaged_plugins/mattermost-plugin-zoom-v1.8.0-linux-amd64.tar.gz.sig

It seems likely that GitLab's official packaging for the arm64 installer might have overlooked the architecture compatibility for Mattermost.

The good news is that apart from the Mattermost-related files, the other binaries in the image should be correctly built for the arm64 architecture.

Regarding potential solutions, the most stable approach would be to use the Mattermost functionality on an x86-64 architecture, as this wouldn't involve modifying any files within the GitLab installation package and would ensure its stability.

Alternatively, you could try a more involved approach: manually compile the arm64 versions of mattermost and mmctl and replace the existing x86-64 versions in the /opt/gitlab/embedded/bin/ directory of your arm64 image. Additionally, if GitLab's Mattermost integration utilizes all the plugins in the /opt/gitlab/embedded/service/mattermost/prepackaged_plugins/ directory, you would also need to build arm64 versions of all those plugins and replace the corresponding files in the image.

Hopefully, this information is helpful!

zengxs avatar Apr 29 '25 09:04 zengxs

Hi again!

It seems there might be a third potential workaround you could explore. Your arm64 system could be configured to enable x86-64 emulation. This would allow your arm64 server to run the x86-64 Mattermost binaries through emulation, while the main GitLab application would continue to run natively on arm64.

However, it's important to be aware that using emulation can introduce a significant performance overhead compared to native execution.

For specific instructions on how to set up x86-64 emulation on your system, you can refer to this helpful resource: https://github.com/tonistiigi/binfmt

This approach might offer a way to get Mattermost working on your ARM setup, but keep the potential performance implications in mind.

zengxs avatar Apr 29 '25 10:04 zengxs

hello @zengxs! Thanks for taking the time to do this. In my spare time I'll try the manual build solution, although probably the best solution is to move the gitlab instance to an AMD server.

Thanks again for your great work

Giattuck avatar Apr 29 '25 12:04 Giattuck

Hi @Giattuck, another option could be rheens/mattermost-app. I personally use it on my ARM server for hosting Mattermost (next to gitlab) and it works great.

lukaslangrock avatar May 16 '25 07:05 lukaslangrock

Thanks for sharing @lukaslangrock!

Giattuck avatar May 21 '25 00:05 Giattuck