From: Kai Moritz Date: Sun, 7 Feb 2021 14:03:12 +0000 (+0100) Subject: Added a script that illustrates the example X-Git-Tag: part-1~2 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;ds=inline;p=demos%2Fspring%2Fdata-jdbc Added a script that illustrates the example --- diff --git a/README.sh b/README.sh new file mode 100755 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 diff --git a/docker-compose.yml b/docker-compose.yml index b7e85f2..ae92619 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 --- a/pom.xml +++ b/pom.xml @@ -9,9 +9,9 @@ de.juplo.boot.data - jdbc + data-jdbc 0.0.1-SNAPSHOT - data-jdbc + Data JDBC Simple web-app example for spring-boot-data-jdbc @@ -71,7 +71,7 @@ - %a:%l + juplo/%a:latest