Skip to content
This repository was archived by the owner on Apr 27, 2024. It is now read-only.

Commit 79d346a

Browse files
author
benjamin-maynard
committed
Rename application to kubernetes-s3-mysql-backup
1 parent b6a30b4 commit 79d346a

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [v2.0.1] - 16-12-2018
8+
### Renamed to kubernetes-mysql-backup
9+
- Renamed to kubernetes-s3-mysql-backup from aws-database-backup to better describe function
10+
711
## [v2.0.0] - 16-12-2018
812
### Fix issue with Slack Alerts
913
- Implemented the ability to backup multiple databases from a single host

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN apk -v --update add \
1717
# Set Default Environment Variables
1818
ENV TARGET_DATABASE_PORT=3306
1919
ENV SLACK_ENABLED=false
20-
ENV SLACK_USERNAME=aws-database-backup
20+
ENV SLACK_USERNAME=kubernetes-s3-mysql-backup
2121

2222
# Copy Slack Alert script and make executable
2323
COPY resources/slack-alert.sh /

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# aws-database-backup
1+
# kubernetes-s3-mysql-backup
22

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.
44

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.
66

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/).
88

99
All changes are captured in the [changelog](CHANGELOG.md), which adheres to [Semantic Versioning](https://semver.org/spec/vadheres2.0.0.html).
1010

1111

1212
## Environment Variables
1313

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.
1515

1616
| Environment Variable | Purpose |
1717
| --------------------------- |------------------------------------------------------------------------------------------------------------------|
@@ -26,23 +26,23 @@ The below table lists all of the Environment Variables that are configurable for
2626
| TARGET_DATABASE_USER | **(Required)** Username to authenticate to the database with. |
2727
| TARGET_DATABASE_PASSWORD | **(Required)** Password to authenticate to the database with. Should be configured using a Secret in Kubernetes. |
2828
| 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). |
3030
| SLACK_CHANNEL | **(Required if Slack enabled)** Slack Channel the WebHook is configured for. |
3131
| SLACK_WEBHOOK_URL | **(Required if Slack enabled)** What is the Slack WebHook URL to post to? Should be configured using a Secret in Kubernetes. |
3232

3333

3434
## Slack Integration
3535

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:
3737

3838
* If the backup job is **SUCCESSFUL**: A generic message will be posted into the Slack Channel detailing that all database backups successfully completed.
3939
* 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.
4040

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.
4242

4343
## Configuring the S3 Bucket & AWS IAM User
4444

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.
4646

4747
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:
4848

@@ -110,7 +110,7 @@ spec:
110110
spec:
111111
containers:
112112
- name: my-database-backup
113-
image: benjaminmaynard/aws-database-backup
113+
image: benjaminmaynard/kubernetes-s3-mysql-backup
114114
imagePullPolicy: Always
115115
env:
116116
- name: AWS_ACCESS_KEY_ID

resources/perform-backup.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ do
2020
then
2121
echo -e "Database backup successfully uploaded for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S')."
2222
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
2424
has_failed=true
2525
fi
2626

2727
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
2929
has_failed=true
3030
fi
3131

@@ -41,13 +41,13 @@ then
4141
if [ "$SLACK_ENABLED" = true ]
4242
then
4343
# Put the contents of the database backup logs into a variable
44-
logcontents=`cat /tmp/aws-database-backup.log`
44+
logcontents=`cat /tmp/kubernetes-s3-mysql-backup.log`
4545

4646
# Send Slack alert
4747
/slack-alert.sh "One or more backups on database host $TARGET_DATABASE_HOST failed. The error details are included below:" "$logcontents"
4848
fi
4949

50-
echo -e "aws-database-backup encountered 1 or more errors. Exiting with status code 1."
50+
echo -e "kubernetes-s3-mysql-backup encountered 1 or more errors. Exiting with status code 1."
5151
exit 1
5252

5353
else

0 commit comments

Comments
 (0)