services: add recoveryMode

This commit is contained in:
Girish Ramakrishnan
2021-10-01 12:09:13 -07:00
parent 54731392ff
commit 6a3cec3de8
5 changed files with 71 additions and 36 deletions

View File

@@ -695,8 +695,10 @@ async function configureMail(mailFqdn, mailDomain, serviceConfig) {
const allowInbound = await createMailConfig(mailFqdn, mailDomain);
const ports = allowInbound ? '-p 587:2587 -p 993:9993 -p 4190:4190 -p 25:2587 -p 465:2465' : '';
const readOnly = !serviceConfig.recoveryMode ? '--read-only' : '';
const cmd = serviceConfig.recoveryMode ? '/bin/bash -c \'echo "Debug mode. Sleeping" && sleep infinity\'' : '';
const cmd = `docker run --restart=always -d --name="mail" \
const runCmd = `docker run --restart=always -d --name="mail" \
--net cloudron \
--net-alias mail \
--log-driver syslog \
@@ -713,9 +715,9 @@ async function configureMail(mailFqdn, mailDomain, serviceConfig) {
-v "${paths.PLATFORM_DATA_DIR}/addons/mail:/etc/mail" \
${ports} \
--label isCloudronManaged=true \
--read-only -v /run -v /tmp ${tag}`;
${readOnly} -v /run -v /tmp ${tag} ${cmd}`;
await shell.promises.exec('startMail', cmd);
await shell.promises.exec('startMail', runCmd);
}
async function getMailAuth() {