From b14b81051d1ada30098364f42b4939979a83aed1 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 14 Sep 2022 20:12:51 +0200 Subject: [PATCH] =?utf8?q?README.sh=20f=C3=BChrt=20Poison-Pill-=C3=9Cbung?= =?utf8?q?=20vor?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- README.sh | 111 ++++++++++++++++++++---------------------------------- 1 file changed, 41 insertions(+), 70 deletions(-) diff --git a/README.sh b/README.sh index 34a35ef..a2bb3ac 100755 --- a/README.sh +++ b/README.sh @@ -28,89 +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-1 requests-2 adder-1 adder-2 +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-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 adder-1 adder-2 + 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 up -d peter klaus +# tag::nachrichten[] +echo 6 | http -v :8080/peter +echo 6 | http -v :8080/klaus +# end::nachrichten[] while [[ "$(http :8091/results | jq -r .)" == "{}" ]]; do echo "Waiting for some results to show up on adder-1..."; sleep 1; done -http -v --pretty none -S :8091/results -echo -while [[ "$(http :8092/results | jq -r .)" == "{}" ]]; do echo "Waiting for some results to show up on adder-2..."; sleep 1; done -http -v --pretty none -S :8092/results -echo -sleep 3 echo "Resultate für adder-1" -http -v --pretty none -S :8091/results -echo -echo "Resultate für peter von adder-1" -http :8091/results/peter | jq .[].sum | uniq -echo "Resultate für klaus von adder-1" -http :8091/results/klaus | jq .[].sum | uniq -echo "Resultate für adder-2" -http -v --pretty none -S :8092/results -echo -echo "Resultate für peter von adder-2" -http :8092/results/peter | jq .[].sum | uniq -echo "Resultate für klaus von adder-2" -http :8092/results/klaus | jq .[].sum | uniq +# tag::resultate[] +http -v :8091/results +# end::resultate[] -docker-compose stop adder-1 -sleep 1 +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" -http -v --pretty none -S :8092/results -echo -echo "Resultate für peter von adder-2" -http :8092/results/peter | jq .[].sum | uniq -echo "Resultate für klaus von adder-2" -http :8092/results/klaus | jq .[].sum | uniq +# tag::resultate[] +http -v :8092/results +# end::resultate[] -docker-compose stop adder-2 -docker-compose start adder-1 -while ! [[ $(http 0:8091/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for adder-1..."; sleep 1; done -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" -http -v --pretty none -S :8091/results -echo -echo "Resultate für peter von adder-1" -http :8091/results/peter | jq .[].sum | uniq -echo "Resultate für klaus von adder-1" -http :8091/results/klaus | jq .[].sum | uniq +echo "Writing poison pill into topic out..." +# tag::poisonpill[] +echo 'BOOM!' | kafkacat -P -b :9092 -t out +# end::poisonpill[] -docker-compose start adder-2 -while ! [[ $(http 0:8092/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for adder-2..."; sleep 1; done -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-1" -http -v --pretty none -S :8091/results -echo -echo "Resultate für adder-2" -http -v --pretty none -S :8092/results -echo -echo "Resultate für peter von adder-1" -http :8091/results/peter | jq .[].sum | uniq -echo "Resultate für klaus von adder-1" -http :8091/results/klaus | jq .[].sum | uniq -echo "Resultate für peter von adder-2" -http :8092/results/peter | jq .[].sum | uniq -echo "Resultate für klaus von adder-2" -http :8092/results/klaus | jq .[].sum | uniq +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 -docker-compose kill -s 9 adder-1 +echo "Restarting adder-1" +# tag::restart[] +http post :8091/start +# end::restart[] +echo "Restarting adder-2" +# tag::restart[] +http post :8092/start +# end::restart[] -docker-compose start adder-1 -while ! [[ $(http 0:8091/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for adder-1..."; sleep 1; done -while [[ "$(http :8091/results | jq -r .)" == "{}" ]]; do echo "Waiting for some results to show up on adder-1..."; sleep 1; done -docker-compose kill -s 9 peter klaus -echo "Resultate für peter von adder-1" -http :8091/results/peter | jq .[].sum | uniq -echo "Resultate für klaus von adder-1" -http :8091/results/klaus | jq .[].sum | uniq -echo "Resultate für peter von adder-2" -http :8092/results/peter | jq .[].sum | uniq -echo "Resultate für klaus von adder-2" -http :8092/results/klaus | jq .[].sum | uniq +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 -- 2.20.1