WIP master
authorKai Moritz <kai@juplo.de>
Sun, 26 May 2024 09:00:14 +0000 (11:00 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 26 May 2024 09:06:44 +0000 (11:06 +0200)
README.sh
counter
docker-compose.yml
recorder
top10

index f83dd77..4c88f6e 100755 (executable)
--- a/README.sh
+++ b/README.sh
@@ -1,11 +1,11 @@
 #!/bin/bash
 
 FORTUNE=juplo/wordcount--fortune:1.0.0
-RECORDER=juplo/wordcount--recorder:1.1.1
+RECORDER=juplo/wordcount--recorder:1.1.2
 USERS=juplo/wordcount--users:1.0.5
 SPLITTER=juplo/wordcount--splitter:1.1.5
-COUNTER=juplo/wordcount--counter:1.2.5
-TOP10=juplo/wordcount--top10:1.0.2
+COUNTER=juplo/wordcount--counter:1.2.14
+TOP10=juplo/wordcount--top10:1.1.2
 QUERY=juplo/wordcount--query:1.0.5
 
 if [ "$1" = "cleanup" ]
@@ -53,19 +53,24 @@ else
 fi
 
 
-docker compose up -d 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 up setup
 
+echo "Starting the service 'users'..."
 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
+echo "Starting the other instances..."
+docker compose up -d recordings
+docker compose up -d splitter
+docker compose up -d counter
+docker compose up -d top10
+docker compose up -d query
+
+echo "Starting the simulated users..."
+docker compose up -d bart nerd riddler
 
 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
diff --git a/counter b/counter
index f91e400..1b1ac5b 160000 (submodule)
--- a/counter
+++ b/counter
@@ -1 +1 @@
-Subproject commit f91e400b1077c381891d2a0ea618f491d0ba7da0
+Subproject commit 1b1ac5bca62f07dae4188a5797a36b0fbe72058d
index 301e12d..e431476 100644 (file)
@@ -36,8 +36,9 @@ services:
     volumes:
       - "/var/run/docker.sock:/var/run/docker.sock:ro"
 
+
   recorder:
-    image: juplo/wordcount--recorder:1.1.1
+    image: juplo/wordcount--recorder:1.1.2
     labels:
       - "traefik.enable=true"
       - "traefik.http.routers.recorder.rule=Host(`recorder.localhost`)"
@@ -70,7 +71,7 @@ services:
       - kafka
 
   counter:
-    image: juplo/wordcount--counter:1.2.5
+    image: juplo/wordcount--counter:1.2.14
     labels:
       - "traefik.enable=true"
       - "traefik.http.routers.counter.rule=Host(`counter.localhost`)"
@@ -81,7 +82,7 @@ services:
       - kafka
 
   top10:
-    image: juplo/wordcount--top10:1.0.2
+    image: juplo/wordcount--top10:1.1.2
     labels:
       - "traefik.enable=true"
       - "traefik.http.routers.top10.rule=Host(`top10.localhost`)"
@@ -102,6 +103,7 @@ services:
     depends_on:
       - kafka
 
+
   bart:
     image: juplo/wordcount--fortune:1.0.0
     command: bash -c "
@@ -138,16 +140,97 @@ services:
         sleep 1;
       done"
 
+
   cli:
     image: juplo/toolbox
-    command: bash -c "
-      cub kafka-ready -b kafka:9092 1 60 ;
-      kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --if-not-exists --topic recordings ;
-      kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --if-not-exists --topic users ;
-      kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --if-not-exists --topic words ;
-      kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --if-not-exists --topic countings ;
-      kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --if-not-exists --topic top10 ;
-      sleep infinity"
+    command: sleep infinity
+    stop_grace_period: 0s
+    depends_on:
+      - kafka
+      - traefik
+
+  setup:
+    image: juplo/toolbox
+    command:
+      - bash
+      - -c
+      - |
+        cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1
+        if [ -e INITIALIZED ]
+        then
+          echo -n Bereits konfiguriert:
+          cat INITIALIZED
+          kafka-topics --bootstrap-server kafka:9092 --describe --topic users
+          kafka-topics --bootstrap-server kafka:9092 --describe --topic recordings
+          kafka-topics --bootstrap-server kafka:9092 --describe --topic words
+          kafka-topics --bootstrap-server kafka:9092 --describe --topic countings
+          kafka-topics --bootstrap-server kafka:9092 --describe --topic top10
+        else
+          kafka-topics --bootstrap-server kafka:9092 \
+                       --delete \
+                       --if-exists \
+                       --topic users
+          kafka-topics --bootstrap-server kafka:9092 \
+                       --delete \
+                       --if-exists \
+                       --topic recordings
+          kafka-topics --bootstrap-server kafka:9092 \
+                       --delete \
+                       --if-exists \
+                       --topic words
+          kafka-topics --bootstrap-server kafka:9092 \
+                       --delete \
+                       --if-exists \
+                       --topic countings
+          kafka-topics --bootstrap-server kafka:9092 \
+                       --delete \
+                       --if-exists \
+                       --topic top10
+          kafka-topics --bootstrap-server kafka:9092 \
+                       --create \
+                       --topic users \
+                       --partitions 3 \
+                       --replication-factor 1 \
+                       --config min.insync.replicas=1 \
+          && echo Das Topic \'users\' wurde erfolgreich angelegt: \
+          && kafka-topics --bootstrap-server kafka:9092 --describe --topic users \
+          && kafka-topics --bootstrap-server kafka:9092 \
+                       --create \
+                       --topic recordings \
+                       --partitions 3 \
+                       --replication-factor 1 \
+                       --config min.insync.replicas=1 \
+          && echo Das Topic \'recordings\' wurde erfolgreich angelegt: \
+          && kafka-topics --bootstrap-server kafka:9092 --describe --topic recordings \
+          && kafka-topics --bootstrap-server kafka:9092 \
+                       --create \
+                       --topic words \
+                       --partitions 3 \
+                       --replication-factor 1 \
+                       --config min.insync.replicas=1 \
+          && echo Das Topic \'words\' wurde erfolgreich angelegt: \
+          && kafka-topics --bootstrap-server kafka:9092 --describe --topic words \
+          && kafka-topics --bootstrap-server kafka:9092 \
+                       --create \
+                       --topic countings \
+                       --partitions 3 \
+                       --replication-factor 1 \
+                       --config min.insync.replicas=1 \
+          && echo Das Topic \'countings\' wurde erfolgreich angelegt: \
+          && kafka-topics --bootstrap-server kafka:9092 --describe --topic countings \
+          && kafka-topics --bootstrap-server kafka:9092 \
+                       --create \
+                       --topic top10 \
+                       --partitions 3 \
+                       --replication-factor 1 \
+                       --config min.insync.replicas=1 \
+          && echo Das Topic \'top10\' wurde erfolgreich angelegt: \
+          && kafka-topics --bootstrap-server kafka:9092 --describe --topic top10 \
+          && date > INITIALIZED
+        fi
+    stop_grace_period: 0s
+    depends_on:
+      - cli
 
   akhq:
     image: tchiotludo/akhq:0.18.0
index 7a5943c..a2c2e59 160000 (submodule)
--- a/recorder
+++ b/recorder
@@ -1 +1 @@
-Subproject commit 7a5943ce46684c9b469f38780d95955a9795044c
+Subproject commit a2c2e59ffc4fa51f2e1fe6f67c3885a344ff7a0c
diff --git a/top10 b/top10
index 1bfbd6c..bebfe8f 160000 (submodule)
--- a/top10
+++ b/top10
@@ -1 +1 @@
-Subproject commit 1bfbd6c6fe3c35e0cd5470db632faf1a655487af
+Subproject commit bebfe8fdc76e27886d7470b66ae02edc0070782f