Enabled up/down-scaling of the services
[demos/kafka/wordcount] / README.sh
index 993701a..4b5f557 100755 (executable)
--- a/README.sh
+++ b/README.sh
@@ -1,11 +1,11 @@
 #!/bin/bash
 
 FORTUNE=juplo/wordcount--fortune:1.0.0
-RECORDER=juplo/wordcount--recorder:1.0.0
-USERS=juplo/wordcount--users:1.0.2
-COUNTER=juplo/wordcount--counter:1.0.0
-TOP10=juplo/wordcount--top10:1.0.0
-QUERY=juplo/wordcount--query:1.0.2
+RECORDER=juplo/wordcount--recorder:1.0.1
+USERS=juplo/wordcount--users:1.0.4
+COUNTER=juplo/wordcount--counter:1.0.1
+TOP10=juplo/wordcount--top10:1.0.1
+QUERY=juplo/wordcount--query:1.0.4
 
 if [ "$1" = "cleanup" ]
 then
@@ -48,34 +48,61 @@ else
 fi
 
 
-docker-compose up -d zookeeper kafka cli
+docker-compose up -d zookeeper kafka cli traefik
 
 echo "Waiting for the Kafka-Cluster to become ready..."
 docker-compose exec cli cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1
 docker-compose exec cli zookeeper-shell zookeeper:2181 ls /brokers/ids
 
 docker-compose up -d users
-while [ "$(http :8082/actuator/health | jq -r .status 2> /dev/null)" != "UP" ]; do echo "Waiting for service users..."; sleep 1; done
-http -v post :8082 username=bart firstName=Bart lastName=Simpson sex=MALE
-http -v post :8082 username=nerd firstName=Jane lastName=Doe sex=FEMALE
-http -v post :8082 username=riddler firstName=Rumpel lastName=Stilzchen sex=MALE
+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
+http -v post users.localhost username=bart firstName=Bart lastName=Simpson sex=MALE
+http -v post users.localhost username=nerd firstName=Jane lastName=Doe sex=FEMALE
+http -v post users.localhost username=riddler firstName=Rumpel lastName=Stilzchen sex=MALE
 
 echo "Starting all instances..."
 docker-compose up -d
 
-while [ "$(http :8085/actuator/health 2>/dev/null | jq -r .status)" != "UP" ]; do echo "Waiting for service query..."; sleep 1; done
-http -v :8085/bart
+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
+http -v query.localhost/bart
 sleep 1
-http -v :8085/bart
+http -v query.localhost/bart
 sleep 1
-http -v :8085/bart
+http -v query.localhost/bart
 sleep 1
-http -v :8085/bart
+http -v query.localhost/bart
 sleep 1
-http -v :8085/bart
+http -v query.localhost/bart
 sleep 1
-http -v :8085/bart
+http -v query.localhost/bart
 sleep 1
-http -v :8085/bart
-http -v :8085/nerd
-http -v :8085/riddler
+http -v query.localhost/bart
+http -v query.localhost/nerd
+http -v query.localhost/riddler
+
+docker-compose up -d --scale query=5 query
+http -v --follow query.localhost/bart
+sleep 1
+http -v --follow query.localhost/bart
+sleep 1
+http -v --follow query.localhost/bart
+sleep 1
+http -v --follow query.localhost/bart
+sleep 1
+http -v --follow query.localhost/bart
+sleep 1
+http -v --follow query.localhost/bart
+sleep 1
+http -v --follow query.localhost/bart
+
+http -v --follow query.localhost/nerd
+http -v --follow query.localhost/nerd
+http -v --follow query.localhost/nerd
+http -v --follow query.localhost/nerd
+http -v --follow query.localhost/nerd
+
+http -v --follow query.localhost/riddler
+http -v --follow query.localhost/riddler
+http -v --follow query.localhost/riddler
+http -v --follow query.localhost/riddler
+http -v --follow query.localhost/riddler