From 24696acdbef885b87218a8762eb51dae1c5ae169 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Tue, 6 Dec 2022 17:19:53 +0100 Subject: [PATCH] #120: adding a certs directory to avoid Prosody error logs. --- prosody/appimage_aarch64.yml | 2 ++ prosody/appimage_x86_64.yml | 2 ++ server/lib/prosody/config.ts | 3 +++ server/lib/prosody/config/paths.ts | 1 + server/lib/prosody/ctl.ts | 11 ++++++++++- 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/prosody/appimage_aarch64.yml b/prosody/appimage_aarch64.yml index e7f9979f..11d9a2a7 100644 --- a/prosody/appimage_aarch64.yml +++ b/prosody/appimage_aarch64.yml @@ -10,6 +10,8 @@ script: - mkdir -p AppDir/usr/bin # Copy the launcher code into the AppDir - cp ./launcher.lua AppDir/usr/bin/ + # Creating the /etc/prosody/certs folder to avoid unecessary errors + - mkdir -p AppDir/etc/prosody/certs AppDir: path: ./AppDir diff --git a/prosody/appimage_x86_64.yml b/prosody/appimage_x86_64.yml index 4ae0c012..53b7bf6e 100644 --- a/prosody/appimage_x86_64.yml +++ b/prosody/appimage_x86_64.yml @@ -10,6 +10,8 @@ script: - mkdir -p AppDir/usr/bin # Copy the launcher code into the AppDir - cp ./launcher.lua AppDir/usr/bin/ + # Creating the /etc/prosody/certs folder to avoid unecessary errors + - mkdir -p AppDir/etc/prosody/certs AppDir: path: ./AppDir diff --git a/server/lib/prosody/config.ts b/server/lib/prosody/config.ts index c365cf30..b7c4f2cd 100644 --- a/server/lib/prosody/config.ts +++ b/server/lib/prosody/config.ts @@ -63,6 +63,9 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise { const logger = options.peertubeHelpers.logger @@ -29,6 +30,14 @@ async function _ensureWorkingDir ( logger.debug(`data dir ${dataDir} was created`) } + if (!fs.existsSync(certsDir)) { + // Certificates dir for Prosody. + // Note: not used yet, but we create the directory to avoid errors in prosody logs. + logger.info(`The certs dir ${certsDir} does not exists, trying to create it`) + await fs.promises.mkdir(certsDir) + logger.debug(`certs dir ${certsDir} was created`) + } + if (!fs.existsSync(appImageExtractPath)) { logger.info(`The appImageExtractPath dir ${appImageExtractPath} does not exists, trying to create it`) await fs.promises.mkdir(appImageExtractPath) @@ -49,7 +58,7 @@ async function prepareProsody (options: RegisterServerOptions): Promise { const filePaths = await getProsodyFilePaths(options) logger.debug('Ensuring that the working dir exists') - await _ensureWorkingDir(options, filePaths.dir, filePaths.data, filePaths.appImageExtractPath) + await _ensureWorkingDir(options, filePaths.dir, filePaths.data, filePaths.certs, filePaths.appImageExtractPath) const appImageToExtract = filePaths.appImageToExtract if (!appImageToExtract) {