-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathupgrade_single_node_journey.sh
executable file
·78 lines (57 loc) · 2.2 KB
/
upgrade_single_node_journey.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
set -e
source common.sh
export COMPOSE="apps/weaviate/docker-compose-single-voter-without-node-name.yml"
function restart() {
echo "Restarting node ..."
docker compose -f $COMPOSE kill weaviate-node-1
docker compose -f $COMPOSE up -d --force-recreate weaviate-node-1
wait_weaviate 8080
}
function validateObjects() {
echo "Validate objects ..."
( docker container rm -f cluster_healthy &>/dev/null )
( cd apps/upgrade-single-node/ && docker build --build-arg APP_NAME=cluster_healthy -t cluster_healthy . || true )
if docker run --network host -v "$PWD/workdir/:/workdir/data" --name cluster_healthy -t cluster_healthy; then
echo "All objects read with consistency level ONE".
else
docker compose -f $COMPOSE logs weaviate-node-1
exit 1
fi
}
echo "Building all required containers"
( cd apps/upgrade-single-node/ && docker build --build-arg APP_NAME=generator -t generator . )
( cd apps/upgrade-single-node/ && docker build --build-arg APP_NAME=importer -t importer . )
( cd apps/upgrade-single-node/ && docker build --build-arg APP_NAME=importer_additional -t importer_additional . )
rm -rf apps/weaviate/data* || true
rm -rf workdir
mkdir workdir
touch workdir/data.json
docker run --network host -v "$PWD/workdir/data.json:/workdir/data.json" --name generator -t generator
echo "Done generating."
echo "Starting Weaviate 1.25..."
export WEAVIATE_NODE_VERSION=1.25.0
docker compose -f $COMPOSE up -d weaviate-node-1
wait_weaviate 8080
# POST objects with consistency level ONE
docker run --network host -v "$PWD/workdir/data.json:/workdir/data.json" --name importer -t importer
# Read objects with consistency level ONE
validateObjects
echo "Upgrade Weaviate..."
export WEAVIATE_NODE_VERSION=$WEAVIATE_VERSION
docker compose -f $COMPOSE up -d --force-recreate weaviate-node-1
wait_weaviate 8080
# Read objects with consistency level ONE
validateObjects
restart
echo "Import additional objects"
if docker run --network host -v "$PWD/workdir/data.json:/workdir/data.json" --name importer_additional -t importer_additional; then
echo "All objects added with consistency level QUORUM with one node down".
else
exit 1
fi
validateObjects
restart
validateObjects
echo "Success!"
shutdown