From: Kai Moritz Date: Sat, 20 Aug 2022 17:33:30 +0000 (+0200) Subject: Setup und Vorführ-Skript auf 2 adder- und requests-Services umgestellt X-Git-Tag: sumup-adder---lvm-2-tage~7^2~1 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=ee0cd3f9feba20dff95d9eef6fb7b654909da604;p=demos%2Fkafka%2Ftraining Setup und Vorführ-Skript auf 2 adder- und requests-Services umgestellt --- diff --git a/README.sh b/README.sh index e772144..9f884c8 100755 --- a/README.sh +++ b/README.sh @@ -9,7 +9,7 @@ then exit fi -docker-compose stop adder +docker-compose stop adder-1 adder-2 docker-compose rm -svf mongo docker-compose up -d zookeeper kafka-1 kafka-2 kafka-3 cli mongo express @@ -18,7 +18,7 @@ if [[ "$1" = "build" ]] then - docker-compose rm -svf adder + docker-compose rm -svf adder-1 adder-2 mvn -D skipTests clean install || exit else echo "Using image existing images:" @@ -28,23 +28,77 @@ 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 gateway requests adder +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..."; sleep 1; done -while ! [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for adder..."; 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 +docker-compose up -d peter klaus -while [[ "$(http :8082/results | jq -r .)" == "{}" ]]; do echo "Waiting for some results to show up..."; done -http -v :8082/results +while [[ "$(http :8091/results | jq -r .)" == "{}" ]]; do echo "Waiting for some results to show up on adder-1..."; sleep 1; done +http -v :8091/results +while [[ "$(http :8092/results | jq -r .)" == "{}" ]]; do echo "Waiting for some results to show up on adder-2..."; sleep 1; done +http -v :8092/results sleep 3 -http -v :8082/results -http :8082/results/peter | jq .[].sum | uniq -docker-compose kill -s 9 adder - -docker-compose up -d adder -docker-compose kill -s 9 peter -while ! [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for adder..."; sleep 1; done -while [[ "$(http :8082/results | jq -r .)" == "{}" ]]; do echo "Waiting for some results to show up..."; sleep 1; done -http :8082/results/peter | jq .[].sum | uniq +echo "Resultate für adder-1" +http -v :8091/results +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 :8092/results +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 :8092/results +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 :8091/results +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 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 diff --git a/docker-compose.yml b/docker-compose.yml index 0d61e12..96fda60 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -105,23 +105,45 @@ services: sumup.gateway.client-id: gateway sumup.gateway.topic: in - requests: + requests-1: image: juplo/sumup-requests:1.0-SNAPSHOT ports: - 8081:8080 environment: server.port: 8080 sumup.requests.bootstrap-server: kafka:9092 - sumup.requests.client-id: requests + sumup.requests.client-id: requests-1 - adder: - image: juplo/sumup-adder:1.0-SNAPSHOT + requests-2: + image: juplo/sumup-requests:1.0-SNAPSHOT ports: - 8082:8080 + environment: + server.port: 8080 + sumup.requests.bootstrap-server: kafka:9092 + sumup.requests.client-id: requests-2 + + adder-1: + image: juplo/sumup-adder:1.0-SNAPSHOT + ports: + - 8091:8080 environment: server.port: 8080 sumup.adder.bootstrap-server: kafka:9092 - sumup.adder.client-id: adder + sumup.adder.client-id: adder-1 + sumup.adder.commit-interval: 3s + spring.data.mongodb.uri: mongodb://juplo:training@mongo:27017 + spring.data.mongodb.database: juplo + logging.level.org.apache.kafka.clients.consumer: DEBUG + + adder-2: + image: juplo/sumup-adder:1.0-SNAPSHOT + ports: + - 8092:8080 + environment: + server.port: 8080 + sumup.adder.bootstrap-server: kafka:9092 + sumup.adder.client-id: adder-2 sumup.adder.commit-interval: 3s spring.data.mongodb.uri: mongodb://juplo:training@mongo:27017 spring.data.mongodb.database: juplo @@ -133,37 +155,7 @@ services: bash -c " while [[ true ]]; do - echo 6666 | http -v gateway:8080/peter; - done - " - ute: - image: juplo/toolbox - command: > - bash -c " - while [[ true ]]; - do - echo 666 | http -v gateway:8080/ute; - sleep 2; - done - " - franz: - image: juplo/toolbox - command: > - bash -c " - while [[ true ]]; - do - echo 666 | http -v gateway:8080/franz; - sleep 3; - done - " - beate: - image: juplo/toolbox - command: > - bash -c " - while [[ true ]]; - do - echo 666 | http -v gateway:8080/beate; - sleep 4; + echo 666 | http -v gateway:8080/peter; done " klaus: @@ -173,16 +165,5 @@ services: while [[ true ]]; do echo 666 | http -v gateway:8080/klaus; - sleep 5; - done - " - uschi: - image: juplo/toolbox - command: > - bash -c " - while [[ true ]]; - do - echo 666 | http -v gateway:8080/uschi; - sleep 6; done "