3 FORTUNE=juplo/wordcount--fortune:1.0.0
4 RECORDER=juplo/wordcount--recorder:1.2.0
5 USERS=juplo/wordcount--users:1.0.5
6 SPLITTER=juplo/wordcount--splitter:1.2.0
7 COUNTER=juplo/wordcount--counter:1.3.0
8 TOP10=juplo/wordcount--top10:1.2.1
9 QUERY=juplo/wordcount--query:2.0.0
10 POPULAR=juplo/wordcount--popular:1.0.0
12 if [ "$1" = "cleanup" ]
14 docker compose down -v --remove-orphans
15 docker image rm $FORTUNE
16 docker image rm $RECORDER
17 docker image rm $USERS
18 docker image rm $SPLITTER
19 docker image rm $COUNTER
20 docker image rm $TOP10
21 docker image rm $QUERY
22 docker image rm $POPULAR
27 $(docker image ls -q $FORTUNE) == "" ||
28 $(docker image ls -q $RECORDER) == "" ||
29 $(docker image ls -q $USERS) == "" ||
30 $(docker image ls -q $SPLITTER) == "" ||
31 $(docker image ls -q $COUNTER) == "" ||
32 $(docker image ls -q $TOP10) == "" ||
33 $(docker image ls -q $QUERY) == "" ||
34 $(docker image ls -q $POPULAR) == "" ||
38 mvn clean package || exit
39 docker compose rm -svf recorder users splitter counter top10 query popular
40 ( cd fortune; ./README.sh $FORTUNE; )
41 mvn -f recorder/pom.xml docker:build
42 mvn -f users/pom.xml docker:build
43 mvn -f splitter/pom.xml docker:build
44 mvn -f counter/pom.xml docker:build
45 mvn -f top10/pom.xml docker:build
46 mvn -f query/pom.xml docker:build
47 mvn -f popular/pom.xml docker:build
49 echo "Using existing images:"
50 docker image ls $FORTUNE
51 docker image ls $RECORDER
52 docker image ls $USERS
53 docker image ls $SPLITTER
54 docker image ls $COUNTER
55 docker image ls $TOP10
56 docker image ls $QUERY
57 docker image ls $POPULAR
61 docker compose up setup
63 echo "Starting the service 'users'..."
64 docker compose up -d users
65 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
66 http -v post users.localhost username=bart firstName=Bart lastName=Simpson sex=MALE
67 http -v post users.localhost username=nerd firstName=Jane lastName=Doe sex=FEMALE
68 http -v post users.localhost username=riddler firstName=Rumpel lastName=Stilzchen sex=MALE
70 echo "Starting the other instances..."
71 docker compose up -d recorder
72 docker compose up -d splitter
73 docker compose up -d counter
74 docker compose up -d top10
75 docker compose up -d query
77 echo "Starting the simulated users..."
78 docker compose up -d bart nerd riddler
80 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
81 http -v query.localhost/bart
83 http -v query.localhost/bart
85 http -v query.localhost/bart
87 http -v query.localhost/bart
89 http -v query.localhost/bart
91 http -v query.localhost/bart
93 http -v query.localhost/bart
94 http -v query.localhost/nerd
95 http -v query.localhost/riddler
97 # docker compose up -d --scale query=5 query
98 http -v --follow query.localhost/bart
100 http -v --follow query.localhost/bart
102 http -v --follow query.localhost/bart
104 http -v --follow query.localhost/bart
106 http -v --follow query.localhost/bart
108 http -v --follow query.localhost/bart
110 http -v --follow query.localhost/bart
112 http -v --follow query.localhost/nerd
113 http -v --follow query.localhost/nerd
114 http -v --follow query.localhost/nerd
115 http -v --follow query.localhost/nerd
116 http -v --follow query.localhost/nerd
118 http -v --follow query.localhost/riddler
119 http -v --follow query.localhost/riddler
120 http -v --follow query.localhost/riddler
121 http -v --follow query.localhost/riddler
122 http -v --follow query.localhost/riddler