X-Git-Url: https://juplo.de/gitweb/?p=demos%2Fkafka%2Fwordcount;a=blobdiff_plain;f=README.sh;h=4b5f5570703f36e7286d5c5d65943bf95be4f248;hp=6b0e56684232618ba6fb51e0d7b9ce5a1ab5a3ad;hb=086b22008598b03c5ba94d58cd3d1d022f6eb73e;hpb=1d411b51a909a5b7b15f76705b61f3fc09505d22 diff --git a/README.sh b/README.sh index 6b0e566..4b5f557 100755 --- a/README.sh +++ b/README.sh @@ -1,14 +1,18 @@ #!/bin/bash -RECORDER=juplo/wordcount--recorder:1.0.0 -COUNTER=juplo/wordcount--counter:1.0.0 -TOP10=juplo/wordcount--top10:1.0.0 -QUERY=juplo/wordcount--query:1.0.0 +FORTUNE=juplo/wordcount--fortune:1.0.0 +RECORDER=juplo/wordcount--recorder:1.0.1 +USERS=juplo/wordcount--users:1.0.4 +COUNTER=juplo/wordcount--counter:1.0.1 +TOP10=juplo/wordcount--top10:1.0.1 +QUERY=juplo/wordcount--query:1.0.4 if [ "$1" = "cleanup" ] then - docker-compose down -v + docker-compose down -v --remove-orphans + docker image rm $FORTUNE docker image rm $RECORDER + docker image rm $USERS docker image rm $COUNTER docker image rm $TOP10 docker image rm $QUERY @@ -16,34 +20,89 @@ then fi if [[ + $(docker image ls -q $FORTUNE) == "" || $(docker image ls -q $RECORDER) == "" || + $(docker image ls -q $USERS) == "" || $(docker image ls -q $COUNTER) == "" || $(docker image ls -q $TOP10) == "" || $(docker image ls -q $QUERY) == "" || "$1" = "build" ]] then - git submodule update --init mvn clean package || exit - docker-compose rm -svf recorder counter top10 query + docker-compose rm -svf recorder users counter top10 query + ( cd fortune; ./README.sh $FORTUNE; ) mvn -f recorder/pom.xml docker:build + mvn -f users/pom.xml docker:build mvn -f counter/pom.xml docker:build mvn -f top10/pom.xml docker:build mvn -f query/pom.xml docker:build else echo "Using existing images:" + docker image ls $FORTUNE docker image ls $RECORDER + docker image ls $USERS docker image ls $COUNTER docker image ls $TOP10 docker image ls $QUERY fi -docker-compose up -d zookeeper kafka cli kafkacat +docker-compose up -d zookeeper kafka cli traefik 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 exec cli zookeeper-shell zookeeper:2181 ls /brokers/ids +docker-compose up -d users +while [ "$(http users.localhost/actuator/health 2> /dev/null | jq -r .status 2> /dev/null)" != "UP" ]; do echo "Waiting for service users..."; sleep 1; done +http -v post users.localhost username=bart firstName=Bart lastName=Simpson sex=MALE +http -v post users.localhost username=nerd firstName=Jane lastName=Doe sex=FEMALE +http -v post users.localhost username=riddler firstName=Rumpel lastName=Stilzchen sex=MALE + echo "Starting all instances..." docker-compose up -d + +while [ "$(http query.localhost/actuator/health 2>/dev/null | jq -r .status 2> /dev/null)" != "UP" ]; do echo "Waiting for service query..."; sleep 1; done +http -v query.localhost/bart +sleep 1 +http -v query.localhost/bart +sleep 1 +http -v query.localhost/bart +sleep 1 +http -v query.localhost/bart +sleep 1 +http -v query.localhost/bart +sleep 1 +http -v query.localhost/bart +sleep 1 +http -v query.localhost/bart +http -v query.localhost/nerd +http -v query.localhost/riddler + +docker-compose up -d --scale query=5 query +http -v --follow query.localhost/bart +sleep 1 +http -v --follow query.localhost/bart +sleep 1 +http -v --follow query.localhost/bart +sleep 1 +http -v --follow query.localhost/bart +sleep 1 +http -v --follow query.localhost/bart +sleep 1 +http -v --follow query.localhost/bart +sleep 1 +http -v --follow query.localhost/bart + +http -v --follow query.localhost/nerd +http -v --follow query.localhost/nerd +http -v --follow query.localhost/nerd +http -v --follow query.localhost/nerd +http -v --follow query.localhost/nerd + +http -v --follow query.localhost/riddler +http -v --follow query.localhost/riddler +http -v --follow query.localhost/riddler +http -v --follow query.localhost/riddler +http -v --follow query.localhost/riddler