mailer: make oom mail contain link to dashboard instead of docs

This commit is contained in:
Girish Ramakrishnan
2021-01-02 11:07:44 -08:00
parent 6507d95b98
commit 353369c1e9
4 changed files with 30 additions and 22 deletions
+6 -10
View File
@@ -154,23 +154,19 @@ function oomEvent(eventId, app, addon, containerId, event, callback) {
assert.strictEqual(typeof containerId, 'string');
assert.strictEqual(typeof callback, 'function');
let title, message, program;
assert(app || addon);
let title, message;
if (app) {
program = `App ${app.fqdn}`;
title = `The application at ${app.fqdn} ran out of memory.`;
message = 'The application has been restarted automatically. If you see this notification often, consider increasing the [memory limit](https://docs.cloudron.io/apps/#memory-limit)';
message = `The application has been restarted automatically. If you see this notification often, consider increasing the [memory limit](${settings.adminOrigin()}/#/app/${app.id}/resources)`;
} else if (addon) {
program = `${addon.name} service`;
title = `The ${addon.name} service ran out of memory`;
message = 'The service has been restarted automatically. If you see this notification often, consider increasing the [memory limit](https://docs.cloudron.io/troubleshooting/#services)';
} else { // this never happens currently
program = `Container ${containerId}`;
title = `The container ${containerId} ran out of memory`;
message = 'The container has been restarted automatically. Consider increasing the [memory limit](https://docs.docker.com/v17.09/edge/engine/reference/commandline/update/#update-a-containers-kernel-memory-constraints)';
message = `The service has been restarted automatically. If you see this notification often, consider increasing the [memory limit](${settings.adminOrigin()}/#/services)`;
}
forEachAdmin({ skip: [] }, function (admin, done) {
mailer.oomEvent(admin.email, program, event);
mailer.oomEvent(admin.email, app, addon, containerId, event);
add(admin.id, eventId, title, message, done);
}, callback);