YunoHost-Apps / hedgedoc_ynh

HedgeDoc package for YunoHost
https://hedgedoc.org/
GNU General Public License v3.0
13 stars 8 forks source link

App fails to install if Chromium not present on the server #52

Open veale opened 1 year ago

veale commented 1 year ago

Installing hedgedoc 1.9.6~ynh2 via the YunoHost GUI fails with the following error.

2023-01-14 21:08:30,626: WARNING - error /usr/local/share/.cache/yarn/v6/.tmp/f288a63eaa4f5075285a1b09fb58c8f0.951b3d94bb5ad9ac7b44642adbe595e843390506.prepare/node_modules/puppeteer: Command failed.
2023-01-14 21:08:30,629: WARNING - Exit code: 1
2023-01-14 21:08:30,630: WARNING - Command: node install.js
2023-01-14 21:08:30,630: WARNING - Arguments:
2023-01-14 21:08:30,631: WARNING - Directory: /usr/local/share/.cache/yarn/v6/.tmp/f288a63eaa4f5075285a1b09fb58c8f0.951b3d94bb5ad9ac7b44642adbe595e843390506.prepare/node_modules/puppeteer
2023-01-14 21:08:30,632: WARNING - Output:
2023-01-14 21:08:30,633: WARNING - The chromium binary is not available for arm64.
2023-01-14 21:08:30,634: WARNING - If you are on Ubuntu, you can install with:
2023-01-14 21:08:30,634: DEBUG - 
2023-01-14 21:08:30,635: WARNING -  sudo apt install chromium
2023-01-14 21:08:30,635: DEBUG - 
2023-01-14 21:08:30,636: DEBUG - 
2023-01-14 21:08:30,636: WARNING -  sudo apt install chromium-browser
2023-01-14 21:08:30,637: DEBUG - 
2023-01-14 21:08:30,637: WARNING - ERROR: Failed to set up Chromium r1045629! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
2023-01-14 21:08:30,638: WARNING - Error
2023-01-14 21:08:30,639: WARNING -     at handleArm64 (/usr/local/share/.cache/yarn/v6/.tmp/f288a63eaa4f5075285a1b09fb58c8f0.951b3d94bb5ad9ac7b44642adbe595e843390506.prepare/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js:139:11)
2023-01-14 21:08:30,640: WARNING -     at BrowserFetcher.download (/usr/local/share/.cache/yarn/v6/.tmp/f288a63eaa4f5075285a1b09fb58c8f0.951b3d94bb5ad9ac7b44642adbe595e843390506.prepare/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js:290:13)
2023-01-14 21:08:30,641: WARNING -     at async downloadBrowser (/usr/local/share/.cache/yarn/v6/.tmp/f288a63eaa4f5075285a1b09fb58c8f0.951b3d94bb5ad9ac7b44642adbe595e843390506.prepare/node_modules/puppeteer/lib/cjs/puppeteer/node/install.js:65:5)
2023-01-14 21:08:30,642: DEBUG - info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2023-01-14 21:08:35,330: DEBUG - + ynh_exit_properly
2023-01-14 21:08:35,843: DEBUG - + ynh_clean_setup
2023-01-14 21:08:35,844: DEBUG - + ynh_clean_check_starting
2023-01-14 21:08:35,845: DEBUG - + '[' -n '' ']'
2023-01-14 21:08:35,846: DEBUG - + '[' -n '' ']'
2023-01-14 21:08:36,854: ERROR - Unable to install hedgedoc: An error occurred inside the app installation script

Manually installing chromium with sudo apt install chromium fixes the error.

lightnin commented 1 year ago

Same trouble: https://paste.yunohost.org/raw/ixaciwafub

lightnin commented 1 year ago

Tested with latest package, same trouble. Tried clearing Yarn cache, same trouble. If chromium is a dependency, why not make it get installed in the upgrade process?

https://paste.yunohost.org/raw/kiniboguna

isAAAc commented 1 year ago

i don't understand why a web browser is needed on a server :thinking:

ericgaspar commented 1 year ago

a good question to ask upstream...

lightnin commented 1 year ago

I don't see a live issue about it in the upstream repo. Is there somewhere in their docs or install instructions that describes the dependency? Should we start an issue up there for this? I don't think I have enough of an understanding as to what requires it / why to do that.

ericgaspar commented 1 year ago

there is have a Matrix chanel for support: https://matrix.to/#/#hedgedoc:matrix.org?via=matrix.org&via=kif.rocks&via=tchncs.de

lightnin commented 1 year ago

Just to confirm that installing chromium via terminal did allow me to successfully upgrade afterwards.

mrdrogdrog commented 1 year ago

Hello, I'm one of the HedgeDoc core developers. I encountered this problem as well while working on the ARM Docker Image. The Problem here is that HedgeDoc 1 has a dependency on our CodeMirror fork. Because the dependency is referred by git URL, it must be built on the install system. For this it needs to install the dev dependencies of CodeMirro. One of the dev dependencies is puppeteer, which is a headless chromium which is used for running tests. So far so good, but puppeteer doesn't provide a prebuilt binary for arm64. So if no chromium is installed on the system the whole install process fails.

A hotfix for this problem is to set the env var PUPPETEER_SKIP_DOWNLOAD. The tests aren't executed anyway in the build process so it shouldn't matter. I'll have a talk with the other devs for a permanent solution.

mrdrogdrog commented 1 year ago

Wait. Something is odd here. If I read the config correctly, then the yunohost app uses the prebuilt release.tar.gz file. Therefore it's not necessary to install the development dependencies because you don't need to build the frontend. CodeMirror is a development dependency.

This error could be prevented by installing the correct dependencies.

ericgaspar commented 1 year ago

Thanks for looking into this issue @mrdrogdrog I modified the code by removing bin/setup and added these two lines like: https://github.com/YunoHost-Apps/hedgedoc_ynh/blob/cc4d70a11a79c64a068ac7523e88bcf9c0335ab5/scripts/install#L136-L137

mrdrogdrog commented 1 year ago

Actually.. executing /bin/setup should do it correctly 🤔 I'm still looking for a more permanent solution.

ericgaspar commented 1 year ago

@lightnin @isAAAc @veale Is version 1.9.7~ynh2 fixing this issue?

lightnin commented 1 year ago

In order to test, is it sufficient to uninstall chromium via apt, and then try to do the upgrade and see if it works? Or does something else have to be done to get my (production) server into the correct state to test this?

isAAAc commented 1 year ago

@lightnin @isAAAc @veale Is version 1.9.7~ynh2 fixing this issue?

i upgraded on a vps yesterday without any trouble, but upgrading is offtopic on this issue , right ?

lightnin commented 1 year ago

@lightnin @isAAAc @veale Is version 1.9.7~ynh2 fixing this issue?

i upgraded on a vps yesterday without any trouble, but upgrading is offtopic on this issue , right ?

For me the failure always happened when I attempted upgrades, as I've had hedgedoc running on my server for a few years now. I never tried an initial install, but assume it would fail the same way in that case. So I don't think upgrades are off topic. I'm assuming you had not installed chromium on the VPS before upgrading, of course.

3lis4 commented 1 year ago

Hi, I ran into the same issue. I tried to install HedgeDoc 1.9.7~ynh3 on my Raspberry PI 4 (4Go RAM, 64Go storage) with Yunohost 11.1.19 (stable) through the webadmin, and got an error (https://paste.yunohost.org/raw/okalufevov). Then I ran apt install chromium and tried again, but had another error (https://paste.yunohost.org/raw/ubirokukiy). I tried with PUPPETEER_SKIP_DOWNLOAD env var to true but still can't install it (https://paste.yunohost.org/raw/filowosugi).

(Here is the link to the Yunohost forum post about my issue : https://forum.yunohost.org/t/hedgedoc-install-fails-on-rasp4-chromium-related-issue/24790)