From ed3f23612091d9084807fead628088ba6c5fd8e8 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Mon, 12 Dec 2022 19:17:43 +0100 Subject: [PATCH] Prosody Appimage: supports only x86_64: * stop trying to generated an ARM64 AppImage (as it is buggy) * display a warning in the settings if incompatible CPU detected * documentation for a workaround Implements #120. --- CHANGELOG.md | 18 ++++---- build-prosody.sh | 19 +++++---- documentation/installation.de.md | 64 +++++++++++++++++++++++++++++ documentation/installation.fr.md | 66 ++++++++++++++++++++++++++++++ documentation/installation.ja.md | 64 +++++++++++++++++++++++++++++ documentation/installation.md | 64 +++++++++++++++++++++++++++++ package-lock.json | 4 +- package.json | 2 +- prosody/appimage_aarch64.yml | 3 ++ server/lib/diagnostic/prosody.ts | 17 ++++++++ server/lib/prosody/config.ts | 28 +++++++------ server/lib/prosody/config/paths.ts | 4 +- server/lib/prosody/ctl.ts | 9 ++++ server/lib/settings.ts | 19 +++++++++ 14 files changed, 347 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e123758..66b2fc93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 6.0.0-beta.1 +## 6.0.0 ### Breaking changes @@ -31,15 +31,17 @@ you can safely uninstall Prosody. If you were using the custom Peertube docker image that is embedding Prosody, you can switch back to the official Peertube image. -### Known issues +#### Known issues -This release will probably not run on ARM CPUs. -There is a work in progress to make it work on ARM64, but there are bugs in the building tools. -Subscribe to this [issue](https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/120) to have updates. -You can also subscribe to this [issue on appimage-builder repo](https://github.com/AppImageCrafters/appimage-builder/issues/278). +The Prosody AppImage will only work on x86_64 CPU. +It is not compatible with arm64 and other CPU architectures. -If you want to try this release on such CPUs, you can manually install Prosody using your package manager -(as for older plugin versions), and check the settings «use system Prosody» in plugin settings. +For now, I did not manage to make it work for other CPU architectures. +If you want te be notified when it will be possible, you can subscribe and comment this +[issue](https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/124). + +In the meantime, you can use the plugin by [manually installing Prosody](documentation/installation.md) on your server +(as for version priori to v6.0.0). ### New Features diff --git a/build-prosody.sh b/build-prosody.sh index 359fa05c..fb7cb06b 100644 --- a/build-prosody.sh +++ b/build-prosody.sh @@ -13,7 +13,8 @@ fi cd "$prosody_build_dir" -if [ -f "$prosody_build_dir/livechat-prosody-x86_64.AppImage" ] && [ -f "$prosody_build_dir/livechat-prosody-aarch64.AppImage" ]; then +# if [ -f "$prosody_build_dir/livechat-prosody-x86_64.AppImage" ] && [ -f "$prosody_build_dir/livechat-prosody-aarch64.AppImage" ]; then +if [ -f "$prosody_build_dir/livechat-prosody-x86_64.AppImage" ]; then echo "Prosody images already built." else echo "Prosody images must be build..." @@ -32,18 +33,18 @@ else echo "Copying appimage source files..." cp "$rootdir/prosody/appimage_x86_64.yml" "$prosody_build_dir/appimage_x86_64.yml" - cp "$rootdir/prosody/appimage_aarch64.yml" "$prosody_build_dir/appimage_aarch64.yml" + # cp "$rootdir/prosody/appimage_aarch64.yml" "$prosody_build_dir/appimage_aarch64.yml" cp "$rootdir/prosody/launcher.lua" "$prosody_build_dir/launcher.lua" echo "Building Prosody x86_64..." appimage-builder --recipe "$prosody_build_dir/appimage_x86_64.yml" - echo "Cleaning build folders before building aarch64..." - rm -rf "$prosody_build_dir/AppDir" - rm -rf "$prosody_build_dir/appimage-build" + # echo "Cleaning build folders before building aarch64..." + # rm -rf "$prosody_build_dir/AppDir" + # rm -rf "$prosody_build_dir/appimage-build" - echo "Building Prosody aarch64..." - appimage-builder --recipe "$prosody_build_dir/appimage_aarch64.yml" + # echo "Building Prosody aarch64..." + # appimage-builder --recipe "$prosody_build_dir/appimage_aarch64.yml" # For some obscur reason, if we keep AppDir and appimage-build folders, # and if we try to install the plugin using the Peertube CLI, @@ -56,8 +57,8 @@ fi echo "Copying Prosody dist files..." mkdir -p "$prosody_destination_dir" && cp $prosody_build_dir/livechat-prosody-x86_64.AppImage "$prosody_destination_dir/" -mkdir -p "$prosody_destination_dir" && cp $prosody_build_dir/livechat-prosody-aarch64.AppImage "$prosody_destination_dir/" +# mkdir -p "$prosody_destination_dir" && cp $prosody_build_dir/livechat-prosody-aarch64.AppImage "$prosody_destination_dir/" -echo "Prosody AppImage OK." +echo "Prosody AppImages OK." exit 0 diff --git a/documentation/installation.de.md b/documentation/installation.de.md index affb95ef..92d89f28 100644 --- a/documentation/installation.de.md +++ b/documentation/installation.de.md @@ -15,3 +15,67 @@ Since version v6.0.0, this plugin does not need any Prosody installation. If you were using this plugin before this version, and if you had installed Prosody manually, you can safely uninstall Prosody. If you were using the custom Peertube docker image that is embedding Prosody, you can switch back to the official Peertube image. + +## Known issues: CPU compatibility + +The Prosody AppImage included in the plugin will only work on x86_64 CPU. +It is not compatible with arm64 and other CPU architectures. + +For now, I did not manage to make it work for other CPU architectures. +If you want te be notified when it will be possible, you can subscribe and comment this +[issue](https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/124). + +To use the plugin, you will have to manually install Prosody on your server +(see below). + +Once it is done, you have to check `Use system Prosody` in the plugin settings. + +### On non-docker Peertube installation + +For standard installation, you just have to install the official `prosody` package +for your linux distribution. + +For example, on Debian/Ubuntu: + +```bash +sudo apt install prosody +``` + +You can then disable the service that starts automatically when you install +Prosody (the plugin will launch a Prosody process, there is no need for the +service to run). +For example, on Debian/Ubuntu (and other Systemd based linux distributions): + +```bash +sudo systemctl disable prosody && sudo systemctl stop prosody +``` + +Warning: do not disable Prosody if it is used for another service on your server, +like for example Jitsi. + +### Docker + +You will have to generate a Peertube image that includes Prosody in the same +container that Peertube. +I know this is not the standard way to do this with Docker, but keep in mind it +is a temporary workaround. + +To generate and use such an image, please refer to the Docker documentation. +The Docker file to generate the image should be: + +```Docker +FROM chocobozzz/peertube:production-bullseye + +RUN apt -y update && apt install -y prosody && apt -y clean +``` + +### Yunohost + +You have to disable `metronome` (the XMPP server provided by Yunohost), and +install `prosody`. + +This is already done by the Yunohost Peertube application, as it was required for the +plugin before the v6.0.0. +But it may be removed in a near feature (to avoid drawbacks of this method). +I have to discuss with Yunohost team, to decide how we can do to minimize drawbacks, +and maximize compatibility. diff --git a/documentation/installation.fr.md b/documentation/installation.fr.md index 3839e2bc..7f26a99b 100644 --- a/documentation/installation.fr.md +++ b/documentation/installation.fr.md @@ -15,3 +15,69 @@ Depuis la version v6.0.0, ce plugin ne nécessite plus l'installation de Prosody Si vous utilisiez ce plugin avant, et que vous aviez installé Prosody manuellement, vous pouvez le désinstaller en tout sécurité. Si vous utilisiez l'image docker spéciale de Peertube (qui incluais Prosody), vous pouvez basculer sur l'image officielle de Peertube. + +## Problème connu: compatibilité CPU + +L'AppImage Prosody inclue dans le plugin ne fonctionne que sur des CPU x86_64. +Elle n'est pas compatible avec d'autres architectures CPU telles que arm64. + +Pour l'instant, je n'ai pas réussi à le faire fonctionner sur d'autres architectures. +Pour être notifié des évolutions sur le sujet, vous pouvez vous abonner et commenter +[ce ticket](https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/124). + +Pour utiliser le plugin, vous allez devoir installer manuellement Prosody sur +votre serveur (voir plus bas). + +Une fois cela fait, vous aurez à cocher le paramètre `Use system Prosody` du plugin. + +### Installation autres que Docker + +Pour les installations standard, vous avez juste à installer le paquet `prosody` officiellement +disponible pour votre distribution linux. + +Par exemple, sur Debian/Ubuntu: + +```bash +sudo apt install prosody +``` + +Vous pouvez alors désactiver le service qui démarre automatiquement quand vous +installé le paquet (le plugin va lancer son propre processus Prosody, et n'a pas +besoin que le service tourne sur le serveur). +Par exemple, sur Debian/Ubuntu (et les autres distributions se basant sur Systemd): + +```bash +sudo systemctl disable prosody && sudo systemctl stop prosody +``` + +Attention: ne désactivez pas Prosody s'il est utilisé par un autre service sur +votre serveur, par exemple pour Jitsi. + +### Docker + +Vous allez devoir générer une image de Peertube qui inclu Prosody dans le même +conteneur que Peertube. +Je sais que ce n'est pas la façon de faire standard avec Docker, mais gardez +en tête que ceci est une solution de contournement temporaire. + +Pour générer cette image, merci de vous référer à la documentation de Docker. +Le fichier Docker pour générer l'image devrait être: + +```Docker +FROM chocobozzz/peertube:production-bullseye + +RUN apt -y update && apt install -y prosody && apt -y clean +``` + +### Yunohost + +Vous avez à désactiver `metronome` (le serveur XMPP utilisé par Yunohost), +et installer`prosody`. + +Ceci est déjà fait par l'application Yunohost Peertube, étant donné que c'était +un pré-requis pour les version du plugin antérieures à la v6.0.0. + +Mais il se pourrait que ce soit retiré de l'application Yunohost Peertube dans un +futur proche (pour éviter les inconvénients de cette méthode). +Je dois discuter avec l'équipe Yunohost, pour décider de la bonne façon de faire +pour minimiser les inconvénients et maximiser la compatibilité. diff --git a/documentation/installation.ja.md b/documentation/installation.ja.md index 06fa117d..05509e39 100644 --- a/documentation/installation.ja.md +++ b/documentation/installation.ja.md @@ -16,3 +16,67 @@ v6.0.0から、このプラグインはProsodyのインストールが不要に このバージョンより前の環境で本プラグインを既にご使用中で、手動でProsodyをインストールした場合は、Prosodyのアンインストールが可能です。 Prosodyが内蔵されたカスタムDockerイメージをご利用の場合は、公式のPeerTube Dockerイメージに切り替えることができるようになりました。 + +## Known issues: CPU compatibility + +The Prosody AppImage included in the plugin will only work on x86_64 CPU. +It is not compatible with arm64 and other CPU architectures. + +For now, I did not manage to make it work for other CPU architectures. +If you want te be notified when it will be possible, you can subscribe and comment this +[issue](https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/124). + +To use the plugin, you will have to manually install Prosody on your server +(see below). + +Once it is done, you have to check `Use system Prosody` in the plugin settings. + +### On non-docker Peertube installation + +For standard installation, you just have to install the official `prosody` package +for your linux distribution. + +For example, on Debian/Ubuntu: + +```bash +sudo apt install prosody +``` + +You can then disable the service that starts automatically when you install +Prosody (the plugin will launch a Prosody process, there is no need for the +service to run). +For example, on Debian/Ubuntu (and other Systemd based linux distributions): + +```bash +sudo systemctl disable prosody && sudo systemctl stop prosody +``` + +Warning: do not disable Prosody if it is used for another service on your server, +like for example Jitsi. + +### Docker + +You will have to generate a Peertube image that includes Prosody in the same +container that Peertube. +I know this is not the standard way to do this with Docker, but keep in mind it +is a temporary workaround. + +To generate and use such an image, please refer to the Docker documentation. +The Docker file to generate the image should be: + +```Docker +FROM chocobozzz/peertube:production-bullseye + +RUN apt -y update && apt install -y prosody && apt -y clean +``` + +### Yunohost + +You have to disable `metronome` (the XMPP server provided by Yunohost), and +install `prosody`. + +This is already done by the Yunohost Peertube application, as it was required for the +plugin before the v6.0.0. +But it may be removed in a near feature (to avoid drawbacks of this method). +I have to discuss with Yunohost team, to decide how we can do to minimize drawbacks, +and maximize compatibility. diff --git a/documentation/installation.md b/documentation/installation.md index ef61637c..06b36b74 100644 --- a/documentation/installation.md +++ b/documentation/installation.md @@ -15,3 +15,67 @@ Since version v6.0.0, this plugin does not need any Prosody installation. If you were using this plugin before this version, and if you had installed Prosody manually, you can safely uninstall Prosody. If you were using the custom Peertube docker image that is embedding Prosody, you can switch back to the official Peertube image. + +## Known issues: CPU compatibility + +The Prosody AppImage included in the plugin will only work on x86_64 CPU. +It is not compatible with arm64 and other CPU architectures. + +For now, I did not manage to make it work for other CPU architectures. +If you want te be notified when it will be possible, you can subscribe and comment this +[issue](https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/124). + +To use the plugin, you will have to manually install Prosody on your server +(see below). + +Once it is done, you have to check `Use system Prosody` in the plugin settings. + +### On non-docker Peertube installation + +For standard installation, you just have to install the official `prosody` package +for your linux distribution. + +For example, on Debian/Ubuntu: + +```bash +sudo apt install prosody +``` + +You can then disable the service that starts automatically when you install +Prosody (the plugin will launch a Prosody process, there is no need for the +service to run). +For example, on Debian/Ubuntu (and other Systemd based linux distributions): + +```bash +sudo systemctl disable prosody && sudo systemctl stop prosody +``` + +Warning: do not disable Prosody if it is used for another service on your server, +like for example Jitsi. + +### Docker + +You will have to generate a Peertube image that includes Prosody in the same +container that Peertube. +I know this is not the standard way to do this with Docker, but keep in mind it +is a temporary workaround. + +To generate and use such an image, please refer to the Docker documentation. +The Docker file to generate the image should be: + +```Docker +FROM chocobozzz/peertube:production-bullseye + +RUN apt -y update && apt install -y prosody && apt -y clean +``` + +### Yunohost + +You have to disable `metronome` (the XMPP server provided by Yunohost), and +install `prosody`. + +This is already done by the Yunohost Peertube application, as it was required for the +plugin before the v6.0.0. +But it may be removed in a near feature (to avoid drawbacks of this method). +I have to discuss with Yunohost team, to decide how we can do to minimize drawbacks, +and maximize compatibility. diff --git a/package-lock.json b/package-lock.json index 8813b322..34a940dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "peertube-plugin-livechat", - "version": "6.0.0-beta.2", + "version": "6.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "peertube-plugin-livechat", - "version": "6.0.0-beta.2", + "version": "6.0.0", "license": "AGPL-3.0", "dependencies": { "async": "^3.2.2", diff --git a/package.json b/package.json index 3a3a02e4..4059a8c1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "peertube-plugin-livechat", "description": "PeerTube plugin livechat: offers a way to embed a chat system into Peertube.", - "version": "6.0.0-beta.2", + "version": "6.0.0", "license": "AGPL-3.0", "author": { "name": "John Livingston", diff --git a/prosody/appimage_aarch64.yml b/prosody/appimage_aarch64.yml index 81ac549d..057772c1 100644 --- a/prosody/appimage_aarch64.yml +++ b/prosody/appimage_aarch64.yml @@ -1,6 +1,9 @@ # This file is meant to be used with appimage-builder: https://appimage-builder.readthedocs.io # See it is use in the build-prosody.sh script. +# FIXME: this appimage file is not working. Not used for now. +# See https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/124 + version: 1 script: diff --git a/server/lib/diagnostic/prosody.ts b/server/lib/diagnostic/prosody.ts index cdabf418..00ad225c 100644 --- a/server/lib/diagnostic/prosody.ts +++ b/server/lib/diagnostic/prosody.ts @@ -35,6 +35,23 @@ export async function diagProsody (test: string, options: RegisterServerOptions) result.messages.push(`Prosody will use ${wantedConfig.baseApiUrl} as base uri from api calls`) + if (!wantedConfig.paths.exec) { + result.messages.push({ + level: 'error', + message: 'Error: no Prosody server.' + }) + if (process.arch !== 'x64' && process.arch !== 'x86_64') { + result.messages.push({ + level: 'error', + message: 'Error: your CPU is a ' + + process.arch + ', ' + + 'which is not compatible with the plugin. ' + + 'Please read the plugin installation documentation for a workaround.' + }) + } + return result + } + result.messages.push(`Prosody path will be '${wantedConfig.paths.exec}'`) if (wantedConfig.paths.appImageToExtract) { diff --git a/server/lib/prosody/config.ts b/server/lib/prosody/config.ts index b7c4f2cd..e25a67ff 100644 --- a/server/lib/prosody/config.ts +++ b/server/lib/prosody/config.ts @@ -29,9 +29,9 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise { + if (!filePaths.execCtl) { + reject(new Error('Missing prosodyctl command executable')) + return + } let d: string = '' let e: string = '' let m: string = '' @@ -247,6 +251,11 @@ async function ensureProsodyRunning (options: RegisterServerOptions): Promise +It seems that your are using a ${process.arch} CPU, +which is not compatible with the plugin. +Please read the + + installation documentation + for a workaround. +` + }) + } + // ********** Chat registerSetting({ type: 'html',