From f4d8adea75c751ed6f95d9d68cae1f687d593503 Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Thu, 22 Aug 2024 14:24:07 +0200 Subject: [PATCH 1/2] perf(docker): put data into RAM Signed-off-by: skjnldsv --- lib/docker.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/docker.ts b/lib/docker.ts index 76e71720..a50c6863 100644 --- a/lib/docker.ts +++ b/lib/docker.ts @@ -177,10 +177,21 @@ export async function startNextcloud(branch = 'master', mountApp: boolean|string HostConfig: { Binds: mounts.length > 0 ? mounts : undefined, PortBindings, + // Mount data directory in RAM for faster IO + Mounts: [{ + Target: '/var/www/html/data', + Source: '', + Type: 'tmpfs', + ReadOnly: false, + }], }, }) await container.start() + // Set proper permissions for the data folder + await runExec(container, ['chown', '-R', 'www-data:www-data', '/var/www/html/data'], false, 'root') + await runExec(container, ['chmod', '0770', '/var/www/html/data'], false, 'root') + // Get container's IP const ip = await getContainerIP(container) console.log(`├─ Nextcloud container's IP is ${ip} 🌏`) From 8bbfe6ca615fcb1ed934682bde4e2cf16c5599ab Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Thu, 22 Aug 2024 14:25:16 +0200 Subject: [PATCH 2/2] perf(docker): add apcu Signed-off-by: skjnldsv --- lib/docker.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/docker.ts b/lib/docker.ts index a50c6863..d8d3f0d3 100644 --- a/lib/docker.ts +++ b/lib/docker.ts @@ -173,7 +173,7 @@ export async function startNextcloud(branch = 'master', mountApp: boolean|string const container = await docker.createContainer({ Image: SERVER_IMAGE, name: getContainerName(), - Env: [`BRANCH=${branch}`], + Env: [`BRANCH=${branch}`, 'APCU=1'], HostConfig: { Binds: mounts.length > 0 ? mounts : undefined, PortBindings, @@ -228,6 +228,19 @@ export const configureNextcloud = async function(apps = ['viewer'], vendoredBran await runExec(container, ['php', 'occ', 'config:system:set', 'force_locale', '--value', 'en_US'], true) await runExec(container, ['php', 'occ', 'config:system:set', 'enforce_theme', '--value', 'light'], true) + // Checking apcu + console.log('├─ Checking APCu configuration... 👀') + const distributed = await runExec(container, ['php', 'occ', 'config:system:get', 'memcache.distributed']) + const local = await runExec(container, ['php', 'occ', 'config:system:get', 'memcache.local']) + const hashing = await runExec(container, ['php', 'occ', 'config:system:get', 'hashing_default_password']) + if (!distributed.includes('Memcache\\APCu') + || !local.includes('Memcache\\APCu') + || !hashing.includes('true')) { + console.log('└─ APCu is not properly configured 🛑') + throw new Error('APCu is not properly configured') + } + console.log('│ └─ OK !') + // Build app list const json = await runExec(container, ['php', 'occ', 'app:list', '--output', 'json'], false) // fix dockerode bug returning invalid leading characters