From: Kai Moritz Date: Sat, 4 Sep 2021 22:13:46 +0000 (+0200) Subject: Added some story-tellers, based on Fortune X-Git-Tag: kafka-schulung--signal-iduna--devops~7 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=edfbe10e029271145f8105f40c903de7ee24fd2e;p=demos%2Fkafka%2Fwordcount Added some story-tellers, based on Fortune --- diff --git a/.gitmodules b/.gitmodules index 04152a2..ae65594 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,7 @@ path = users url = ./ branch = users +[submodule "fortune"] + path = fortune + url = ./ + branch = fortune diff --git a/README.sh b/README.sh index f6278f8..ee7a58c 100755 --- a/README.sh +++ b/README.sh @@ -1,5 +1,6 @@ #!/bin/bash +FORTUNE=juplo/wordcount--fortune:1.0.0 RECORDER=juplo/wordcount--recorder:1.0.0 USERS=juplo/wordcount--users:1.0.0 COUNTER=juplo/wordcount--counter:1.0.0 @@ -9,6 +10,7 @@ QUERY=juplo/wordcount--query:1.0.2 if [ "$1" = "cleanup" ] then docker-compose down -v + docker image rm $FORTUNE docker image rm $RECORDER docker image rm $USERS docker image rm $COUNTER @@ -18,6 +20,7 @@ then fi if [[ + $(docker image ls -q $FORTUNE) == "" || $(docker image ls -q $RECORDER) == "" || $(docker image ls -q $USERS) == "" || $(docker image ls -q $COUNTER) == "" || @@ -29,6 +32,7 @@ then git submodule update --init mvn clean package || exit 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 @@ -36,6 +40,7 @@ then 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 @@ -50,5 +55,11 @@ 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 :8082/actuator/health | jq -r .status 2> /dev/null)" != "UP" ]; do echo "Waiting for service users..."; sleep 1; done +http -v post :8082/users username=bart firstName=Bart lastName=Simpson sex=MALE +http -v post :8082/users username=nerd firstName=Jane lastName=Doe sex=FEMALE +http -v post :8082/users username=riddler firstName=Rumpel lastName=Stilzchen sex=MALE + echo "Starting all instances..." docker-compose up -d diff --git a/docker-compose.yml b/docker-compose.yml index e07b0fc..b65635b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -80,6 +80,42 @@ services: depends_on: - kafka + bart: + image: juplo/wordcount--fortune:1.0.0 + command: bash -c " + while [ true ]; + do + /usr/games/fortune chalkboard + | head -1 + | http -v recorder:8080/bart; + echo; + sleep 1; + done" + + nerd: + image: juplo/wordcount--fortune:1.0.0 + command: bash -c " + while [ true ]; + do + /usr/games/fortune computers + | grep -v '^[[:space:]]*--' + | http -v recorder:8080/nerd; + echo; + sleep 1; + done" + + riddler: + image: juplo/wordcount--fortune:1.0.0 + command: bash -c " + while [ true ]; + do + /usr/games/fortune riddles + | awk -F':' '/^Q/ { print $$2 }' + | http -v recorder:8080/riddler; + echo; + sleep 1; + done" + cli: image: confluentinc/cp-kafka:6.2.0 command: bash -c " diff --git a/fortune b/fortune new file mode 160000 index 0000000..5dd5c42 --- /dev/null +++ b/fortune @@ -0,0 +1 @@ +Subproject commit 5dd5c422829ceac252d5c13d0022acff40f76185