Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/scripts/scripts/restore-settings-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ else
echo "=== Checking for StackPacks backup \"${STACKPACKS_FILE}\" in bucket \"${BACKUP_CONFIGURATION_LOCAL_BUCKET}\"..."
setup_aws_credentials

if download_from_s3 "${BACKUP_CONFIGURATION_LOCAL_BUCKET}" "${BACKUP_CONFIGURATION_S3_PREFIX}${BACKUP_CONFIGURATION_STACKPACKS_DIR}" "${TMP_DIR}" "${STACKPACKS_FILE}"; then
if download_from_s3 "${BACKUP_CONFIGURATION_LOCAL_BUCKET}" "${BACKUP_CONFIGURATION_STACKPACKS_DIR}" "${TMP_DIR}" "${STACKPACKS_FILE}"; then
Comment thread
viliakov marked this conversation as resolved.
STACKPACKS_RESTORE_FILE="${TMP_DIR}/${STACKPACKS_FILE}"
elif [ "${BACKUP_CONFIGURATION_UPLOAD_REMOTE}" == "true" ]; then
echo "=== StackPacks backup not found in kubernetes settings storage, trying main backups storage..."
Expand All @@ -80,8 +80,8 @@ else
fi

if [ -z "${STACKPACKS_RESTORE_FILE}" ] || [ ! -f "${STACKPACKS_RESTORE_FILE}" ]; then
echo "=== WARNING: StackPacks backup \"${STACKPACKS_FILE}\" not found, skipping StackPacks restore"
exit 0
echo "=== ERROR: StackPacks backup \"${STACKPACKS_FILE}\" not found"
exit 1
Comment thread
rb3ckers marked this conversation as resolved.
fi

echo "=== Restoring StackPacks from \"${STACKPACKS_FILE}\"..."
Expand Down
19 changes: 10 additions & 9 deletions internal/scripts/scripts/restore-stackgraph-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ else
echo "=== Checking for StackPacks backup \"${STACKPACKS_FILE}\" in bucket \"${BACKUP_STACKGRAPH_BUCKET_NAME}\"..."

# Check if stackpacks backup exists in S3
if sts-toolbox aws s3 ls --endpoint "http://${MINIO_ENDPOINT}" --region minio --bucket "${BACKUP_STACKGRAPH_BUCKET_NAME}" --prefix "${BACKUP_STACKGRAPH_S3_PREFIX}${BACKUP_STACKGRAPH_STACKPACKS_DIR}${STACKPACKS_FILE}" 2>/dev/null | grep -q "${STACKPACKS_FILE}"; then
echo "=== Downloading StackPacks backup..."
sts-toolbox aws s3 cp --endpoint "http://${MINIO_ENDPOINT}" --region minio "s3://${BACKUP_STACKGRAPH_BUCKET_NAME}/${BACKUP_STACKGRAPH_S3_PREFIX}${BACKUP_STACKGRAPH_STACKPACKS_DIR}${STACKPACKS_FILE}" "${TMP_DIR}/${STACKPACKS_FILE}"

echo "=== Restoring StackPacks from \"${STACKPACKS_FILE}\"..."
/opt/docker/bin/stack-packs-backup -Dlogback.configurationFile=/opt/docker/etc_log/logback.xml -restore "${TMP_DIR}/${STACKPACKS_FILE}"
echo "=== StackPacks restore complete"
else
echo "=== WARNING: StackPacks backup \"${STACKPACKS_FILE}\" not found in S3, skipping StackPacks restore"
if ! sts-toolbox aws s3 ls --endpoint "http://${MINIO_ENDPOINT}" --region minio --bucket "${BACKUP_STACKGRAPH_BUCKET_NAME}" --prefix "${BACKUP_STACKGRAPH_S3_PREFIX}${BACKUP_STACKGRAPH_STACKPACKS_DIR}${STACKPACKS_FILE}" 2>/dev/null | grep -q "${STACKPACKS_FILE}"; then
echo "=== ERROR: StackPacks backup \"${STACKPACKS_FILE}\" not found in S3"
exit 1
fi

echo "=== Downloading StackPacks backup..."
sts-toolbox aws s3 cp --endpoint "http://${MINIO_ENDPOINT}" --region minio "s3://${BACKUP_STACKGRAPH_BUCKET_NAME}/${BACKUP_STACKGRAPH_S3_PREFIX}${BACKUP_STACKGRAPH_STACKPACKS_DIR}${STACKPACKS_FILE}" "${TMP_DIR}/${STACKPACKS_FILE}"

echo "=== Restoring StackPacks from \"${STACKPACKS_FILE}\"..."
/opt/docker/bin/stack-packs-backup -Dlogback.configurationFile=/opt/docker/etc_log/logback.xml -restore "${TMP_DIR}/${STACKPACKS_FILE}"
echo "=== StackPacks restore complete"
fi
echo "==="
Loading