Tags für Asciidoc hinzugefügt
[demos/kafka/training] / README.sh
1 #!/bin/bash
2
3 IMAGE=juplo/supersimple:1.0-SNAPSHOT
4
5 if [ "$1" = "cleanup" ]
6 then
7   docker-compose down -v
8   mvn clean
9   exit
10 fi
11
12 docker-compose rm -svf supersimple
13 docker-compose up -d zookeeper kafka-1 kafka-2 kafka-3 cli
14
15 if [[
16   $(docker image ls -q $IMAGE) == "" ||
17   "$1" = "build"
18 ]]
19 then
20   docker-compose rm -svf supersimple
21   mvn clean install || exit
22 else
23   echo "Using image existing images:"
24   docker image ls $IMAGE
25 fi
26
27 echo "Waiting for the Kafka-Cluster to become ready..."
28 docker-compose exec cli cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1
29 docker-compose up setup
30 docker-compose up -d gateway requests-1 requests-2 supersimple
31
32 while ! [[ $(http 0:8080/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for gateway..."; sleep 1; done
33 while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for requests-1..."; sleep 1; done
34 while ! [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for requests-2..."; sleep 1; done
35
36 echo 6 | http -v :8080/peter
37
38 sleep 10
39
40 docker-compose logs supersimple