Mercurial > public > ssdt-docker
annotate scripts/restore-document-store.sh @ 478:8b3b95d8167d
USASR-5154 check version
author | belknapSSDT <zach.belknap@mcoecn.org> |
---|---|
date | Thu, 28 Sep 2023 15:59:30 -0400 |
parents | 52c2ec5ddeb5 |
children |
rev | line source |
---|---|
424
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
1 #!/bin/bash |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
2 |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
3 projectDir=${1:-$PWD} |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
4 snapshot=${2?Must provide snapshot name to restore} |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
5 |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
6 cd "$projectDir" || echo "Unable to change to project directory: $projectDir" |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
7 |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
8 function prop { |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
9 grep "${1}" .env/ssdt-document-store-shared.properties|cut -d'=' -f2 |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
10 } |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
11 |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
12 entityId=$(prop 'entityId' | tr -d '"') |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
13 repository="${entityId}_fs_backup" |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
14 certificate=${projectDir}/http_ca.crt |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
15 baseUrl="https://$(prop 'DOCUMENTSTORE_ELASTIC_HOST' | tr -d '"'):$(prop 'DOCUMENTSTORE_ELASTIC_PORT' | tr -d '"')" |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
16 elasticPassword=$(prop 'ELASTIC_PASSWORD' | tr -d '"') |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
17 |
52c2ec5ddeb5
DS-54: add backup, restore, and list snapshots scripts for document store
Robin Fronk <robin.fronk@mcoecn.org>
parents:
diff
changeset
|
18 curl --cacert "${certificate}" -s -u elastic:"${elasticPassword}" -X POST "${baseUrl}/_snapshot/${repository}/${snapshot}/_restore?pretty" |