3 FORTUNE=juplo/wordcount--fortune:1.0.0
4 RECORDER=juplo/wordcount--recorder:1.0.1
5 USERS=juplo/wordcount--users:1.0.4
6 COUNTER=juplo/wordcount--counter:1.0.1
7 TOP10=juplo/wordcount--top10:1.0.1
8 QUERY=juplo/wordcount--query:1.0.4
10 if [ "$1" = "cleanup" ]
12 docker-compose down -v --remove-orphans
13 docker image rm $FORTUNE
14 docker image rm $RECORDER
15 docker image rm $USERS
16 docker image rm $COUNTER
17 docker image rm $TOP10
18 docker image rm $QUERY
23 $(docker image ls -q $FORTUNE) == "" ||
24 $(docker image ls -q $RECORDER) == "" ||
25 $(docker image ls -q $USERS) == "" ||
26 $(docker image ls -q $COUNTER) == "" ||
27 $(docker image ls -q $TOP10) == "" ||
28 $(docker image ls -q $QUERY) == "" ||
32 mvn clean package || exit
33 docker-compose rm -svf recorder users counter top10 query
34 ( cd fortune; ./README.sh $FORTUNE; )
35 mvn -f recorder/pom.xml docker:build
36 mvn -f users/pom.xml docker:build
37 mvn -f counter/pom.xml docker:build
38 mvn -f top10/pom.xml docker:build
39 mvn -f query/pom.xml docker:build
41 echo "Using existing images:"
42 docker image ls $FORTUNE
43 docker image ls $RECORDER
44 docker image ls $USERS
45 docker image ls $COUNTER
46 docker image ls $TOP10
47 docker image ls $QUERY
51 docker-compose up -d zookeeper kafka cli traefik
53 echo "Waiting for the Kafka-Cluster to become ready..."
54 docker-compose exec cli cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1
55 docker-compose exec cli zookeeper-shell zookeeper:2181 ls /brokers/ids
57 docker-compose up -d users
58 while [ "$(http users.localhost/actuator/health 2> /dev/null | jq -r .status 2> /dev/null)" != "UP" ]; do echo "Waiting for service users..."; sleep 1; done
59 http -v post users.localhost username=bart firstName=Bart lastName=Simpson sex=MALE
60 http -v post users.localhost username=nerd firstName=Jane lastName=Doe sex=FEMALE
61 http -v post users.localhost username=riddler firstName=Rumpel lastName=Stilzchen sex=MALE
63 echo "Starting all instances..."
66 while [ "$(http query.localhost/actuator/health 2>/dev/null | jq -r .status 2> /dev/null)" != "UP" ]; do echo "Waiting for service query..."; sleep 1; done
67 http -v query.localhost/bart
69 http -v query.localhost/bart
71 http -v query.localhost/bart
73 http -v query.localhost/bart
75 http -v query.localhost/bart
77 http -v query.localhost/bart
79 http -v query.localhost/bart
80 http -v query.localhost/nerd
81 http -v query.localhost/riddler
83 docker-compose up -d --scale query=5 query
84 http -v --follow query.localhost/bart
86 http -v --follow query.localhost/bart
88 http -v --follow query.localhost/bart
90 http -v --follow query.localhost/bart
92 http -v --follow query.localhost/bart
94 http -v --follow query.localhost/bart
96 http -v --follow query.localhost/bart
98 http -v --follow query.localhost/nerd
99 http -v --follow query.localhost/nerd
100 http -v --follow query.localhost/nerd
101 http -v --follow query.localhost/nerd
102 http -v --follow query.localhost/nerd
104 http -v --follow query.localhost/riddler
105 http -v --follow query.localhost/riddler
106 http -v --follow query.localhost/riddler
107 http -v --follow query.localhost/riddler
108 http -v --follow query.localhost/riddler