-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathreplication_importing_while_crashing.sh
executable file
·55 lines (45 loc) · 1.26 KB
/
replication_importing_while_crashing.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
#!/bin/bash
set -e
source common.sh
SIZE=300000
echo "Building all required containers"
( cd apps/replicated-import/ && docker build -t importer . )
( cd apps/chaotic-cluster-killer/ && docker build -t killer . )
export COMPOSE="apps/weaviate/docker-compose-replication.yml"
echo "Starting Weaviate..."
docker compose -f $COMPOSE up -d weaviate-node-1 weaviate-node-2 weaviate-node-3
wait_weaviate 8080
wait_weaviate 8081
wait_weaviate 8082
echo "Import schema"
if ! docker run \
-e 'ORIGIN=http://localhost:8080' \
--network host \
--rm \
--name importer \
-t importer python3 run.py --action schema; then
echo "Could not apply schema"
exit 1
fi
echo "Starting the chaos script to kill Weaviate periodically (in the background)"
docker run \
--network host \
--rm -t -d \
-e "WEAVIATE_VERSION=$WEAVIATE_VERSION" \
-v "$PWD:$PWD" \
-w "$PWD" \
-v /var/run/docker.sock:/var/run/docker.sock \
--name killer \
killer
echo "Run import script in foreground..."
if ! docker run \
-e 'ORIGIN=http://localhost:8080' \
--network host \
-t importer python3 run.py --action import; then
echo "Importer failed, printing latest Weaviate logs..."
exit 1
fi
echo "Import completed successfully, stop killer"
docker rm -f killer
echo "Passed!"
shutdown