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 SPLITTER=juplo/wordcount--splitter:1.0.0
7 COUNTER=juplo/wordcount--counter:1.1.0
8 TOP10=juplo/wordcount--top10:1.0.1
9 QUERY=juplo/wordcount--query:1.0.4
11 if [ "$1" = "cleanup" ]
13 docker compose down -v --remove-orphans
14 docker image rm $FORTUNE
15 docker image rm $RECORDER
16 docker image rm $USERS
17 docker image rm $SPLITTER
18 docker image rm $COUNTER
19 docker image rm $TOP10
20 docker image rm $QUERY
25 $(docker image ls -q $FORTUNE) == "" ||
26 $(docker image ls -q $RECORDER) == "" ||
27 $(docker image ls -q $USERS) == "" ||
28 $(docker image ls -q $SPLITTER) == "" ||
29 $(docker image ls -q $COUNTER) == "" ||
30 $(docker image ls -q $TOP10) == "" ||
31 $(docker image ls -q $QUERY) == "" ||
35 mvn clean package || exit
36 docker compose rm -svf recorder users splitter counter top10 query
37 ( cd fortune; ./README.sh $FORTUNE; )
38 mvn -f recorder/pom.xml docker:build
39 mvn -f users/pom.xml docker:build
40 mvn -f splitter/pom.xml docker:build
41 mvn -f counter/pom.xml docker:build
42 mvn -f top10/pom.xml docker:build
43 mvn -f query/pom.xml docker:build
45 echo "Using existing images:"
46 docker image ls $FORTUNE
47 docker image ls $RECORDER
48 docker image ls $USERS
49 docker image ls $SPLITTER
50 docker image ls $COUNTER
51 docker image ls $TOP10
52 docker image ls $QUERY
56 docker compose up setup
58 echo "Starting the service 'users'..."
59 docker compose up -d users
60 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
61 http -v post users.localhost username=bart firstName=Bart lastName=Simpson sex=MALE
62 http -v post users.localhost username=nerd firstName=Jane lastName=Doe sex=FEMALE
63 http -v post users.localhost username=riddler firstName=Rumpel lastName=Stilzchen sex=MALE
65 echo "Starting the other instances..."
66 docker compose up -d recorder
67 docker compose up -d splitter
68 docker compose up -d counter
69 docker compose up -d top10
70 docker compose up -d query
72 echo "Starting the simulated users..."
73 docker compose up -d bart nerd riddler
75 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
76 http -v query.localhost/bart
78 http -v query.localhost/bart
80 http -v query.localhost/bart
82 http -v query.localhost/bart
84 http -v query.localhost/bart
86 http -v query.localhost/bart
88 http -v query.localhost/bart
89 http -v query.localhost/nerd
90 http -v query.localhost/riddler
92 // docker compose up -d --scale query=5 query
93 http -v --follow query.localhost/bart
95 http -v --follow query.localhost/bart
97 http -v --follow query.localhost/bart
99 http -v --follow query.localhost/bart
101 http -v --follow query.localhost/bart
103 http -v --follow query.localhost/bart
105 http -v --follow query.localhost/bart
107 http -v --follow query.localhost/nerd
108 http -v --follow query.localhost/nerd
109 http -v --follow query.localhost/nerd
110 http -v --follow query.localhost/nerd
111 http -v --follow query.localhost/nerd
113 http -v --follow query.localhost/riddler
114 http -v --follow query.localhost/riddler
115 http -v --follow query.localhost/riddler
116 http -v --follow query.localhost/riddler
117 http -v --follow query.localhost/riddler