notifications: no email for app up/down/oom events
emails will not be used for self monitoring events. these are best done from the outside. we just log everything in eventlog and raise notifications as well.
This commit is contained in:
@@ -7,10 +7,7 @@ exports = module.exports = {
|
||||
|
||||
sendInvite,
|
||||
|
||||
appUp,
|
||||
appDied,
|
||||
appUpdated,
|
||||
oomEvent,
|
||||
|
||||
backupFailed,
|
||||
|
||||
@@ -177,46 +174,6 @@ function passwordReset(user) {
|
||||
});
|
||||
}
|
||||
|
||||
function appUp(mailTo, app) {
|
||||
assert.strictEqual(typeof mailTo, 'string');
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
|
||||
debug('Sending mail for app %s @ %s up', app.id, app.fqdn);
|
||||
|
||||
getMailConfig(function (error, mailConfig) {
|
||||
if (error) return debug('Error getting mail details:', error);
|
||||
|
||||
var mailOptions = {
|
||||
from: mailConfig.notificationFrom,
|
||||
to: mailTo,
|
||||
subject: `[${mailConfig.cloudronName}] App ${app.fqdn} is back online`,
|
||||
text: render('app_up.ejs', { title: app.manifest.title, appFqdn: app.fqdn, format: 'text' })
|
||||
};
|
||||
|
||||
sendMail(mailOptions);
|
||||
});
|
||||
}
|
||||
|
||||
function appDied(mailTo, app) {
|
||||
assert.strictEqual(typeof mailTo, 'string');
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
|
||||
debug('Sending mail for app %s @ %s died', app.id, app.fqdn);
|
||||
|
||||
getMailConfig(function (error, mailConfig) {
|
||||
if (error) return debug('Error getting mail details:', error);
|
||||
|
||||
var mailOptions = {
|
||||
from: mailConfig.notificationFrom,
|
||||
to: mailTo,
|
||||
subject: `[${mailConfig.cloudronName}] App ${app.fqdn} is down`,
|
||||
text: render('app_down.ejs', { title: app.manifest.title, appFqdn: app.fqdn, supportEmail: mailConfig.supportEmail, format: 'text' })
|
||||
};
|
||||
|
||||
sendMail(mailOptions);
|
||||
});
|
||||
}
|
||||
|
||||
function appUpdated(mailTo, app, callback) {
|
||||
assert.strictEqual(typeof mailTo, 'string');
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
@@ -385,36 +342,6 @@ function boxUpdateError(mailTo, message) {
|
||||
});
|
||||
}
|
||||
|
||||
function oomEvent(mailTo, app, addon, containerId, event) {
|
||||
assert.strictEqual(typeof mailTo, 'string');
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
assert.strictEqual(typeof addon, 'object');
|
||||
assert.strictEqual(typeof containerId, 'string');
|
||||
assert.strictEqual(typeof event, 'object');
|
||||
|
||||
getMailConfig(function (error, mailConfig) {
|
||||
if (error) return debug('Error getting mail details:', error);
|
||||
|
||||
const templateData = {
|
||||
webadminUrl: settings.adminOrigin(),
|
||||
cloudronName: mailConfig.cloudronName,
|
||||
app,
|
||||
addon,
|
||||
event: JSON.stringify(event),
|
||||
format: 'text'
|
||||
};
|
||||
|
||||
var mailOptions = {
|
||||
from: mailConfig.notificationFrom,
|
||||
to: mailTo,
|
||||
subject: `[${mailConfig.cloudronName}] ${app ? app.fqdn : addon.name} was restarted (OOM)`,
|
||||
text: render('oom_event.ejs', templateData)
|
||||
};
|
||||
|
||||
sendMail(mailOptions);
|
||||
});
|
||||
}
|
||||
|
||||
function sendTestMail(domain, email, callback) {
|
||||
assert.strictEqual(typeof domain, 'string');
|
||||
assert.strictEqual(typeof email, 'string');
|
||||
|
||||
Reference in New Issue
Block a user