volumes: check provider instead of hostPath
This commit is contained in:
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user