Added a script that illustrates the example master
authorKai Moritz <kai@juplo.de>
Sun, 7 Feb 2021 14:03:12 +0000 (15:03 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 7 Feb 2021 14:03:12 +0000 (15:03 +0100)
README.sh [new file with mode: 0755]
docker-compose.yml
pom.xml

diff --git a/README.sh b/README.sh
new file mode 100755 (executable)
index 0000000..23bff3a
--- /dev/null
+++ b/README.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+if [ "$1" = "cleanup" ]
+then
+  docker-compose down -v
+  mvn clean
+  docker image rm juplo/data-jdbc:latest
+  exit
+fi
+
+if [[
+  $(docker image ls -q juplo/data-jdbc:latest) == "" ||
+  "$1" = "build"
+]]
+then
+  mvn package || exit
+else
+  echo "Using image existing images:"
+  docker image ls juplo/data-jdbc:latest
+fi
+
+docker-compose up -d jdbc
+
+while ! [[ $(http :8080/actuator/health 2>/dev/null | jq -r .status) == "UP" ]];
+do
+  echo "Waiting for User-Service...";
+  sleep 1;
+done
+
+
+docker-compose logs --tail=0 -f jdbc &
+
+for i in `seq 1 20`;
+do
+  echo peter$i | http :8080/users
+  echo uwe$i | http :8080/users
+  echo peter$i | http :8080/users
+  echo simone$i | http :8080/users
+  http DELETE :8080/users/franz$i
+  http DELETE :8080/users/simone$i
+  echo franz$i | http :8080/users
+  echo franz$i | http :8080/users
+  echo beate$i | http :8080/users
+  http DELETE :8080/users/uwe$i
+  sleep 1
+done;
+
+docker-compose stop
index b7e85f2..ae92619 100644 (file)
@@ -2,11 +2,13 @@ version: "3"
 
 services:
   jdbc:
-    image: jdbc:latest
+    image: juplo/data-jdbc:latest
     ports:
       - 8080:8080
     environment:
       spring.profiles.active: prod
+    depends_on:
+      - postgres
 
   postgres:
     image: postgres:13
diff --git a/pom.xml b/pom.xml
index b5d3209..f0318e8 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -9,9 +9,9 @@
      <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>de.juplo.boot.data</groupId>
-   <artifactId>jdbc</artifactId>
+   <artifactId>data-jdbc</artifactId>
    <version>0.0.1-SNAPSHOT</version>
-   <name>data-jdbc</name>
+   <name>Data JDBC</name>
    <description>Simple web-app example for spring-boot-data-jdbc</description>
 
    <properties>
@@ -71,7 +71,7 @@
          <configuration>
            <images>
              <image>
-               <name>%a:%l</name>
+               <name>juplo/%a:latest</name>
              </image>
            </images>
          </configuration>