Skip to content

Commit bfeb07d

Browse files
authored
Merge pull request #179 from greena13/bugfix/s3_backup_prefixes
Bugfix: Generating S3 prefix to store new backups
2 parents 494f742 + 8a5d647 commit bfeb07d

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,19 @@ Your Organization will be mapped to `DB_USER` and your root token will need to b
189189

190190
If `BACKUP_LOCATION` = `S3` then the following options are used.
191191

192-
| Parameter | Description | Default |
193-
|-----------------------|-------------------------------------------------------------------------------------------|---------|
194-
| `S3_BUCKET` | S3 Bucket name e.g. `mybucket` | |
195-
| `S3_KEY_ID` | S3 Key ID | |
196-
| `S3_KEY_SECRET` | S3 Key Secret | |
197-
| `S3_PATH` | S3 Pathname to save to (must end in a trailing slash e.g. '`backup/`') | |
198-
| `S3_REGION` | Define region in which bucket is defined. Example: `ap-northeast-2` | |
199-
| `S3_HOST` | Hostname (and port) of S3-compatible service, e.g. `minio:8080`. Defaults to AWS. | |
200-
| `S3_PROTOCOL` | Protocol to connect to `S3_HOST`. Either `http` or `https`. Defaults to `https`. | `https` |
201-
| `S3_EXTRA_OPTS` | Add any extra options to the end of the `aws-cli` process execution | |
192+
| Parameter | Description | Default |
193+
|-----------------------|------------------------------------------------------------------------------------------|---------|
194+
| `S3_BUCKET` | S3 Bucket name e.g. `mybucket` | |
195+
| `S3_KEY_ID` | S3 Key ID | |
196+
| `S3_KEY_SECRET` | S3 Key Secret | |
197+
| `S3_PATH` | S3 Pathname to save to (must NOT end in a trailing slash e.g. '`backup`') | |
198+
| `S3_REGION` | Define region in which bucket is defined. Example: `ap-northeast-2` | |
199+
| `S3_HOST` | Hostname (and port) of S3-compatible service, e.g. `minio:8080`. Defaults to AWS. | |
200+
| `S3_PROTOCOL` | Protocol to connect to `S3_HOST`. Either `http` or `https`. Defaults to `https`. | `https` |
201+
| `S3_EXTRA_OPTS` | Add any extra options to the end of the `aws-cli` process execution | |
202202
| `S3_CERT_CA_FILE` | Map a volume and point to your custom CA Bundle for verification e.g. `/certs/bundle.pem` | |
203-
| _*OR*_ | | |
204-
| `S3_CERT_SKIP_VERIFY` | Skip verifying self signed certificates when connecting | `TRUE` |
203+
| _*OR*_ | | |
204+
| `S3_CERT_SKIP_VERIFY` | Skip verifying self signed certificates when connecting | `TRUE` |
205205

206206
#### Upload to a Azure storage account by `blobxfer`
207207

install/assets/functions/10-db-backup

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,15 +471,15 @@ cleanup_old_data() {
471471
;;
472472
"s3" | "minio" )
473473
print_info "Cleaning up old backups on S3 storage"
474-
aws ${PARAM_AWS_ENDPOINT_URL} s3 ls s3://${S3_BUCKET}/${S3_PATH} ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS} | grep " DIR " -v | grep " PRE " -v | while read -r s3_file; do
474+
aws ${PARAM_AWS_ENDPOINT_URL} s3 ls s3://${S3_BUCKET}/${S3_PATH}/ ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS} | grep " DIR " -v | grep " PRE " -v | while read -r s3_file; do
475475
s3_createdate=$(echo $s3_file | awk {'print $1" "$2'})
476476
s3_createdate=$(date -d "$s3_createdate" "+%s")
477477
s3_olderthan=$(echo $(( $(date +%s)-${DB_CLEANUP_TIME}*60 )))
478478
if [[ $s3_createdate -le $s3_olderthan ]] ; then
479479
s3_filename=$(echo $s3_file | awk {'print $4'})
480480
if [ "$s3_filename" != "" ] ; then
481481
print_debug "Deleting $s3_filename"
482-
silent aws ${PARAM_AWS_ENDPOINT_URL} s3 rm s3://${S3_BUCKET}/${S3_PATH}${s3_filename} ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
482+
silent aws ${PARAM_AWS_ENDPOINT_URL} s3 rm s3://${S3_BUCKET}/${S3_PATH}/${s3_filename} ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
483483
fi
484484
fi
485485

0 commit comments

Comments
 (0)