From ad326e3304ea46ffcdef0e395cea62b281ec0b96 Mon Sep 17 00:00:00 2001 From: Viktor Ribchev Date: Thu, 25 Jan 2024 10:08:57 +0200 Subject: [PATCH] Made APP_CONFIG_NAME, BACKUP_STORAGE_ACCOUNT_NAME and BACKUP_STORAGE_CONTAINER_NAME variables as inputs to the script --- files/graphdb_backup | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/files/graphdb_backup b/files/graphdb_backup index a15e6a2..a31afdc 100644 --- a/files/graphdb_backup +++ b/files/graphdb_backup @@ -2,18 +2,17 @@ # This script utilizes the cloud backup functionality of GraphDB. # It is intended to be run in clustered topology. +# This script accepts three variables in the following order: app_config_name, backup_storage_account_name, backup_storage_container_name set -euo pipefail az login --identity -RESOURCE_GROUP="$(curl -s -H Metadata:true "http://169.254.169.254/metadata/instance/compute/resourceGroupName?api-version=2021-01-01&format=text")" -APP_CONFIG_NAME="$(az appconfig list --resource-group ${RESOURCE_GROUP} --query "[].name" --output tsv)" -GRAPHDB_ADMIN_PASSWORD="$(az appconfig kv show --name ${APP_CONFIG_NAME} --auth-mode login --key graphdb-password | jq -r .value | base64 -d)" +GRAPHDB_ADMIN_PASSWORD="$(az appconfig kv show --name ${1} --auth-mode login --key graphdb-password | jq -r .value | base64 -d)" NODE_STATE="$(curl --silent --fail --user "admin:$GRAPHDB_ADMIN_PASSWORD" localhost:7200/rest/cluster/node/status | jq -r .nodeState)" BACKUP_NAME="$(date +'%Y-%m-%d_%H-%M-%S').tar" -BACKUP_STORAGE_ACCOUNT_NAME="$(az storage account list --resource-group rg-vik-gdb --query "[].name" --output tsv)" -BACKUP_STORAGE_CONTAINER_NAME="$(az storage container list --account-name ${BACKUP_STORAGE_ACCOUNT_NAME} --auth-mode login --query "[?contains(name, 'backup')].name" --output tsv)" +BACKUP_STORAGE_ACCOUNT_NAME="${2}" +BACKUP_STORAGE_CONTAINER_NAME="${3}" max_retries=3 retry_count=0