X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=README.sh;h=a2bb3ac015cf1f225db4ec924a69beaaaa056dcd;hb=b14b81051d1ada30098364f42b4939979a83aed1;hp=05178a3403379e5f3615e298b1da19007e24095e;hpb=40c2e597c8b695fe3d5e2675ce0c1a975b0065bd;p=demos%2Fkafka%2Ftraining diff --git a/README.sh b/README.sh index 05178a3..a2bb3ac 100755 --- a/README.sh +++ b/README.sh @@ -1,6 +1,6 @@ #!/bin/bash -IMAGE=juplo/sumup-adder:1.0-SNAPSHOT +IMAGE=juplo/sumup-adder-json:1.0-SNAPSHOT if [ "$1" = "cleanup" ] then @@ -9,6 +9,8 @@ then exit fi +docker-compose rm -svf adder-1 adder-2 +docker-compose rm -svf mongo docker-compose up -d zookeeper kafka-1 kafka-2 kafka-3 cli mongo express if [[ @@ -16,7 +18,7 @@ if [[ "$1" = "build" ]] then - docker-compose rm -svf adder + docker-compose rm -svf adder-1 adder-2 mvn clean install || exit else echo "Using image existing images:" @@ -26,21 +28,60 @@ fi 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 up setup -docker-compose up -d gateway requests adder +docker-compose up -d gateway requests-1 requests-2 while ! [[ $(http 0:8080/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for gateway..."; sleep 1; done -while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for requests..."; sleep 1; done -while ! [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for adder..."; sleep 1; done +while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for requests-1..."; sleep 1; done +while ! [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for requests-2..."; sleep 1; done -docker-compose up -d peter ute franz beate klaus uschi +docker-compose up -d adder-1 adder-2 -http -v :8082/results -sleep 3 -http -v :8082/results +while ! [[ $(http 0:8091/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for adder-1..."; sleep 1; done +while ! [[ $(http 0:8092/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for adder-2..."; sleep 1; done -docker-compose kill -s 9 adder +# tag::nachrichten[] +echo 6 | http -v :8080/peter +echo 6 | http -v :8080/klaus +# end::nachrichten[] -docker-compose up -d adder -sleep 3 -docker-compose kill -s 9 peter ute franz beate klaus uschi -http -v :8082/results +while [[ "$(http :8091/results | jq -r .)" == "{}" ]]; do echo "Waiting for some results to show up on adder-1..."; sleep 1; done +echo "Resultate für adder-1" +# tag::resultate[] +http -v :8091/results +# end::resultate[] + +while [[ "$(http :8092/results | jq -r .)" == "{}" ]]; do echo "Waiting for some results to show up on adder-2..."; sleep 1; done +echo "Resultate für adder-2" +# tag::resultate[] +http -v :8092/results +# end::resultate[] + +echo "Writing poison pill into topic out..." +# tag::poisonpill[] +echo 'BOOM!' | kafkacat -P -b :9092 -t out +# end::poisonpill[] + +sleep 5 +echo "Resultate & Status für adder-1" +http -v :8091/results +http -v :8091/actuator/health +echo "Resultate & Status für adder-2" +http -v :8092/results +http -v :8092/actuator/health + +echo "Restarting adder-1" +# tag::restart[] +http post :8091/start +# end::restart[] +echo "Restarting adder-2" +# tag::restart[] +http post :8092/start +# end::restart[] + +sleep 5 +echo "Resultate & Status für adder-1" +http -v :8091/results +http -v :8091/actuator/health +echo "Resultate & Status für adder-2" +http -v :8092/results +http -v :8092/actuator/health