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.
This commit is contained in:
John Livingston 2022-12-12 19:17:43 +01:00
parent 52753627d3
commit ed3f236120
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
14 changed files with 347 additions and 34 deletions

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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é.

View File

@ -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.

View File

@ -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.

4
package-lock.json generated
View File

@ -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",

View File

@ -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",

View File

@ -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:

View File

@ -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) {

View File

@ -29,9 +29,9 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise<Pro
const dir = await getWorkingDir(options)
const settings = await options.settingsManager.getSettings(['use-system-prosody'])
let exec
let execArgs: string[]
let execArgs: string[] = []
let execCtl
let execCtlArgs: string[]
let execCtlArgs: string[] = []
let appImageToExtract
// this one is always needed (must create the directory on startup)
@ -39,22 +39,26 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise<Pro
if (settings['use-system-prosody']) {
exec = 'prosody'
execArgs = []
execCtl = 'prosodyctl'
execCtlArgs = []
} else {
const arch = process.arch
if (arch === 'arm' || arch === 'arm64') {
logger.info('Node process.arch is ' + arch + ', we will be using the aarch64 Prosody AppImage')
appImageToExtract = path.resolve(__dirname, '../../prosody/livechat-prosody-aarch64.AppImage')
// const arch = process.arch
// if (arch === 'arm' || arch === 'arm64') {
// logger.info('Node process.arch is ' + arch + ', we will be using the aarch64 Prosody AppImage')
// appImageToExtract = path.resolve(__dirname, '../../prosody/livechat-prosody-aarch64.AppImage')
// } else {
// appImageToExtract = path.resolve(__dirname, '../../prosody/livechat-prosody-x86_64.AppImage')
// }
if (process.arch !== 'x64' && process.arch !== 'x86_64') {
logger.info('Node process.arch is ' + process.arch + ', cant use the Prosody AppImage')
} else {
logger.debug('Node process.arch is ' + process.arch + ', we will be using the x86_64 Prosody AppImage')
appImageToExtract = path.resolve(__dirname, '../../prosody/livechat-prosody-x86_64.AppImage')
}
exec = path.resolve(appImageExtractPath, 'squashfs-root/AppRun')
execArgs = ['prosody']
execCtl = exec
execCtlArgs = ['prosodyctl']
}
}
return {
dir: dir,

View File

@ -8,9 +8,9 @@ interface ProsodyFilePaths {
certs: string
modules: string
avatars: string
exec: string
exec?: string
execArgs: string[]
execCtl: string
execCtl?: string
execCtlArgs: string[]
appImageToExtract?: string
appImageExtractPath: string

View File

@ -100,6 +100,10 @@ async function prosodyCtl (options: RegisterServerOptions, command: string): Pro
throw new Error(`Invalid prosodyctl command '${command}'`)
}
return new Promise((resolve, reject) => {
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<vo
const filePaths = config.paths
if (!filePaths.exec) {
logger.info('No Prosody executable, cant run.')
return
}
// launch prosody
const execCmd = filePaths.exec + (filePaths.execArgs.length ? ' ' + filePaths.execArgs.join(' ') : '')
logger.info('Going to launch prosody (' + execCmd + ')')

View File

@ -27,6 +27,25 @@ function initSettings (options: RegisterServerOptions): void {
(if this button is not opening a new window, please try to refresh the page).`
})
if (process.arch !== 'x64' && process.arch !== 'x86_64') {
registerSetting({
name: 'prosody-arch-warning',
type: 'html',
private: true,
descriptionHTML: `<span class="peertube-plugin-livechat-warning">
It seems that your are using a ${process.arch} CPU,
which is not compatible with the plugin.
Please read the
<a
href="https://github.com/JohnXLivingston/peertube-plugin-livechat/blob/main/documentation/installation.md"
target="_blank"
>
installation documentation
</a> for a workaround.
</span>`
})
}
// ********** Chat
registerSetting({
type: 'html',