#120: adding a certs directory to avoid Prosody error logs.

This commit is contained in:
John Livingston 2022-12-06 17:19:53 +01:00
parent 34ebfb4c67
commit 24696acdbe
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
5 changed files with 18 additions and 1 deletions

View File

@ -10,6 +10,8 @@ script:
- mkdir -p AppDir/usr/bin - mkdir -p AppDir/usr/bin
# Copy the launcher code into the AppDir # Copy the launcher code into the AppDir
- cp ./launcher.lua AppDir/usr/bin/ - cp ./launcher.lua AppDir/usr/bin/
# Creating the /etc/prosody/certs folder to avoid unecessary errors
- mkdir -p AppDir/etc/prosody/certs
AppDir: AppDir:
path: ./AppDir path: ./AppDir

View File

@ -10,6 +10,8 @@ script:
- mkdir -p AppDir/usr/bin - mkdir -p AppDir/usr/bin
# Copy the launcher code into the AppDir # Copy the launcher code into the AppDir
- cp ./launcher.lua AppDir/usr/bin/ - cp ./launcher.lua AppDir/usr/bin/
# Creating the /etc/prosody/certs folder to avoid unecessary errors
- mkdir -p AppDir/etc/prosody/certs
AppDir: AppDir:
path: ./AppDir path: ./AppDir

View File

@ -63,6 +63,9 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise<Pro
log: path.resolve(dir, 'prosody.log'), log: path.resolve(dir, 'prosody.log'),
config: path.resolve(dir, 'prosody.cfg.lua'), config: path.resolve(dir, 'prosody.cfg.lua'),
data: path.resolve(dir, 'data'), data: path.resolve(dir, 'data'),
// Certificates dir for Prosody.
// Note: not used yet, but we create the directory to avoid errors in prosody logs.
certs: path.resolve(dir, 'certs'),
modules: path.resolve(__dirname, '../../prosody-modules'), modules: path.resolve(__dirname, '../../prosody-modules'),
avatars: path.resolve(__dirname, '../../avatars'), avatars: path.resolve(__dirname, '../../avatars'),
exec, exec,

View File

@ -5,6 +5,7 @@ interface ProsodyFilePaths {
log: string log: string
config: string config: string
data: string data: string
certs: string
modules: string modules: string
avatars: string avatars: string
exec: string exec: string

View File

@ -9,6 +9,7 @@ async function _ensureWorkingDir (
options: RegisterServerOptions, options: RegisterServerOptions,
workingDir: string, workingDir: string,
dataDir: string, dataDir: string,
certsDir: string,
appImageExtractPath: string appImageExtractPath: string
): Promise<string> { ): Promise<string> {
const logger = options.peertubeHelpers.logger const logger = options.peertubeHelpers.logger
@ -29,6 +30,14 @@ async function _ensureWorkingDir (
logger.debug(`data dir ${dataDir} was created`) 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)) { if (!fs.existsSync(appImageExtractPath)) {
logger.info(`The appImageExtractPath dir ${appImageExtractPath} does not exists, trying to create it`) logger.info(`The appImageExtractPath dir ${appImageExtractPath} does not exists, trying to create it`)
await fs.promises.mkdir(appImageExtractPath) await fs.promises.mkdir(appImageExtractPath)
@ -49,7 +58,7 @@ async function prepareProsody (options: RegisterServerOptions): Promise<void> {
const filePaths = await getProsodyFilePaths(options) const filePaths = await getProsodyFilePaths(options)
logger.debug('Ensuring that the working dir exists') 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 const appImageToExtract = filePaths.appImageToExtract
if (!appImageToExtract) { if (!appImageToExtract) {