-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbackup_and_restore_multi_node_out_of_sync.sh
executable file
·51 lines (38 loc) · 1.44 KB
/
backup_and_restore_multi_node_out_of_sync.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# This pipeline is based on the following scenario: https://semi-technology.atlassian.net/browse/WEAVIATE-737
# which caused a disruptive issue in one of our customers' production environment.
set -e
function wait_weaviate_cluster() {
echo "Wait for Weaviate to be ready"
local node1_ready=false
local node2_ready=false
for _ in {1..120}; do
if curl -sf -o /dev/null localhost:8080/v1/.well-known/ready; then
echo "Weaviate node1 is ready"
node1_ready=true
fi
if curl -sf -o /dev/null localhost:8081; then
echo "Weaviate node2 is ready"
node2_ready=true
fi
if $node1_ready && $node2_ready; then
break
fi
echo "Weaviate cluster is not ready, trying again in 1s"
sleep 1
done
}
echo "Building all required containers"
( cd apps/backup_and_restore_out_of_sync/ && docker build -t backup_and_restore_out_of_sync \
--build-arg backend="s3" . )
export WEAVIATE_NODE_1_VERSION=$WEAVIATE_VERSION
export WEAVIATE_NODE_2_VERSION=$WEAVIATE_VERSION
export COMPOSE="apps/weaviate/docker-compose-backup.yml"
echo "Starting Weaviate..."
docker compose -f $COMPOSE up -d weaviate-node-1 weaviate-node-2 backup-s3
wait_weaviate_cluster
echo "Creating S3 bucket..."
docker compose -f $COMPOSE up create-s3-bucket
echo "Run multi-node backup and restore which affects schema"
docker run --network host -t backup_and_restore_out_of_sync python3 backup_and_restore_out_of_sync.py
echo "Passed!"