diff --git a/src/mounts.js b/src/mounts.js index d2a453ab6..8d9e623f1 100644 --- a/src/mounts.js +++ b/src/mounts.js @@ -63,7 +63,7 @@ function validateMountOptions(type, options) { } } -// managed providers are those for which we setup systemd mount file +// managed providers are those for which we setup systemd mount file under /mnt/volumes function isManagedProvider(provider) { return provider === 'sshfs' || provider === 'cifs' || provider === 'nfs' || provider === 'ext4' || provider === 'xfs' || provider === 'disk'; } diff --git a/src/sftp.js b/src/sftp.js index 9ef8763af..65f699f06 100644 --- a/src/sftp.js +++ b/src/sftp.js @@ -15,6 +15,7 @@ const apps = require('./apps.js'), docker = require('./docker.js'), hat = require('./hat.js'), infra = require('./infra_version.js'), + mounts = require('./mounts.js'), path = require('path'), paths = require('./paths.js'), safe = require('safetydance'), @@ -82,7 +83,7 @@ async function start(existingInfra) { dataDirs.push({ hostDir: '/mnt/volumes', mountDir: '/mnt/volumes' }); // managed volumes const allVolumes = await volumes.list(); for (const volume of allVolumes) { - if (volume.hostPath.startsWith('/mnt/volumes/')) continue; // skip managed volume + if (mounts.isManagedProvider(volume.mountType)) continue; // skip managed volume. these are acessed via /mnt/volumes mount above if (!safe.fs.existsSync(volume.hostPath)) { debug(`Ignoring volume host path ${volume.hostPath} since it does not exist`); @@ -100,7 +101,7 @@ async function start(existingInfra) { const readOnly = !serviceConfig.recoveryMode ? '--read-only' : ''; const cmd = serviceConfig.recoveryMode ? '/bin/bash -c \'echo "Debug mode. Sleeping" && sleep infinity\'' : ''; - const mounts = dataDirs.map(v => `-v "${v.hostDir}:${v.mountDir}"`).join(' '); + const volumeMounts = dataDirs.map(v => `-v "${v.hostDir}:${v.mountDir}"`).join(' '); const runCmd = `docker run --restart=always -d --name=sftp \ --hostname sftp \ --net cloudron \ @@ -112,7 +113,7 @@ async function start(existingInfra) { -m ${memoryLimit} \ --memory-swap -1 \ -p 222:22 \ - ${mounts} \ + ${volumeMounts} \ -e CLOUDRON_SFTP_TOKEN=${cloudronToken} \ -v ${paths.SFTP_KEYS_DIR}:/etc/ssh:ro \ --label isCloudronManaged=true \