3 FORTUNE=juplo/wordcount--fortune:1.0.1
4 RECORDER=juplo/wordcount--recorder:1.2.2
5 USERS=juplo/wordcount--users:1.0.7
6 SPLITTER=juplo/wordcount--splitter:1.2.2
7 COUNTER=juplo/wordcount--counter:1.4.2
8 TOP10=juplo/wordcount--top10:1.4.2
9 QUERY=juplo/wordcount--query:2.1.2
10 POPULAR=juplo/wordcount--popular:1.3.2
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 docker compose rm -svf bart riddler nerd recorder users splitter counter top10 query popular
41 if [[ $(docker image ls -q $FORTUNE) == "" || "$1" = "build" ]]
43 echo "Building image $FORTUNE"
44 ( cd fortune; ./README.sh $FORTUNE; )
46 echo -n "Using existing image for $FORTUNE: "
47 docker image ls --format json $FORTUNE | jq -r '(.ID + " - " + .CreatedSince)'
50 if [[ $(docker image ls -q $RECORDER) == "" || "$1" = "build" ]]
52 echo "Building image $RECORDER"
53 mvn -f recorder/pom.xml clean package docker:build
55 echo -n "Using existing image for $RECORDER: "
56 docker image ls --format json $RECORDER | jq -r '(.ID + " - " + .CreatedSince)'
59 if [[ $(docker image ls -q $USERS) == "" || "$1" = "build" ]]
61 echo "Building image $USERS"
62 mvn -f users/pom.xml clean package docker:build
64 echo -n "Using existing image for $USERS: "
65 docker image ls --format json $USERS | jq -r '(.ID + " - " + .CreatedSince)'
68 if [[ $(docker image ls -q $SPLITTER) == "" || "$1" = "build" ]]
70 echo "Building image $SPLITTER"
71 mvn -f splitter/pom.xml clean package docker:build
73 echo -n "Using existing image for $SPLITTER: "
74 docker image ls --format json $SPLITTER | jq -r '(.ID + " - " + .CreatedSince)'
77 if [[ $(docker image ls -q $COUNTER) == "" || "$1" = "build" ]]
79 echo "Building image $COUNTER"
80 mvn -f counter/pom.xml clean package docker:build
82 echo -n "Using existing image for $COUNTER: "
83 docker image ls --format json $COUNTER | jq -r '(.ID + " - " + .CreatedSince)'
86 if [[ $(docker image ls -q $TOP10) == "" || "$1" = "build" ]]
88 echo "Building image $TOP10"
89 mvn -f top10/pom.xml clean package docker:build
91 echo -n "Using existing image for $TOP10: "
92 docker image ls --format json $TOP10 | jq -r '(.ID + " - " + .CreatedSince)'
95 if [[ $(docker image ls -q $QUERY) == "" || "$1" = "build" ]]
97 echo "Building image $QUERY"
98 mvn -f query/pom.xml clean package docker:build
100 echo -n "Using existing image for $QUERY: "
101 docker image ls --format json $QUERY | jq -r '(.ID + " - " + .CreatedSince)'
104 if [[ $(docker image ls -q $POPULAR) == "" || "$1" = "build" ]]
106 echo "Building image $POPULAR"
107 mvn -f popular/pom.xml clean package docker:build
109 echo -n "Using existing image for $POPULAR: "
110 docker image ls --format json $POPULAR | jq -r '(.ID + " - " + .CreatedSince)'
114 docker compose up setup
116 echo "Starting the service 'users'..."
117 docker compose up -d users
118 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
119 http -v post users.localhost username=bart firstName=Bart lastName=Simpson sex=MALE
120 http -v post users.localhost username=nerd firstName=Jane lastName=Doe sex=FEMALE
121 http -v post users.localhost username=riddler firstName=Rumpel lastName=Stilzchen sex=MALE
123 echo "Starting the other instances..."
124 docker compose up -d recorder
125 docker compose up -d splitter
126 docker compose up -d counter
127 docker compose up -d top10
128 docker compose up -d query
130 echo "Starting the simulated users..."
131 docker compose up -d bart nerd riddler
133 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
134 http -v query.localhost/bart
136 http -v query.localhost/bart
138 http -v query.localhost/bart
140 http -v query.localhost/bart
142 http -v query.localhost/bart
144 http -v query.localhost/bart
146 http -v query.localhost/bart
147 http -v query.localhost/nerd
148 http -v query.localhost/riddler
150 # docker compose up -d --scale query=5 query
151 http -v --follow query.localhost/bart
153 http -v --follow query.localhost/bart
155 http -v --follow query.localhost/bart
157 http -v --follow query.localhost/bart
159 http -v --follow query.localhost/bart
161 http -v --follow query.localhost/bart
163 http -v --follow query.localhost/bart
165 http -v --follow query.localhost/nerd
166 http -v --follow query.localhost/nerd
167 http -v --follow query.localhost/nerd
168 http -v --follow query.localhost/nerd
169 http -v --follow query.localhost/nerd
171 http -v --follow query.localhost/riddler
172 http -v --follow query.localhost/riddler
173 http -v --follow query.localhost/riddler
174 http -v --follow query.localhost/riddler
175 http -v --follow query.localhost/riddler