mail: mount mail data directory into sftp container

fixes #794
This commit is contained in:
Girish Ramakrishnan
2021-09-25 17:19:58 -07:00
parent d4edd771b5
commit 8255623874
4 changed files with 38 additions and 30 deletions

View File

@@ -13,6 +13,7 @@ const apps = require('./apps.js'),
debug = require('debug')('box:sftp'),
hat = require('./hat.js'),
infra = require('./infra_version.js'),
path = require('path'),
paths = require('./paths.js'),
safe = require('safetydance'),
shell = require('./shell.js'),
@@ -66,6 +67,12 @@ async function rebuild(serviceConfig, options) {
dataDirs.push({ hostDir: volume.hostPath, mountDir: `/mnt/${volume.id}` });
}
// mail data dir
const stat2 = safe.fs.lstatSync(paths.BOX_DATA_DIR);
if (!stat2) throw new BoxError(BoxError.FS_ERROR, `Could not stat mail data dir: ${safe.error.message}`);
const resolvedBoxDataDir = stat2.isSymbolicLink() ? safe.fs.readlinkSync(paths.BOX_DATA_DIR) : paths.BOX_DATA_DIR;
dataDirs.push({ hostDir: path.join(resolvedBoxDataDir, 'mail'), mountDir: '/mnt/maildata' });
const mounts = dataDirs.map(v => `-v "${v.hostDir}:${v.mountDir}"`).join(' ');
const cmd = `docker run --restart=always -d --name="sftp" \
--hostname sftp \