view scripts/restore-document-store.sh @ 539:5d5525414c8d production tip

update exec-all-projects-docker.sh to search for ./env/*-shared.properties in place of ./env/ssdt-*-shared.properties. ESS doesn't follow the same pattern for property file names.
author Marc Davis <marc.davis@mcoecn.org>
date Mon, 13 May 2024 13:28:30 -0400
parents 52c2ec5ddeb5
children
line wrap: on
line source
#!/bin/bash

projectDir=${1:-$PWD}
snapshot=${2?Must provide snapshot name to restore}

cd "$projectDir" || echo "Unable to change to project directory: $projectDir"

function prop {
  grep "${1}" .env/ssdt-document-store-shared.properties|cut -d'=' -f2
}

entityId=$(prop 'entityId' | tr -d '"')
repository="${entityId}_fs_backup"
certificate=${projectDir}/http_ca.crt
baseUrl="https://$(prop 'DOCUMENTSTORE_ELASTIC_HOST' | tr -d '"'):$(prop 'DOCUMENTSTORE_ELASTIC_PORT' | tr -d '"')"
elasticPassword=$(prop 'ELASTIC_PASSWORD' | tr -d '"')

curl --cacert "${certificate}" -s -u elastic:"${elasticPassword}" -X POST "${baseUrl}/_snapshot/${repository}/${snapshot}/_restore?pretty"