X-Git-Url: http://juplo.de/gitweb/?a=blobdiff_plain;f=README.sh;h=fbd0331df1db409a42b1695179a91f7a80be1e05;hb=3d56a3162806ba0293d1f0cb31da43453f68e643;hp=2a1e5d864719f10d0875f18b14a11f97793b4493;hpb=657bf71b6c1c99065f26cccf0c3d2a1f30bc9407;p=demos%2Fkafka%2Ftraining diff --git a/README.sh b/README.sh index 2a1e5d8..fbd0331 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,44 +28,49 @@ 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 +docker-compose up -d gateway requests-1 requests-2 adder-1 adder-2 -while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer-1..."; sleep 1; done -while ! [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer-2..."; sleep 1; done -while ! [[ $(http 0:8083/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer-3..."; sleep 1; done -while ! [[ $(http 0:8084/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer-4..."; sleep 1; done -while ! [[ $(http 0:8085/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer-5..."; sleep 1; done +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 -sleep 5 +# tag::nachrichten[] +echo 6 | http -v :8080/peter +echo 6 | http -v :8080/klaus +# end::nachrichten[] -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 :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 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "consumer-1 is still running..."; sleep 1; done -while [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "consumer-2 is still running..."; sleep 1; done -while [[ $(http 0:8083/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "consumer-3 is still running..."; sleep 1; done -while [[ $(http 0:8084/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "consumer-4 is still running..."; sleep 1; done -while [[ $(http 0:8085/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "consumer-5 is still running..."; 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-2" +# tag::resultate[] +http -v :8092/results +# end::resultate[] -http -v :8081/actuator/health -echo "Restarting consumer-1" -http -v post :8081/start +docker-compose stop adder-1 -echo "Waiting for consumer-1 to come up" -while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for consumer-1..."; sleep 1; done -http -v :8081/actuator/health +echo 66 | http -v :8080/peter +echo 66 | http -v :8080/klaus +sleep 1 +echo "Resultate für adder-2" +http -v :8092/results -echo "Waiting for consumer-1 to crash" -while [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "consumer-1 is still running..."; sleep 1; done -http -v :8081/actuator/health - -docker-compose stop producer -docker-compose logs --tail=10 consumer-1 -docker-compose logs --tail=10 consumer-2 -docker-compose logs --tail=10 consumer-3 -docker-compose logs --tail=10 consumer-4 -docker-compose logs --tail=10 consumer-5 +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..."; + echo 666 | http -v :8080/peter + echo 666 | http -v :8080/klaus + sleep 1; +done +echo "Resultate für adder-1" +http -v :8091/results +echo "Resultate für adder-2" +http -v :8092/results