Skip to content
Merged
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
15 changes: 14 additions & 1 deletion infrastructure/backups/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,21 @@ docker run --rm \
echo ""
echo "Delete all currently existing snapshots"
echo ""
# Get list of snapshots as a simple array
snapshots=$(docker run --rm --network="$NETWORK" appropriate/curl \
-s "http://$(elasticsearch_host)/_snapshot/ocrvs/_all" | jq -r '.snapshots[].snapshot' || true)
echo "Found snapshots:"
echo "$snapshots" | sed 's/^/ - /'

for snap in $snapshots; do
echo "Deleting snapshot: $snap"
docker run --rm --network="$NETWORK" appropriate/curl \
-s -X DELETE -H "Content-Type: application/json;charset=UTF-8" \
"http://$(elasticsearch_host)/_snapshot/ocrvs/${snap}?wait_for_completion=true&pretty"
done
docker run --rm --network=$NETWORK appropriate/curl curl -sS -X DELETE -H "Content-Type: application/json;charset=UTF-8" "http://$(elasticsearch_host)/_snapshot/ocrvs"

echo "Waiting for snapshots to be removed"
sleep 30
Comment on lines +236 to +237
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do better by waiting until the snapshot is deleted? using an API call

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no way to validate result of execution.

We can check filesystem, but that is a bit over-engineering.
For me it's a bit weird this issue didn't happen before.

#-------------------------------------------------------------------------------------
echo ""
echo "Register backup folder as an Elasticsearch repository for backing up the search data"
Expand Down
Loading