diff --git a/README.md b/README.md index 4bb09e1..e908262 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The below table lists all of the Environment Variables that are configurable for | AWS_ACCESS_KEY_ID | **(Required)** AWS IAM Access Key ID. | | AWS_SECRET_ACCESS_KEY | **(Required)** AWS IAM Secret Access Key. Should have very limited IAM permissions (see below for example) and should be configured using a Secret in Kubernetes. | | AWS_DEFAULT_REGION | **(Required)** Region of the S3 Bucket (e.g. eu-west-2). | -| AWS_BUCKET_NAME | **(Required)** The name of the S3 bucket. | +| AWS_BUCKET_URI | **(Required)** The name of the S3 bucket. | | AWS_BUCKET_BACKUP_PATH | **(Required)** Path the backup file should be saved to in S3. E.g. `/database/myblog/backups`. **Do not put a trailing / or specify the filename.** | | TARGET_DATABASE_HOST | **(Required)** Hostname or IP address of the MySQL Host. | | TARGET_DATABASE_PORT | **(Optional)** Port MySQL is listening on (Default: 3306). | @@ -122,8 +122,8 @@ spec: key: aws_secret_access_key - name: AWS_DEFAULT_REGION value: "" - - name: AWS_BUCKET_NAME - value: "" + - name: AWS_BUCKET_URI + value: "" - name: AWS_BUCKET_BACKUP_PATH value: "" - name: TARGET_DATABASE_HOST diff --git a/resources/perform-backup.sh b/resources/perform-backup.sh index 48cf73c..6b19b48 100644 --- a/resources/perform-backup.sh +++ b/resources/perform-backup.sh @@ -1,5 +1,8 @@ #/bin/sh +if [[ "${DEBUG}" != "" ]] ; then + set -x +fi # Set the has_failed variable to false. This will change if any of the subsequent database backups/uploads fail. has_failed=false @@ -17,7 +20,7 @@ do echo -e "Database backup successfully completed for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S')." backup_name=$CURRENT_DATABASE_$(date +"%Y-%m-%d_%H-%M-%S").sql # Perform the upload to S3. Put the output to a variable. If successful, print an entry to the console and the log. If unsuccessful, set has_failed to true and print an entry to the console and the log - if awsoutput=$(aws s3 cp /tmp/$CURRENT_DATABASE.sql $AWS_BUCKET_URI$AWS_BUCKET_BACKUP_PATH/$backup_name 2>&1) + if awsoutput=$(aws s3 ${S3_OPTIONS} cp /tmp/$CURRENT_DATABASE.sql $AWS_BUCKET_URI$AWS_BUCKET_BACKUP_PATH/$backup_name 2>&1) then echo -e "Database backup successfully uploaded for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S')." else