diff --git a/src/mail_templates/app_down.ejs b/src/mail_templates/app_down.ejs deleted file mode 100644 index 30957368d..000000000 --- a/src/mail_templates/app_down.ejs +++ /dev/null @@ -1,21 +0,0 @@ -<%if (format === 'text') { %> - -Dear Cloudron Admin, - -The application '<%= title %>' installed at <%= appFqdn %> is not responding. - -This is most likely a problem in the application. - -To resolve this, you can try the following: -* Restart the app by opening the app's web terminal - https://docs.cloudron.io/apps/#web-terminal -* Restore the app to the latest backup - https://docs.cloudron.io/backups/#restoring-an-app -* Contact us via <%= supportEmail %> or https://forum.cloudron.io - - -Powered by https://cloudron.io - -Sent at: <%= new Date().toUTCString() %> - -<% } else { %> - -<% } %> diff --git a/src/mail_templates/app_up.ejs b/src/mail_templates/app_up.ejs deleted file mode 100644 index 9d842ab58..000000000 --- a/src/mail_templates/app_up.ejs +++ /dev/null @@ -1,14 +0,0 @@ -<%if (format === 'text') { %> - -Dear Cloudron Admin, - -The application '<%= title %>' installed at <%= appFqdn %> is back online -and responding to health checks. - -Powered by https://cloudron.io - -Sent at: <%= new Date().toUTCString() %> - -<% } else { %> - -<% } %> diff --git a/src/mail_templates/oom_event.ejs b/src/mail_templates/oom_event.ejs deleted file mode 100644 index 74575edb2..000000000 --- a/src/mail_templates/oom_event.ejs +++ /dev/null @@ -1,27 +0,0 @@ -<%if (format === 'text') { %> - -Dear <%= cloudronName %> Admin, - -<%if (app) { %> -The application at <%= app.fqdn %> ran out of memory. The application has been restarted automatically. If you see this notification often, -consider increasing the memory limit - <%= webadminUrl %>/#/app/<%= app.id %>/resources . -<% } else { %> -The addon <%= addon.name %> service ran out of memory. The service has been restarted automatically. If you see this notification often, -consider increasing the memory limit - <%= webadminUrl %>/#/services . -<% } %> - -Out of memory event: - -------------------------------------- - -<%- event %> - -------------------------------------- - -Powered by https://cloudron.io - -Sent at: <%= new Date().toUTCString() %> - -<% } else { %> - -<% } %> diff --git a/src/mailer.js b/src/mailer.js index 622013cfe..c02a8c742 100644 --- a/src/mailer.js +++ b/src/mailer.js @@ -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'); diff --git a/src/notifications.js b/src/notifications.js index 59348468f..e6687905a 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -166,8 +166,6 @@ function oomEvent(eventId, app, addon, containerId, event, callback) { } forEachAdmin({ skip: [] }, function (admin, done) { - mailer.oomEvent(admin.email, app, addon, containerId, event); - add(admin.id, eventId, title, message, done); }, callback); } @@ -178,7 +176,6 @@ function appUp(eventId, app, callback) { assert.strictEqual(typeof callback, 'function'); forEachAdmin({ skip: [] }, function (admin, done) { - mailer.appUp(admin.email, app); add(admin.id, eventId, `App ${app.fqdn} is back online`, `The application installed at ${app.fqdn} is back online.`, done); }, callback); } @@ -189,7 +186,6 @@ function appDied(eventId, app, callback) { assert.strictEqual(typeof callback, 'function'); forEachAdmin({ skip: [] }, function (admin, callback) { - mailer.appDied(admin.email, app); add(admin.id, eventId, `App ${app.fqdn} is down`, `The application installed at ${app.fqdn} is not responding.`, callback); }, callback); }