-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from jkaninda/fix-notification
chore: fix infinity calling Fatal, add a backup reference
- Loading branch information
Showing
9 changed files
with
133 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,10 @@ layout: default | |
parent: How Tos | ||
nav_order: 12 | ||
--- | ||
Send Email or Telegram notifications on success or failed backup. | ||
Send Email or Telegram notifications on successfully or failed backup. | ||
|
||
To send out email notifications on failed backup runs, provide SMTP credentials, a sender and a recipient: | ||
To send out email notifications on failed or successfully backup runs, provide SMTP credentials, a sender and a recipient: | ||
|
||
```yaml | ||
services: | ||
|
@@ -27,9 +27,13 @@ services: | |
- MAIL_PORT=587 | ||
- MAIL_USERNAME= | ||
- MAIL_PASSWORD=! | ||
- MAIL_FROM=[email protected] | ||
- MAIL_FROM= | ||
- [email protected],[email protected],[email protected] | ||
- MAIL_SKIP_TLS=false | ||
## Time format for notification | ||
- TIME_FORMAT=2006-01-02 at 15:04:05 | ||
## Backup reference, in case you want to identifier every backup instance | ||
- BACKUP_REFERENCE=database/Paris cluster | ||
networks: | ||
- web | ||
networks: | ||
|
@@ -54,6 +58,10 @@ services: | |
- DB_PASSWORD=password | ||
- TG_TOKEN=[BOT ID]:[BOT TOKEN] | ||
- TG_CHAT_ID= | ||
## Time format for notification | ||
- TIME_FORMAT=2006-01-02 at 15:04:05 | ||
## Backup reference, in case you want to identifier every backup instance | ||
- BACKUP_REFERENCE=database/Paris cluster | ||
networks: | ||
- web | ||
networks: | ||
|
@@ -62,12 +70,13 @@ networks: | |
### Customize notifications | ||
The body of the notifications can be tailored to your needs using Go templates. | ||
The title and body of the notifications can be tailored to your needs using Go templates. | ||
Template sources must be mounted inside the container in /config/templates: | ||
- email.template: Email notification template | ||
- telegram.template: Telegram notification template | ||
- error.template: Error notification template | ||
- email-error.template: Error notification template | ||
- telegram-error.template: Error notification template | ||
### Data | ||
|
@@ -78,7 +87,7 @@ Here is a list of all data passed to the template: | |
- `Storage`: Backup storage | ||
- `BackupLocation`: Backup location | ||
- `BackupSize`: Backup size | ||
|
||
- `BackupReference`: Backup reference(eg: database/cluster name or server name) | ||
|
||
> email.template: | ||
|
||
|
@@ -88,19 +97,20 @@ Here is a list of all data passed to the template: | |
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>[✅ Database Backup Notification – {{.Database}}</title> | ||
<title>✅ Database Backup Notification – {{.Database}}</title> | ||
</head> | ||
<body> | ||
<h2>Hi,</h2> | ||
<p>Backup of the {{.Database}} database has been successfully completed on {{.EndTime}}.</p> | ||
<h3>Backup Details:</h3> | ||
<ul> | ||
<li>Database Name: {{.Database}}</li> | ||
<li>Backup Start Time: {{.StartTime}}</li> | ||
<li>Backup End Time: {{.EndTime}}</li> | ||
<li>Backup Storage: {{.Storage}}</li> | ||
<li>Backup Location: {{.BackupLocation}}</li> | ||
<li>Backup Size: {{.BackupSize}} bytes</li> | ||
<li>Database Name: {{.Database}}</li> | ||
<li>Backup Start Time: {{.StartTime}}</li> | ||
<li>Backup End Time: {{.EndTime}}</li> | ||
<li>Backup Storage: {{.Storage}}</li> | ||
<li>Backup Location: {{.BackupLocation}}</li> | ||
<li>Backup Size: {{.BackupSize}} bytes</li> | ||
<li>Backup Reference: {{.BackupReference}} </li> | ||
</ul> | ||
<p>Best regards,</p> | ||
</body> | ||
|
@@ -110,7 +120,7 @@ Here is a list of all data passed to the template: | |
> telegram.template | ||
|
||
```html | ||
[✅ Database Backup Notification – {{.Database}} | ||
✅ Database Backup Notification – {{.Database}} | ||
Hi, | ||
Backup of the {{.Database}} database has been successfully completed on {{.EndTime}}. | ||
|
@@ -121,9 +131,32 @@ Backup Details: | |
- Backup Storage: {{.Storage}} | ||
- Backup Location: {{.BackupLocation}} | ||
- Backup Size: {{.BackupSize}} bytes | ||
- Backup Reference: {{.BackupReference}} | ||
``` | ||
|
||
> email-error.template | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>🔴 Urgent: Database Backup Failure Notification</title> | ||
</head> | ||
<body> | ||
<h2>Hi,</h2> | ||
<p>An error occurred during database backup.</p> | ||
<h3>Failure Details:</h3> | ||
<ul> | ||
<li>Error Message: {{.Error}}</li> | ||
<li>Date: {{.EndTime}}</li> | ||
<li>Backup Reference: {{.BackupReference}} </li> | ||
</ul> | ||
</body> | ||
</html> | ||
``` | ||
|
||
> error.template | ||
> telegram-error.template | ||
|
||
|
||
```html | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.