Skip to content

Commit

Permalink
updated weaviate backup script
Browse files Browse the repository at this point in the history
  • Loading branch information
bigabig committed Nov 27, 2024
1 parent 393815d commit cd41750
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion bin/backup-weaviate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,22 @@ fi
cd docker || exit

BACKUP_NAME="backup_$(date +%Y_%m_%d_%H_%M)"

# 1) Start backup process
docker compose -f compose.yml -f compose.production.yml exec -i weaviate sh -c "wget --header='Content-Type: application/json' --post-data='{
\"id\": \"$BACKUP_NAME\"
}' -O- http://localhost:8080/v1/backups/filesystem"
echo "Weaviate data backup created successfully with ID: $BACKUP_NAME."
echo "Started weaviate data backup with ID: $BACKUP_NAME."

sleep 10

# 2) Check status of the backup operation in a loop
while true; do
STATUS=$(docker compose -f compose.yml -f compose.production.yml exec -i weaviate sh -c "wget -qO- http://localhost:8080/v1/backups/filesystem/$BACKUP_NAME | grep -o '\"status\":\"[^\"]*\"' | awk -F':' '{print $2}' | tr -d '\"'")
echo "$STATUS"
if [ "$STATUS" = "status:SUCCESS" ] || [ "$STATUS" = "status:FAILED" ]; then
break
fi
sleep 10
done
echo "Weaviate data backup $BACKUP_NAME completed with $STATUS"

0 comments on commit cd41750

Please sign in to comment.