Embedding Prosody using AppImage:

Thanks to this commit, there is no more need to manually install Prosody
on the server.
The plugin now build and embed an AppImage of Prosody.

In this commit:
* building and using a Prosody AppImage.
* Adding a launcher in the AppImage: the first command argument tells if
  we want to run prosody or prosodyctl
* prosodyCtl functions now uses the AppImage.
* Prosody AppImage: extract once at the startup, then run the squashfs
This commit is contained in:
John Livingston
2022-11-14 16:54:08 +01:00
parent 91ea442ce6
commit 459d92cef9
11 changed files with 231 additions and 15 deletions

View File

@ -54,6 +54,24 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise<Pro
logger.debug('Calling getProsodyFilePaths')
const dir = await getWorkingDir(options)
const settings = await options.settingsManager.getSettings(['use-system-prosody'])
let exec
let execArgs: string[]
let execCtl
let execCtlArgs: string[]
let appImageToExtract
if (settings['use-system-prosody']) {
exec = 'prosody'
execArgs = []
execCtl = 'prosodyctl'
execCtlArgs = []
} else {
appImageToExtract = path.resolve(__dirname, '../../prosody/livechat-prosody-x86_64.AppImage')
exec = path.resolve(dir, 'squashfs-root/AppRun') // the AppImage will be extracted in the working dir
execArgs = ['prosody']
execCtl = exec
execCtlArgs = ['prosodyctl']
}
return {
dir: dir,
pid: path.resolve(dir, 'prosody.pid'),
@ -62,7 +80,12 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise<Pro
config: path.resolve(dir, 'prosody.cfg.lua'),
data: path.resolve(dir, 'data'),
modules: path.resolve(__dirname, '../../prosody-modules'),
avatars: path.resolve(__dirname, '../../avatars')
avatars: path.resolve(__dirname, '../../avatars'),
exec,
execArgs,
execCtl,
execCtlArgs,
appImageToExtract
}
}