Skip to content

Commit

Permalink
fix path
Browse files Browse the repository at this point in the history
  • Loading branch information
nihaldivyam committed Mar 28, 2024
1 parent 33dbe86 commit 5eadc41
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions logical-backup/dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=()

Expand All @@ -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
Expand Down

0 comments on commit 5eadc41

Please sign in to comment.