YunoHost-Apps / pleroma_ynh

Pleroma package for YunoHost: A free, federated social networking server built on open protocols.
https://pleroma.social/
GNU Affero General Public License v3.0
30 stars 11 forks source link

Cannot install or upgrade frontends or emoji #215

Closed csolisr closed 1 year ago

csolisr commented 1 year ago

Describe the bug

Pleroma for YunoHost does not allow installing or upgrading additional frontends or emoji. This is particularly important because the bundled interface is using a version that hasn't been updated in 9 months at the time of this report.

Context

Steps to reproduce

  1. Install Pleroma and create an account. Notice that the backend version is 2.4.4 and the frontend version is commit b13d8f7e.
  2. Enter the administrator screen then go to Settings > Frontend. Notice that none of the five available frontends are marked as installed.
  3. Attempt to install Pleroma-FE, which is the default frontend bundled with Pleroma. After a few seconds, a popup will appear with an Error 500.
  4. Go to Settings > Emoji. A popup will appear automatically stating "Request failed with status code 500 - Failed to create the emoji pack directory at /var/lib/pleroma/static/emoji: enoent". This indicates that the administrator tools might not be honoring the configuration file and are attempting to use the default folder, instead of the one used by YunoHost which is located at /home/yunohost.app/pleroma/static.

Expected behavior

The system should allow installing add-ons directly from the application, but this does not seem to be working.

Logs

$ sudo -u pleroma MIX_ENV=prod ./bin/pleroma_ctl frontend install pleroma-fe

[info]  Downloading pre-built bundle for pleroma-fe
** (File.Error) could not make directory (with -p) "/var/lib/pleroma/static/frontends/tmp": no such file or directory
    (elixir 1.10.4) lib/file.ex:314: File.mkdir_p!/1
    lib/pleroma/frontend.ex:74: Pleroma.Frontend.unzip/2
    lib/pleroma/frontend.ex:37: Pleroma.Frontend.install/2
    (stdlib 3.12.1.2) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir 1.10.4) lib/code.ex:341: Code.eval_string_with_error_handling/3
nithou commented 1 year ago

I get the same problem, tried to extend writing rights of the pleroma user but that didn't help either. Opened a help subject here too: https://forum.yunohost.org/t/pleroma-several-errors-500-400-mkdir-p/22044

csolisr commented 1 year ago

For now I found the following workaround:

In good theory this value is already set on the config file, but since the admin tool is also configured to read values from the database, this config value might have been ignored as a result. Wondering if there's a way to set it directly using pleroma_ctl?

bugsysop commented 1 year ago

I confirm this work fine!

I just successfully installed a new frontend after changing the static dirpath in the admin WebUI.

In the last Pleroma version you find this option here: Admin Panel > Settings > Frontend

lapineige commented 1 year ago

Is that something we could / should change in this package ?

csolisr commented 1 year ago

Yes it should be added to the package, I still need to investigate how to configure it from the CLI though.

bugsysop commented 1 year ago

@csolisr

If we look at the Pleroma config file created by the YNH install script (/etc/pleroma/config.exs), the path for the static directory is correctly set-up to /home/yunohos.app/pleroma/static

This mean that the error is in the database...

Can we change the default value (stored in DB) for the static ressources with a post-install hook?

bugsysop commented 1 year ago

To solve the problem from CLI:

1- Login in SSH as admin user

2- Get Root privileges

sudo -s

3- Exec this command

su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl config migrate_to_db"

Note: this command is executed as pleroma user, to register in the DB the settings inserted in the config file by Yunohost during install (ref. /etc/pleroma/config.exs).

In other terms, we have now the same path to static dir in DB and in the config file:

/home/yunohos.app/pleroma/static

This can be automated with YNH App install script for Pleroma... ...and solve this issue!

References:

lapineige commented 1 year ago

This can be automated with YNH App install script for Pleroma... ...and solve this issue!

So #224 should do it 🙂