X-Git-Url: http://juplo.de/gitweb/?a=blobdiff_plain;f=README.sh;h=3dc3476763008cb89a6afbd47bcd615b09483fb7;hb=f3970d2c3b1b6905d9b04f95cf61d83a189fa55c;hp=8b568c9537e2f6086e44052c1d18447bdb928339;hpb=50da4f6f74a8f4f567b7af8556480f81256c61dc;p=demos%2Fkafka%2Ftraining diff --git a/README.sh b/README.sh index 8b568c9..3dc3476 100755 --- a/README.sh +++ b/README.sh @@ -4,96 +4,40 @@ IMAGE=juplo/rest-producer:1.0-SNAPSHOT if [ "$1" = "cleanup" ] then - docker-compose down -v + docker-compose down -v --remove-orphans mvn clean exit fi -docker-compose up -d zookeeper kafka cli +docker-compose up -d kafka-1 kafka-2 kafka-3 cli +docker-compose rm -svf producer if [[ $(docker image ls -q $IMAGE) == "" || "$1" = "build" ]] then - mvn install || exit + mvn clean install || exit else echo "Using image existing images:" docker image ls $IMAGE 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 ps +docker-compose up -d producer -docker-compose up -d +while ! [[ $(http 0:8080/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for producer..."; sleep 1; done -sleep 15 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen +# tag::success[] +echo -n 'Hallo Welt!' | http -v :8080/foo +# end::success[] -http post :8081/stop -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen +# tag::failure[] +dd if=/dev/zero bs=1024 count=1024 | http -v :8080/bar +# end::failure[] -http post :8081/start - -sleep 1 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen -sleep 1 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen -sleep 1 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen -sleep 1 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen -sleep 1 -http :8081/status -http :8082/status -http :8083/status -http :8084/status -http :8085/status -http :8000/seen - -http post :8081/stop -http :8081/status -http post :8082/stop -http :8082/status -http post :8083/stop -http :8083/status -http post :8084/stop -http :8084/status -http post :8085/stop -http :8085/status - -http :8000/seen -http post :8000/stop - -docker-compose logs producer +# tag::timeout[] +docker-compose stop kafka-1 kafka-2 kafka-3 +echo -n 'Hallo again...' | http -v --timeout 30 :8080/foo +# end::timeout[]