diff --git a/src/apphealthmonitor.js b/src/apphealthmonitor.js index 80c5c91f3..9889c5ff6 100644 --- a/src/apphealthmonitor.js +++ b/src/apphealthmonitor.js @@ -172,10 +172,10 @@ async function processApp(options) { await Promise.allSettled(healthChecks); // wait for all promises to finish - const alive = allApps - .filter(function (a) { return a.installationState === apps.ISTATE_INSTALLED && a.runState === apps.RSTATE_RUNNING && a.health === apps.HEALTH_HEALTHY; }); + const stopped = allApps.filter(app => app.runState === apps.RSTATE_STOPPED); + const alive = allApps.filter(function (a) { return a.installationState === apps.ISTATE_INSTALLED && a.runState === apps.RSTATE_RUNNING && a.health === apps.HEALTH_HEALTHY; }); - debug(`app health: ${alive.length} alive / ${allApps.length - alive.length} dead.`); + debug(`app health: ${alive.length} alive / ${stopped.length} stopped / ${allApps.length - alive.length - stopped.length} dead.`); } async function run(intervalSecs) { diff --git a/src/domains.js b/src/domains.js index 10d044b64..eabc2f39f 100644 --- a/src/domains.js +++ b/src/domains.js @@ -19,6 +19,7 @@ const assert = require('assert'), BoxError = require('./boxerror.js'), crypto = require('crypto'), database = require('./database.js'), + debug = require('debug')('box:domains'), eventlog = require('./eventlog.js'), mail = require('./mail.js'), reverseProxy = require('./reverseproxy.js'), @@ -169,7 +170,7 @@ async function add(domain, data, auditSource) { await eventlog.add(eventlog.ACTION_DOMAIN_ADD, auditSource, { domain, zoneName, provider }); - safe(mail.onDomainAdded(domain)); // background + safe(mail.onDomainAdded(domain), { debug }); // background } async function get(domain) { diff --git a/src/mail.js b/src/mail.js index fcf21e0f4..f03d5f8b6 100644 --- a/src/mail.js +++ b/src/mail.js @@ -796,6 +796,7 @@ async function restartMail() { async function startMail(existingInfra) { assert.strictEqual(typeof existingInfra, 'object'); + debug('startMail: starting'); await restartMail(); } @@ -807,6 +808,7 @@ async function restartMailIfActivated() { return; // not provisioned yet, do not restart container after dns setup } + debug('restartMailIfActivated: restarting on activated'); await restartMail(); } @@ -1009,7 +1011,7 @@ async function onDomainAdded(domain) { if (!settings.mailFqdn()) return; // mail domain is not set yet (when provisioning) - debug('onDomainAdded: configuring mail for added domain'); + debug(`onDomainAdded: configuring mail for added domain ${domain}`); await upsertDnsRecords(domain, settings.mailFqdn()); await restartMailIfActivated(); } @@ -1017,7 +1019,7 @@ async function onDomainAdded(domain) { async function onDomainRemoved(domain) { assert.strictEqual(typeof domain, 'string'); - debug('onDomainRemoved: configuring mail for removed domain'); + debug(`onDomainRemoved: configuring mail for removed domain ${domain}`); await restartMail(); }