From 5eadc41bb3ad9d771c9f90c5aa14bb09e105c293 Mon Sep 17 00:00:00 2001 From: nihaldivyam Date: Thu, 28 Mar 2024 19:23:39 +0530 Subject: [PATCH] fix path --- logical-backup/dump.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/logical-backup/dump.sh b/logical-backup/dump.sh index da7f761..44fa5eb 100755 --- a/logical-backup/dump.sh +++ b/logical-backup/dump.sh @@ -124,12 +124,11 @@ function aws_upload { function aws_upload_dir { declare -r EXPECTED_SIZE="$1" - declare -r DB_NAME="$2" - + # mimic bucket setup from Spilo # to keep logical backups at the same path as WAL # NB: $LOGICAL_BACKUP_S3_BUCKET_SCOPE_SUFFIX already contains the leading "/" when set by the Postgres Operator - PATH_TO_BACKUP="s3://${LOGICAL_BACKUP_S3_BUCKET}/${POSTGRES_OPERATOR}/${LOGICAL_BACKUP_S3_BUCKET_SCOPE_SUFFIX}/${PGUSER}/logical_backups/${DB_NAME}/$(date +%s)" + PATH_TO_BACKUP="s3://${LOGICAL_BACKUP_S3_BUCKET}/${POSTGRES_OPERATOR}/${LOGICAL_BACKUP_S3_BUCKET_SCOPE_SUFFIX}/${PGUSER}/logical_backups/$(date +%s)" args=() @@ -138,7 +137,7 @@ function aws_upload_dir { [[ ! -z "${LOGICAL_BACKUP_S3_REGION}" ]] && args+=("--region=${LOGICAL_BACKUP_S3_REGION}") echo "Uploading dump dir to s3" - aws s3 cp "$1" "$PATH_TO_BACKUP" "${args[@]//\'/}" + compress "$1" | aws s3 cp - "$PATH_TO_BACKUP" "${args[@]//\'/}" } function gcs_upload { PATH_TO_BACKUP=gs://${LOGICAL_BACKUP_S3_BUCKET}"/"${POSTGRES_OPERATOR}"/"${LOGICAL_BACKUP_S3_BUCKET_SCOPE_SUFFIX}"/logical_backups/"$(date +%s).sql.gz