Skip to content

Commit 4f5c04a

Browse files
committed
Bugfix: Generating S3 prefix to store new backups
1 parent 25def5b commit 4f5c04a

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
@@ -190,19 +190,19 @@ Your Organization will be mapped to `DB_USER` and your root token will need to b
190190

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

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

207207
## Maintenance
208208

install/assets/functions/10-db-backup

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,15 +461,15 @@ cleanup_old_data() {
461461
;;
462462
"s3" | "minio" )
463463
print_info "Cleaning up old backups"
464-
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
464+
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
465465
s3_createdate=$(echo $s3_file | awk {'print $1" "$2'})
466466
s3_createdate=$(date -d "$s3_createdate" "+%s")
467467
s3_olderthan=$(echo $(( $(date +%s)-${DB_CLEANUP_TIME}*60 )))
468468
if [[ $s3_createdate -le $s3_olderthan ]] ; then
469469
s3_filename=$(echo $s3_file | awk {'print $4'})
470470
if [ "$s3_filename" != "" ] ; then
471471
print_debug "Deleting $s3_filename"
472-
silent aws ${PARAM_AWS_ENDPOINT_URL} s3 rm s3://${S3_BUCKET}/${S3_PATH}${s3_filename} ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
472+
silent aws ${PARAM_AWS_ENDPOINT_URL} s3 rm s3://${S3_BUCKET}/${S3_PATH}/${s3_filename} ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
473473
fi
474474
fi
475475

0 commit comments

Comments
 (0)