You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 27, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,17 @@
1
-
# aws-database-backup
1
+
# kubernetes-s3-mysql-backup
2
2
3
-
aws-database-backup is a container image based on Alpine Linux. This container is designed to run in Kubernetes as a cronjob to perform automatic backups of MySQL databases to Amazon S3. It was created to meet my requirements for regular and automatic database backups. Having started with a relatively basic feature set, it is gradually growing to add more and more features.
3
+
kubernetes-s3-mysql-backup is a container image based on Alpine Linux. This container is designed to run in Kubernetes as a cronjob to perform automatic backups of MySQL databases to Amazon S3. It was created to meet my requirements for regular and automatic database backups. Having started with a relatively basic feature set, it is gradually growing to add more and more features.
4
4
5
-
Currently, aws-database-backup supports the backing up of MySQL Databases. It can perform backups of multiple MySQL databases from a single database host. When triggered, a full database dump is performed using the `mysqldump` command for each configured database. The backup(s) are then uploaded to an Amazon S3 Bucket. aws-database-backup features Slack Integration, and can post messages into a channel detailing if the backup(s) were successful or not.
5
+
Currently, kubernetes-s3-mysql-backup supports the backing up of MySQL Databases. It can perform backups of multiple MySQL databases from a single database host. When triggered, a full database dump is performed using the `mysqldump` command for each configured database. The backup(s) are then uploaded to an Amazon S3 Bucket. kubernetes-s3-mysql-backup features Slack Integration, and can post messages into a channel detailing if the backup(s) were successful or not.
6
6
7
-
Over time, aws-database-backup will be updated to support more features and functionality. I currently use this container as part of my Kubernetes Architecture which you can read about [here](https://benjamin.maynard.io/this-blog-now-runs-on-kubernetes-heres-the-architecture/).
7
+
Over time, kubernetes-s3-mysql-backup will be updated to support more features and functionality. I currently use this container as part of my Kubernetes Architecture which you can read about [here](https://benjamin.maynard.io/this-blog-now-runs-on-kubernetes-heres-the-architecture/).
8
8
9
9
All changes are captured in the [changelog](CHANGELOG.md), which adheres to [Semantic Versioning](https://semver.org/spec/vadheres2.0.0.html).
10
10
11
11
12
12
## Environment Variables
13
13
14
-
The below table lists all of the Environment Variables that are configurable for aws-database-backup.
14
+
The below table lists all of the Environment Variables that are configurable for kubernetes-s3-mysql-backup.
@@ -26,23 +26,23 @@ The below table lists all of the Environment Variables that are configurable for
26
26
| TARGET_DATABASE_USER |**(Required)** Username to authenticate to the database with. |
27
27
| TARGET_DATABASE_PASSWORD |**(Required)** Password to authenticate to the database with. Should be configured using a Secret in Kubernetes. |
28
28
| SLACK_ENABLED |**(Optional)** (true/false) Enable or disable the Slack Integration (Default False). |
29
-
| SLACK_USERNAME |**(Optional)** (true/false) Username to use for the Slack Integration (Default: aws-database-backup). |
29
+
| SLACK_USERNAME |**(Optional)** (true/false) Username to use for the Slack Integration (Default: kubernetes-s3-mysql-backup). |
30
30
| SLACK_CHANNEL |**(Required if Slack enabled)** Slack Channel the WebHook is configured for. |
31
31
| SLACK_WEBHOOK_URL |**(Required if Slack enabled)** What is the Slack WebHook URL to post to? Should be configured using a Secret in Kubernetes. |
32
32
33
33
34
34
## Slack Integration
35
35
36
-
aws-database-backup supports posting into Slack after each backup job completes. The message posted into the Slack Channel varies as detailed below:
36
+
kubernetes-s3-mysql-backup supports posting into Slack after each backup job completes. The message posted into the Slack Channel varies as detailed below:
37
37
38
38
* If the backup job is **SUCCESSFUL**: A generic message will be posted into the Slack Channel detailing that all database backups successfully completed.
39
39
* If the backup job is **UNSUCCESSFUL**: A message will be posted into the Slack Channel with a detailed error message for each database that failed.
40
40
41
-
In order to configure aws-database-backup to post messages into Slack, you need to create an [Incoming WebHook](https://api.slack.com/incoming-webhooks). Once generated, you can configure aws-database-backup using the environment variables detailed above.
41
+
In order to configure kubernetes-s3-mysql-backup to post messages into Slack, you need to create an [Incoming WebHook](https://api.slack.com/incoming-webhooks). Once generated, you can configure kubernetes-s3-mysql-backup using the environment variables detailed above.
42
42
43
43
## Configuring the S3 Bucket & AWS IAM User
44
44
45
-
aws-database-backup performs a backup to the same path, with the same filename each time it runs. It therefore assumes that you have Versioning enabled on your S3 Bucket. A typical setup would involve S3 Versioning, with a Lifecycle Policy.
45
+
kubernetes-s3-mysql-backup performs a backup to the same path, with the same filename each time it runs. It therefore assumes that you have Versioning enabled on your S3 Bucket. A typical setup would involve S3 Versioning, with a Lifecycle Policy.
46
46
47
47
An IAM Users should be created, with API Credentials. An example Policy to attach to the IAM User (for a minimal permissions set) is as follows:
Copy file name to clipboardExpand all lines: resources/perform-backup.sh
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -20,12 +20,12 @@ do
20
20
then
21
21
echo -e "Database backup successfully uploaded for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S')."
22
22
else
23
-
echo -e "Database backup failed to upload for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S'). Error: $awsoutput"| tee -a /tmp/aws-database-backup.log
23
+
echo -e "Database backup failed to upload for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S'). Error: $awsoutput"| tee -a /tmp/kubernetes-s3-mysql-backup.log
24
24
has_failed=true
25
25
fi
26
26
27
27
else
28
-
echo -e "Database backup FAILED for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S'). Error: $sqloutput"| tee -a /tmp/aws-database-backup.log
28
+
echo -e "Database backup FAILED for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S'). Error: $sqloutput"| tee -a /tmp/kubernetes-s3-mysql-backup.log
29
29
has_failed=true
30
30
fi
31
31
@@ -41,13 +41,13 @@ then
41
41
if [ "$SLACK_ENABLED"=true ]
42
42
then
43
43
# Put the contents of the database backup logs into a variable
0 commit comments