X-Git-Url: http://juplo.de/gitweb/?a=blobdiff_plain;f=README.sh;h=6be4b11879af0fdc8d4f5867145ccb4f22412fca;hb=refs%2Fheads%2Fsumup-adder--stored-offsets;hp=72f0c60db69f3c6e97e357b8522f01f1615e9e19;hpb=0ac94b34af644f6fa5a0556fc7e2bd322167c608;p=demos%2Fkafka%2Ftraining diff --git a/README.sh b/README.sh index 72f0c60..6be4b11 100755 --- a/README.sh +++ b/README.sh @@ -1,6 +1,6 @@ #!/bin/bash -IMAGE=juplo/endless-consumer:1.0-SNAPSHOT +IMAGE=juplo/sumup-adder:1.0-SNAPSHOT if [ "$1" = "cleanup" ] then @@ -9,14 +9,17 @@ then exit fi -docker-compose up -d zookeeper kafka cli +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 [[ $(docker image ls -q $IMAGE) == "" || "$1" = "build" ]] then - mvn install || exit + docker-compose rm -svf adder-1 adder-2 + mvn -D skipTests clean install || exit else echo "Using image existing images:" docker image ls $IMAGE @@ -25,22 +28,89 @@ 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 producer consumer -sleep 5 -docker-compose exec -T cli bash << 'EOF' -echo "Writing poison pill into topic test..." -# tag::poisonpill[] -echo 'BOOM!' | kafkacat -P -b kafka:9092 -t test -# end::poisonpill[] -EOF -while [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Consumer is still running..."; sleep 1; done -http -v :8081/actuator/health -echo "Restarting consumer" -http -v post :8081/start -while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer..."; sleep 1; done -while [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Consumer is still running..."; sleep 1; done -http -v :8081/actuator/health -http -v post :8081/actuator/shutdown -docker-compose stop producer -docker-compose ps -docker-compose logs --tail=100 consumer +docker-compose up -d gateway requests-1 requests-2 adder-1 adder-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 +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 + +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 + +docker-compose stop adder-1 +sleep 1 +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 + +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 + +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 + +docker-compose kill -s 9 adder-1 + +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