diff --git a/lib/docker.ts b/lib/docker.ts index 76e71720..d8d3f0d3 100644 --- a/lib/docker.ts +++ b/lib/docker.ts @@ -173,14 +173,25 @@ 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, + // 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} 🌏`) @@ -217,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