YunoHost-Apps / mattermost_ynh

Mattermost package for YunoHost
http://www.mattermost.org
GNU General Public License v3.0
33 stars 19 forks source link

Cannot install package on Raspberry Pi 4 #304

Closed Viguro79 closed 2 years ago

Viguro79 commented 2 years ago

Describe the bug

Cannot install the app in Yunohost.

Context

Steps to reproduce

Trying to install the package from the webadmin, it doesn't work

Logs

Full log

sudo: bin/mmctl: command not found : even after installing golang-go from apt-get, it doesn't work.
I couldn't neither install mmctl from command line :

sudo go get -u github.com/mattermost/mmctl
package hash/maphash: unrecognized import path "hash/maphash" (import path does not begin with hostname)
kemenaran commented 2 years ago

Well, bin/mmctl is bundled with mattermost and should be in the /var/www/mattermost directory – but it seems for some reason the script doesn't find it.

I pushed a tentative fix here (#305); could you try installing it with

sudo yunohost app install https://github.com/YunoHost-Apps/mattermost_ynh/tree/pull/305/head

and tell me if this works?

Viguro79 commented 2 years ago

Wow, your answer and correction was fast... But it doesn't work neither :

Info: DEBUG - + bin_mmctl=/var/www/mattermost/bin/mmctl
Info: DEBUG - + export MMCTL_LOCAL=true
Info: DEBUG - + MMCTL_LOCAL=true
Info: DEBUG - + export MMCTL_LOCAL_SOCKET_PATH=/var/run/mattermost/mattermost_local.socket
Info: DEBUG - + MMCTL_LOCAL_SOCKET_PATH=/var/run/mattermost/mattermost_local.socket
Info: DEBUG - + ynh_exec_warn_less sudo --preserve-env -u mattermost /var/www/mattermost/bin/mmctl user create --username vincent --email xxx@xxx.fr --password ********** --locale en --email-verified --system-admin
Info: DEBUG - + eval sudo --preserve-env -u mattermost /var/www/mattermost/bin/mmctl user create --username vincent --email xxx@xxx.fr --password ********** --locale en --email-verified --system-admin
Info: DEBUG - ++ sudo --preserve-env -u mattermost /var/www/mattermost/bin/mmctl user create --username vincent --email xxx@xxx.fr --password ********** --locale en --email-verified --system-admin
Info: DEBUG - sudo: /var/www/mattermost/bin/mmctl: command not found

And because the script is removing everything, I cannot check for the path (or don't know how I could).

kemenaran commented 2 years ago

Heh. So there's an --no-remove-on-failure option you can use to inspect the app state after a failed install.

But actually I found the issue: I downloaded the third-party ARM release of Mattermost, and it doesn't include the mmctl binary.

I'll try to fix the ARM build, and then update this issue.

kemenaran commented 2 years ago

I'm trying to add the mmctl package to the ARM build over there (https://github.com/SmartHoneybee/ubiquitous-memory/pull/136), but it may take a while.

Meanwhile I'm attempting to fix installing Mattermost of ARM by skipping the first user creation if mmctl is not available. Could you retry an install using sudo yunohost app install https://github.com/YunoHost-Apps/mattermost_ynh/tree/pull/305/head, and tell me if that works?

kemenaran commented 2 years ago

The fix was merged to master, and should be available to the Web Admin UI in a few hours.

Meanwhile you can install the fixed version by executing:

sudo yunohost app install https://github.com/YunoHost-Apps/mattermost_ynh/tree/master
Viguro79 commented 2 years ago

I confirm it works. The script is still asking for the team and user names. However, the install finalize. Then, at first launch, it ask for an admin account and there is no team created. Thanks !

kemenaran commented 2 years ago

Great! Yes, the script asks for value it never uses for now; but hopefully this will be fixed soon (by actually creating the proper user and team again).

kemenaran commented 2 years ago

@Viguro79 @g0eki Hey, if you have some time to spare, could you try again to install a Mattermost instance from scratch on your Rasbpberry Pi (as a second Mattermost install, I guess), and see if the user and team are created properly? The creation should be working again now (but I don't have the hardware to test it).

sudo yunohost app install https://github.com/YunoHost-Apps/mattermost_ynh/tree/master
Viguro79 commented 2 years ago

I tried the command on my install from scratch, after removing the existing Mattermost instance. At first lauch via the url, username and password are already filled. It's only asking for an email adress. But the default team is still not present, I have to create it manually. Nevermind, it's not an issue for my purpose, the instance is still working correctly then.

kemenaran commented 2 years ago

Thanks for testing! Well, both the user and first team should have been created. If you don't mind sharing your installation log, I'd be interested into knowing what went wrong.

Viguro79 commented 2 years ago

... I would like but don't know which log you're interested in and where I can find it 🥲

kemenaran commented 2 years ago

Hmm, I don't know either 😅 I looked around, but couldn't find the command to get the installation logs.

Otherwise this command should capture the full logs to mattermost-install.log:

sudo yunohost app install https://github.com/YunoHost-Apps/mattermost_ynh/tree/master --force --debug > mattermost-install.log
Viguro79 commented 2 years ago
92430 DEBUG + echo '[#################+..] > Create the first administrator and team...'
92431 DEBUG + set -o xtrace
92432 INFO [#################+..] > Create the first administrator and team...
92434 DEBUG ++ echo Team
92436 DEBUG ++ iconv -f utf8 -t ascii//TRANSLIT//IGNORE
92437 DEBUG ++ tr -s -
92438 DEBUG ++ tr A-Z a-z
92440 DEBUG ++ sed -e 's/[^[:alnum:]]/-/g'
92453 DEBUG + team_name=team
92454 DEBUG + bin_mmctl=/var/www/mattermost/bin/mmctl
92455 DEBUG + [[ -f bin_mmctl ]]
92455 DEBUG + ynh_replace_string '"EnableLocalMode": true' '"EnableLocalMode": false' /var/www/mattermost/config/config.json
92455 DEBUG + local legacy_args=mrf
92456 DEBUG + args_array=([m]=match_string= [r]=replace_string= [f]=target_file=)
92456 DEBUG + local -A args_array
92457 DEBUG + local match_string
92457 DEBUG + local replace_string
92458 DEBUG + local target_file
92458 DEBUG + ynh_handle_getopts_args '"EnableLocalMode": true' '"EnableLocalMode": false' /var/www/mattermost/config/config.json
92459 DEBUG + set +o xtrace
92670 DEBUG + echo '! Helper used in legacy mode !'
92671 DEBUG + set +x
92677 DEBUG + set +o xtrace
92678 DEBUG + sed --in-place 's@"EnableLocalMode": true@"EnableLocalMode": false@g' /var/www/mattermost/config/config.json
92683 DEBUG + ynh_systemd_action --service_name=mattermost --action=restart --log_path=systemd '--line_match=Started Mattermost'
92684 DEBUG + local legacy_args=nalpte
92685 DEBUG + args_array=([n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length=)
92687 DEBUG + local -A args_array
92688 DEBUG + local service_name
92689 DEBUG + local action
92689 DEBUG + local line_match
92690 DEBUG + local length
92691 DEBUG + local log_path
92692 DEBUG + local timeout
92693 DEBUG + ynh_handle_getopts_args --service_name=mattermost --action=restart --log_path=systemd '--line_match=Started Mattermost'
92693 DEBUG + set +o xtrace
93362 DEBUG + service_name=mattermost
93364 DEBUG + action=restart
93365 DEBUG + line_match='Started Mattermost'
93366 DEBUG + length=20
93367 DEBUG + log_path=systemd
93367 DEBUG + timeout=300
93368 DEBUG + '[' restart == stop ']'
93369 DEBUG + [[ -n Started Mattermost ]]
93370 DEBUG ++ mktemp
93372 DEBUG + local templog=/tmp/tmp.YyUAxy9Yku
93373 DEBUG + '[' systemd == systemd ']'
93374 DEBUG + local pid_tail=21031
93375 DEBUG + journalctl --unit=mattermost --follow --since=-0 --quiet
93377 DEBUG + '[' restart == reload ']'
93378 DEBUG + systemctl restart mattermost
103350 DEBUG + [[ -n Started Mattermost ]]
103351 DEBUG + set +x
104446 DEBUG + echo 'The service mattermost has correctly executed the action restart.'
kemenaran commented 2 years ago

Thanks for the logs! From what I see, the script didn't find the mmctl binary, and didn't even try to create the admin and team.

However I just downloaded the matching Mattermost release, and bin/mmctl is included in the archive.

If you still have this installation hanging around, would you give me the result of sudo ls /var/www/mattermost/bin, so that I can check if mmctl is there?

Viguro79 commented 2 years ago

Well, yes it is there :

xxx@xxx:~ $ sudo ls -lrt /var/www/mattermost/bin
total 102636
-rwxr-x--- 1 mattermost www-data 70396150 Nov  8 18:03 mattermost
-rwxr-x--- 1 mattermost www-data 34694558 Nov  8 18:03 mmctl
kemenaran commented 2 years ago

Hey, isn't that because I made a typo in my code? Yes it is!

Does it work better using this fix I just made?

sudo yunohost app install https://github.com/YunoHost-Apps/mattermost_ynh/tree/pull/310/head
Viguro79 commented 2 years ago

Sorry, I cannot install this fix on my rpi :

xxx@xxx:~ $ sudo yunohost app install https://github.com/YunoHost-Apps/mattermost_ynh/tree/pull/310/head

Error: https://github.com/YunoHost-Apps/mattermost_ynh/tree/pull/310/head is not a valid app url: app url are expected to look like https://domain.tld/path/to/repo_ynh
Error: Unknown app
kemenaran commented 2 years ago

Mmm, strange – works here. What version of Yunohost are you running?

Viguro79 commented 2 years ago

4.3.3. I was prevously on 4.3.2.2 but none of them works.

kemenaran commented 2 years ago

Indeed, I just upgraded from Yunohost 4.2 to 4.3, and it doesn't work now.

@ericgaspar do you have any clue about installing an app directly from a branch or a PR (like sudo yunohost app install https://github.com/YunoHost-Apps/mattermost_ynh/tree/pull/310/head) being broken since Yunohost 4.3?

ericgaspar commented 2 years ago

No idea. @alexAubin may have a better insights of 4.3 changes that can cause this issue.