split mail and mailserver

mail = all the per-domain code
mailserver = all the mail server level code
This commit is contained in:
Girish Ramakrishnan
2023-08-04 20:54:16 +05:30
parent fb9d8c23e1
commit 946e5caacb
8 changed files with 349 additions and 327 deletions
+6 -5
View File
@@ -49,6 +49,7 @@ const addonConfigs = require('./addonconfigs.js'),
infra = require('./infra_version.js'),
logs = require('./logs.js'),
mail = require('./mail.js'),
mailServer = require('./mailserver.js'),
oidc = require('./oidc.js'),
os = require('os'),
path = require('path'),
@@ -211,8 +212,8 @@ const SERVICES = {
},
mail: {
status: containerStatus.bind(null, 'mail', 'CLOUDRON_MAIL_TOKEN'),
restart: mail.restartMail,
defaultMemoryLimit: mail.DEFAULT_MEMORY_LIMIT
restart: mailServer.restart,
defaultMemoryLimit: mailServer.DEFAULT_MEMORY_LIMIT
},
mongodb: {
status: containerStatus.bind(null, 'mongodb', 'CLOUDRON_MONGODB_TOKEN'),
@@ -511,7 +512,7 @@ async function rebuildService(id, auditSource) {
await startGraphite({ version: 'none' });
break;
case 'mail':
await mail.startMail({ version: 'none' });
await mailServer.start({ version: 'none' });
break;
case 'redis': {
await shell.promises.exec('removeRedis', `docker rm -f redis-${instance} || true`);
@@ -781,7 +782,7 @@ async function startServices(existingInfra) {
if (existingInfra.version !== infra.version) {
debug(`startServices: ${existingInfra.version} -> ${infra.version}. starting all services`);
startFuncs.push(
mail.startMail, // start this first to reduce email downtime
mailServer.start, // start this first to reduce email downtime
startTurn,
startMysql,
startPostgresql,
@@ -793,7 +794,7 @@ async function startServices(existingInfra) {
} else {
assert.strictEqual(typeof existingInfra.images, 'object');
if (infra.images.mail.tag !== existingInfra.images.mail.tag) startFuncs.push(mail.startMail); // start this first to reduce email downtime
if (infra.images.mail.tag !== existingInfra.images.mail.tag) startFuncs.push(mailServer.start); // start this first to reduce email downtime
if (infra.images.turn.tag !== existingInfra.images.turn.tag) startFuncs.push(startTurn);
if (infra.images.mysql.tag !== existingInfra.images.mysql.tag) startFuncs.push(startMysql);
if (infra.images.postgresql.tag !== existingInfra.images.postgresql.tag) startFuncs.push(startPostgresql);