Skip to content

Commit

Permalink
Made APP_CONFIG_NAME, BACKUP_STORAGE_ACCOUNT_NAME and BACKUP_STORAGE_…
Browse files Browse the repository at this point in the history
…CONTAINER_NAME variables as inputs to the script
  • Loading branch information
viktor-ribchev committed Jan 25, 2024
1 parent 8d7c89d commit ad326e3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions files/graphdb_backup
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ad326e3

Please sign in to comment.