From f644ad0d882accab9d10b7f9e77ab6b153edb2b6 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Wed, 31 May 2023 18:13:35 +0200 Subject: [PATCH] Fix #124 (dirty hack): This commit is a dirty hack to fix issue with ARM64 Prosody AppImage. The fixed appimagebuild tool is not released by the dev team. So i patch it in my build script. This is not a good solution, but it works, and let me go forward. --- CHANGELOG.md | 6 ++++- build-prosody.sh | 26 ++++++++++++------- prosody/appimage_aarch64.yml | 17 +++++------- server/lib/diagnostic/prosody.ts | 2 +- server/lib/federation/types.ts | 2 +- server/lib/prosody/config.ts | 13 +++++++--- server/lib/settings.ts | 2 +- .../documentation/installation/_index.ja.md | 9 +++---- .../installation/cpu_compatibility.de.md | 8 +++--- .../installation/cpu_compatibility.en.md | 13 +++++----- .../installation/cpu_compatibility.fr.md | 14 +++++----- 11 files changed, 63 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f89a33b8..5a0860df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 6.4.0 (Not Released Yet) +## 7.0.0 (Not Released Yet) ### Importante Notes @@ -8,6 +8,9 @@ If you enabled external XMPP connection with plugin v6.3.0, and are not using the standard 5269 port, you must add and additional DNS SRV record. Check the [documentation](https://johnxlivingston.github.io/peertube-plugin-livechat/documentation/admin/advanced/xmpp_clients/). +If you are using ARM 64 CPU, you no longer need to manually install Prosody on your server. +You can now uncheck the "use system prosody" option, and uninstall Prosody if you don't use it for anything else. + If you are using ["system Prosody"](https://johnxlivingston.github.io/peertube-plugin-livechat/documentation/admin/settings/#use-system-prosody), please not that this version will only properly work with Prosody >= 0.12.0. If you are using an older version, Chat Federation could be broken, and it could have some unexpected behaviour. @@ -18,6 +21,7 @@ If you are using an older version, Chat Federation could be broken, and it could * You can now connect to a remote chat with your local account. * This remote connection is done using a custom implementation of [XEP-0468: WebSocket S2S](https://xmpp.org/extensions/xep-0468.html), using some specific discovering method (so that it will work without any DNS configuration). * If the remote instance has configured external XMPP connections, it will use legacy S2S connection instead of Websocket S2S. +* ARM64 CPU support! The Prosody builtin AppImage is now compatible with ARM64 CPU. TODO: documentation, and settings names/descriptions changes related to direct XMPP S2S connections. TODO: only compatible with Prosody 0.12.x. So it should be documented for people using «system Prosody». And i should fix the ARM AppImage. diff --git a/build-prosody.sh b/build-prosody.sh index fb7cb06b..d96685b1 100644 --- a/build-prosody.sh +++ b/build-prosody.sh @@ -13,8 +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" ]; 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..." @@ -29,22 +29,28 @@ else source venv/bin/activate echo "Installing appimage-builder..." - pip3 install appimage-builder + pip3 install appimage-builder==1.1.0 + + echo "Unpatching appimage-builder for ARM..." + sed -i -E 's/^\s*"\*\*\/ld-linux-aarch64.so\*",\s*$//' venv/lib/*/site-packages/appimagebuilder/modules/setup/apprun_2/apprun2.py 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 "Patching appimage-builder for ARM..." + sed -i -E 's/^\s*"\*\*\/ld-linux-x86-64.so.2",\s*$/"**\/ld-linux-x86-64.so.2", "**\/ld-linux-aarch64.so*",/' venv/lib/*/site-packages/appimagebuilder/modules/setup/apprun_2/apprun2.py + + 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, @@ -57,7 +63,7 @@ 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 AppImages OK." diff --git a/prosody/appimage_aarch64.yml b/prosody/appimage_aarch64.yml index 68a31117..77211388 100644 --- a/prosody/appimage_aarch64.yml +++ b/prosody/appimage_aarch64.yml @@ -30,24 +30,21 @@ AppDir: apt: arch: arm64 sources: - # Note: for an unknown reason, building from debian packages produce invalid AppFiles. - # See: https://github.com/AppImageCrafters/appimage-builder/issues/278 - # So we are using ubuntu repository. - - sourceline: 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports bionic main restricted universe multiverse' - key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3b4fe6acc0b21f32' + - sourceline: 'deb [arch=arm64] https://deb.debian.org/debian/ bullseye main contrib' + key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x648ACFD622F3D138' + - sourceline: 'deb [arch=arm64] https://deb.debian.org/debian/ bullseye-backports main contrib' include: - lua5.2 - # For an unknown reason, lua-unbound is not found in these repository. - # - lua-unbound + # lua-unbound is needed + - lua-unbound # lua-readline and lua-event are recommanded dependencies - # For an unknown reason, lua-readline is not found in these repository. - # - lua-readline + - lua-readline - lua-event # lua-zlib is suggested. Not sure it is used, by make sense to add. - lua-zlib - lua-sec - - prosody + - prosody/bullseye-backports files: exclude: diff --git a/server/lib/diagnostic/prosody.ts b/server/lib/diagnostic/prosody.ts index dec90d76..50d93be5 100644 --- a/server/lib/diagnostic/prosody.ts +++ b/server/lib/diagnostic/prosody.ts @@ -40,7 +40,7 @@ export async function diagProsody (test: string, options: RegisterServerOptions) level: 'error', message: 'Error: no Prosody server.' }) - if (process.arch !== 'x64' && process.arch !== 'x86_64') { + if (process.arch !== 'x64' && process.arch !== 'x86_64' && process.arch !== 'arm64') { result.messages.push({ level: 'error', message: 'Error: your CPU is a ' + diff --git a/server/lib/federation/types.ts b/server/lib/federation/types.ts index f9d122f1..73f1d545 100644 --- a/server/lib/federation/types.ts +++ b/server/lib/federation/types.ts @@ -45,7 +45,7 @@ interface LiveChatJSONLDInfosV0 { links: LiveChatJSONLDLink[] } -// LiveChatJSONLDInfosV1 is the data format that comes with plugin v6.4.0. +// LiveChatJSONLDInfosV1 is the data format that comes with plugin v7.0.0. interface LiveChatJSONLDInfosV1 { type: 'xmpp' jid: string // room JID diff --git a/server/lib/prosody/config.ts b/server/lib/prosody/config.ts index 46111f25..0363e636 100644 --- a/server/lib/prosody/config.ts +++ b/server/lib/prosody/config.ts @@ -51,15 +51,22 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise { descriptionHTML: loc('diagnostic') }) - if (process.arch !== 'x64' && process.arch !== 'x86_64') { + if (process.arch !== 'x64' && process.arch !== 'x86_64' && process.arch !== 'arm64') { registerSetting({ name: 'prosody-arch-warning', type: 'html', diff --git a/support/documentation/content/documentation/installation/_index.ja.md b/support/documentation/content/documentation/installation/_index.ja.md index 89151d88..10e53e81 100644 --- a/support/documentation/content/documentation/installation/_index.ja.md +++ b/support/documentation/content/documentation/installation/_index.ja.md @@ -21,16 +21,15 @@ Prosodyが内蔵されたカスタムDockerイメージをご利用の場合は ## Known issues: CPU compatibility -The Prosody AppImage included in the plugin will only work on x86_64 CPU. +The Prosody AppImage included in the plugin will only work on x86_64 and arm64 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). +Note: the plugin requires Prosody >= 0.12.0. +If you are using an older version, Chat Federation could be broken, and it could have some unexpected behaviour. + Once it is done, you have to check `Use system Prosody` in the plugin settings. ### On non-docker Peertube installation diff --git a/support/documentation/content/documentation/installation/cpu_compatibility.de.md b/support/documentation/content/documentation/installation/cpu_compatibility.de.md index 47c31be8..ddff053b 100644 --- a/support/documentation/content/documentation/installation/cpu_compatibility.de.md +++ b/support/documentation/content/documentation/installation/cpu_compatibility.de.md @@ -5,13 +5,15 @@ weight=10 chapter=false +++ -Das im Plugin enthaltene Prosody AppImage funktioniert nur mit x86_64 CPU Architekturen. -Es ist nicht kompatibel mit arm64 und anderen CPU-Architekturen. -Im Moment ist es mir noch nicht gelungen, es für andere CPU-Architekturen zum Laufen zu bringen. Wenn Sie benachrichtigt werden wollen, sobald es möglich ist, können Sie [dieses Problem](https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/124) abonnieren und kommentieren. +Das im Plugin enthaltene Prosody AppImage funktioniert nur mit x86_64 und arm64 CPU Architekturen. +Es ist nicht kompatibel mit anderen CPU-Architekturen. Um das Plugin zu verwenden, müssen Sie Prosody manuell auf Ihrem Server installieren (siehe unten). +Note: the plugin requires Prosody >= 0.12.0. +If you are using an older version, Chat Federation could be broken, and it could have some unexpected behaviour. + Sobald dies geschehen ist, müssen Sie in den Plugin-Einstellungen das Häkchen bei `Use system Prosody` setzen. ## Nicht-Docker Peertube installation diff --git a/support/documentation/content/documentation/installation/cpu_compatibility.en.md b/support/documentation/content/documentation/installation/cpu_compatibility.en.md index 365e63d7..2586035c 100644 --- a/support/documentation/content/documentation/installation/cpu_compatibility.en.md +++ b/support/documentation/content/documentation/installation/cpu_compatibility.en.md @@ -1,20 +1,19 @@ +++ title="Known issues: CPU Compatibility" -description="For now, the plugin only works out of the box for x86_64 CPU architecture. Here are some instructions for other CPU architectures." +description="For now, the plugin only works out of the box for x86_64 and arm64 CPU architecture. Here are some instructions for other CPU architectures." weight=10 chapter=false +++ -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). +The Prosody AppImage included in the plugin will only work on x86_64 and arm64 CPU. +It is not compatible with other CPU architectures. To use the plugin, you will have to manually install Prosody on your server (see below). +Note: the plugin requires Prosody >= 0.12.0. +If you are using an older version, Chat Federation could be broken, and it could have some unexpected behaviour. + Once it is done, you have to check `Use system Prosody` in the plugin settings. ## On non-docker Peertube installation diff --git a/support/documentation/content/documentation/installation/cpu_compatibility.fr.md b/support/documentation/content/documentation/installation/cpu_compatibility.fr.md index 03c40267..96d609bc 100644 --- a/support/documentation/content/documentation/installation/cpu_compatibility.fr.md +++ b/support/documentation/content/documentation/installation/cpu_compatibility.fr.md @@ -1,20 +1,20 @@ +++ title="Problème connu: compatibilité CPU" -description="Pour l'instant le plugin ne supporte de base que les architectures CPU x86_64. Veuillez trouver ici des instructions pour le faire fonctionner sur d'autres architectures CPU." +description="Pour l'instant le plugin ne supporte de base que les architectures CPU x86_64 et arm64. Veuillez trouver ici des instructions pour le faire fonctionner sur d'autres architectures CPU." weight=10 chapter=false +++ -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). +L'AppImage Prosody inclue dans le plugin ne fonctionne que sur des CPU x86_64 et arm64. +Elle n'est pas compatible avec d'autres architectures CPU. Pour utiliser le plugin, vous allez devoir installer manuellement Prosody sur votre serveur (voir plus bas). +Note: la version de Prosody devrait être supérieure ou égale à 0.12.0. +Si vous utilisez une version plus ancienne, il pourrait y avoir des bugs sur la fédération du tchat, +et d'autres comportements inattendus. + Une fois cela fait, vous aurez à cocher le paramètre `Use system Prosody` du plugin. ## Installation autres que Docker