From 9794380f991fb52cb01cb468f5c23e81bf8473b2 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Thu, 5 Sep 2019 18:38:10 +0300 Subject: [PATCH 1/7] Updated libs --- multi-module/docker-compose-eventuate-local-mysql.yml | 4 ++-- .../docker-compose-eventuate-local-postgres-polling.yml | 4 ++-- multi-module/docker-compose-eventuate-local-postgres-wal.yml | 4 ++-- multi-module/mysql/Dockerfile | 2 +- multi-module/postgres/Dockerfile | 2 +- single-module/docker-compose-eventuate-local-mysql.yml | 4 ++-- .../docker-compose-eventuate-local-postgres-polling.yml | 4 ++-- single-module/docker-compose-eventuate-local-postgres-wal.yml | 4 ++-- single-module/mysql/Dockerfile | 2 +- single-module/postgres/Dockerfile | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/multi-module/docker-compose-eventuate-local-mysql.yml b/multi-module/docker-compose-eventuate-local-mysql.yml index e0f1c82..70b18a0 100644 --- a/multi-module/docker-compose-eventuate-local-mysql.yml +++ b/multi-module/docker-compose-eventuate-local-mysql.yml @@ -1,7 +1,7 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.4.0.RELEASE + image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE ports: - 2181:2181 - 2888:2888 @@ -21,7 +21,7 @@ services: cdcservice: - image: eventuateio/eventuate-cdc-service:0.4.0.RELEASE + image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE ports: - "8099:8080" depends_on: diff --git a/multi-module/docker-compose-eventuate-local-postgres-polling.yml b/multi-module/docker-compose-eventuate-local-postgres-polling.yml index 07ad016..b85d06b 100644 --- a/multi-module/docker-compose-eventuate-local-postgres-polling.yml +++ b/multi-module/docker-compose-eventuate-local-postgres-polling.yml @@ -1,7 +1,7 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.4.0.RELEASE + image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE ports: - 2181:2181 - 2888:2888 @@ -27,7 +27,7 @@ services: POSTGRES_PASSWORD: eventuate cdcservice: - image: eventuateio/eventuate-cdc-service:0.4.0.RELEASE + image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE ports: - "8099:8080" depends_on: diff --git a/multi-module/docker-compose-eventuate-local-postgres-wal.yml b/multi-module/docker-compose-eventuate-local-postgres-wal.yml index 6fcf647..0e4f8bf 100644 --- a/multi-module/docker-compose-eventuate-local-postgres-wal.yml +++ b/multi-module/docker-compose-eventuate-local-postgres-wal.yml @@ -1,7 +1,7 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.4.0.RELEASE + image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE ports: - 2181:2181 - 2888:2888 @@ -27,7 +27,7 @@ services: POSTGRES_PASSWORD: eventuate cdcservice: - image: eventuateio/eventuate-cdc-service:0.4.0.RELEASE + image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE ports: - "8099:8080" depends_on: diff --git a/multi-module/mysql/Dockerfile b/multi-module/mysql/Dockerfile index 78d36fd..9964504 100644 --- a/multi-module/mysql/Dockerfile +++ b/multi-module/mysql/Dockerfile @@ -1,2 +1,2 @@ -FROM eventuateio/eventuate-mysql:0.7.0.RELEASE +FROM eventuateio/eventuate-mysql:0.8.0.RELEASE COPY schema-mysql.sql /docker-entrypoint-initdb.d diff --git a/multi-module/postgres/Dockerfile b/multi-module/postgres/Dockerfile index 8c69e0c..15cb832 100644 --- a/multi-module/postgres/Dockerfile +++ b/multi-module/postgres/Dockerfile @@ -1,2 +1,2 @@ -FROM eventuateio/eventuate-postgres:0.7.0.RELEASE +FROM eventuateio/eventuate-postgres:0.8.0.RELEASE COPY schema-postgres.sql /docker-entrypoint-initdb.d diff --git a/single-module/docker-compose-eventuate-local-mysql.yml b/single-module/docker-compose-eventuate-local-mysql.yml index 2770412..b0cd0af 100644 --- a/single-module/docker-compose-eventuate-local-mysql.yml +++ b/single-module/docker-compose-eventuate-local-mysql.yml @@ -1,7 +1,7 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.4.0.RELEASE + image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE ports: - 2181:2181 - 2888:2888 @@ -20,7 +20,7 @@ services: - ZOOKEEPER_SERVERS=zookeeper:2181 cdcservice: - image: eventuateio/eventuate-cdc-service:0.4.0.RELEASE + image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE ports: - "8099:8080" depends_on: diff --git a/single-module/docker-compose-eventuate-local-postgres-polling.yml b/single-module/docker-compose-eventuate-local-postgres-polling.yml index 7358789..600ae83 100644 --- a/single-module/docker-compose-eventuate-local-postgres-polling.yml +++ b/single-module/docker-compose-eventuate-local-postgres-polling.yml @@ -1,7 +1,7 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.4.0.RELEASE + image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE ports: - 2181:2181 - 2888:2888 @@ -27,7 +27,7 @@ services: POSTGRES_PASSWORD: eventuate cdcservice: - image: eventuateio/eventuate-cdc-service:0.4.0.RELEASE + image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE ports: - "8099:8080" depends_on: diff --git a/single-module/docker-compose-eventuate-local-postgres-wal.yml b/single-module/docker-compose-eventuate-local-postgres-wal.yml index 16df54b..a99bc03 100644 --- a/single-module/docker-compose-eventuate-local-postgres-wal.yml +++ b/single-module/docker-compose-eventuate-local-postgres-wal.yml @@ -1,7 +1,7 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.4.0.RELEASE + image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE ports: - 2181:2181 - 2888:2888 @@ -27,7 +27,7 @@ services: POSTGRES_PASSWORD: eventuate cdcservice: - image: eventuateio/eventuate-cdc-service:0.4.0.RELEASE + image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE ports: - "8099:8080" depends_on: diff --git a/single-module/mysql/Dockerfile b/single-module/mysql/Dockerfile index 78d36fd..9964504 100644 --- a/single-module/mysql/Dockerfile +++ b/single-module/mysql/Dockerfile @@ -1,2 +1,2 @@ -FROM eventuateio/eventuate-mysql:0.7.0.RELEASE +FROM eventuateio/eventuate-mysql:0.8.0.RELEASE COPY schema-mysql.sql /docker-entrypoint-initdb.d diff --git a/single-module/postgres/Dockerfile b/single-module/postgres/Dockerfile index 8c69e0c..15cb832 100644 --- a/single-module/postgres/Dockerfile +++ b/single-module/postgres/Dockerfile @@ -1,2 +1,2 @@ -FROM eventuateio/eventuate-postgres:0.7.0.RELEASE +FROM eventuateio/eventuate-postgres:0.8.0.RELEASE COPY schema-postgres.sql /docker-entrypoint-initdb.d From 0fc0d9305b3e73bf4f1048e5701a16d3aaac2e5f Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Tue, 10 Sep 2019 13:05:46 +0300 Subject: [PATCH 2/7] docker image versions moved to gradle --- ...d-and-test-all-eventuate-local-postgres.sh | 16 ------- multi-module/_build-and-test-all.sh | 24 ++++------- ...uild-and-test-all-eventuate-local-mysql.sh | 11 +++-- ...st-all-eventuate-local-postgres-polling.sh | 10 ++++- ...d-test-all-eventuate-local-postgres-wal.sh | 10 ++++- multi-module/build.gradle | 43 +++++++++++++++++++ .../docker-compose-eventuate-local-mysql.yml | 13 +++--- ...mpose-eventuate-local-postgres-polling.yml | 13 +++--- ...r-compose-eventuate-local-postgres-wal.yml | 13 +++--- multi-module/gradle.properties | 6 ++- multi-module/mysql/Dockerfile | 3 +- multi-module/postgres/Dockerfile | 3 +- ...d-and-test-all-eventuate-local-postgres.sh | 16 ------- single-module/_build-and-test-all.sh | 24 ++++------- ...uild-and-test-all-eventuate-local-mysql.sh | 9 ++-- ...st-all-eventuate-local-postgres-polling.sh | 9 +++- ...d-test-all-eventuate-local-postgres-wal.sh | 9 +++- single-module/build.gradle | 42 ++++++++++++++++++ .../docker-compose-eventuate-local-mysql.yml | 13 +++--- ...mpose-eventuate-local-postgres-polling.yml | 13 +++--- ...r-compose-eventuate-local-postgres-wal.yml | 13 +++--- single-module/gradle.properties | 4 ++ single-module/mysql/Dockerfile | 3 +- single-module/postgres/Dockerfile | 3 +- 24 files changed, 203 insertions(+), 120 deletions(-) delete mode 100755 multi-module/_build-and-test-all-eventuate-local-postgres.sh delete mode 100755 single-module/_build-and-test-all-eventuate-local-postgres.sh diff --git a/multi-module/_build-and-test-all-eventuate-local-postgres.sh b/multi-module/_build-and-test-all-eventuate-local-postgres.sh deleted file mode 100755 index 0d050e9..0000000 --- a/multi-module/_build-and-test-all-eventuate-local-postgres.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/bash - -. ./set-env-postgres.sh - -docker-compose -f docker-compose-eventuate-local-postgres-${MODE}.yml down -docker-compose -f docker-compose-eventuate-local-postgres-${MODE}.yml up --build -d cdcservice - -./gradlew -x :e2etest:test build -P eventuateDriver=local - -docker-compose -f docker-compose-eventuate-local-postgres-${MODE}.yml up --build -d - -./wait-for-services.sh $DOCKER_HOST_IP 8081 8082 - -./gradlew :e2etest:cleanTest :e2etest:test -P ignoreE2EFailures=false - -docker-compose -f docker-compose-eventuate-local-postgres-${MODE}.yml down \ No newline at end of file diff --git a/multi-module/_build-and-test-all.sh b/multi-module/_build-and-test-all.sh index 4f6594f..08e2e37 100755 --- a/multi-module/_build-and-test-all.sh +++ b/multi-module/_build-and-test-all.sh @@ -13,19 +13,10 @@ if [ -z "$DOCKER_HOST_IP" ] ; then echo set DOCKER_HOST_IP $DOCKER_HOST_IP fi -DOCKER_COMPOSE="docker-compose -p java-spring-todo-list" - -while [ "$1" = "-f" ] ; do - shift; - DOCKER_COMPOSE="$DOCKER_COMPOSE -f ${1?}" - shift -done - if [ "$1" = "--use-existing" ] ; then shift; else - ${DOCKER_COMPOSE?} stop - ${DOCKER_COMPOSE?} rm -v --force + ./gradlew ${database}${mode}ComposeDown fi @@ -36,7 +27,10 @@ if [ "$1" = "--no-rm" ] ; then shift fi -${DOCKER_COMPOSE?} up -d mysql $EXTRA_INFRASTRUCTURE_SERVICES +if [ ! -z "$EXTRA_INFRASTRUCTURE_SERVICES" ]; then + ./gradlew ${EXTRA_INFRASTRUCTURE_SERVICES}ComposeBuild + ./gradlew ${EXTRA_INFRASTRUCTURE_SERVICES}ComposeUp +fi if [ -z "$SPRING_DATASOURCE_URL" ] ; then export SPRING_DATASOURCE_URL=jdbc:mysql://${DOCKER_HOST_IP}/es-test @@ -52,15 +46,13 @@ fi ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS --offline $* :e2etest:cleanTest :e2etest:testClasses -${DOCKER_COMPOSE?} build - -${DOCKER_COMPOSE?} up -d commandsideservice querysideservice +./gradlew ${database}${mode}ComposeBuild +./gradlew ${database}${mode}ComposeUp ./wait-for-services.sh $DOCKER_HOST_IP 8081 8082 $EXTRA_PORTS_TO_WAIT_FOR ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS --offline $* -P ignoreE2EFailures=false :e2etest:cleanTest :e2etest:test if [ $NO_RM = false ] ; then - ${DOCKER_COMPOSE?} stop - ${DOCKER_COMPOSE?} rm -v --force + ./gradlew ${database}${mode}ComposeDown fi diff --git a/multi-module/build-and-test-all-eventuate-local-mysql.sh b/multi-module/build-and-test-all-eventuate-local-mysql.sh index 4d5bc61..271c397 100755 --- a/multi-module/build-and-test-all-eventuate-local-mysql.sh +++ b/multi-module/build-and-test-all-eventuate-local-mysql.sh @@ -1,8 +1,11 @@ #! /bin/bash -export EXTRA_INFRASTRUCTURE_SERVICES=cdcservice -export EVENTUATE_LOCAL=yes +. ./set-env-mysql.sh + export EXTRA_PORTS_TO_WAIT_FOR=8099 +export EXTRA_INFRASTRUCTURE_SERVICES=mysqlbinlogcdc +export EVENTUATE_LOCAL=yes +export database=mysql +export mode=binlog -. ./set-env-mysql.sh -./_build-and-test-all.sh -f docker-compose-eventuate-local-mysql.yml $BUILD_AND_TEST_ALL_EVENTUATE_LOCAL_EXTRA_COMPOSE_ARGS $* -P eventuateDriver=local +./_build-and-test-all.sh $* -P eventuateDriver=local diff --git a/multi-module/build-and-test-all-eventuate-local-postgres-polling.sh b/multi-module/build-and-test-all-eventuate-local-postgres-polling.sh index 1695a26..4f89ab7 100755 --- a/multi-module/build-and-test-all-eventuate-local-postgres-polling.sh +++ b/multi-module/build-and-test-all-eventuate-local-postgres-polling.sh @@ -1,5 +1,11 @@ #! /bin/bash -export MODE=polling +. ./set-env-postgres.sh -./_build-and-test-all-eventuate-local-postgres.sh +export EXTRA_PORTS_TO_WAIT_FOR=8099 +export EXTRA_INFRASTRUCTURE_SERVICES=postgreswalcdc +export EVENTUATE_LOCAL=yes +export database=postgres +export mode=wal + +./_build-and-test-all.sh $* -P eventuateDriver=local diff --git a/multi-module/build-and-test-all-eventuate-local-postgres-wal.sh b/multi-module/build-and-test-all-eventuate-local-postgres-wal.sh index 874548a..a895196 100755 --- a/multi-module/build-and-test-all-eventuate-local-postgres-wal.sh +++ b/multi-module/build-and-test-all-eventuate-local-postgres-wal.sh @@ -1,5 +1,11 @@ #! /bin/bash -export MODE=wal +. ./set-env-postgres.sh -./_build-and-test-all-eventuate-local-postgres.sh +export EXTRA_PORTS_TO_WAIT_FOR=8099 +export EXTRA_INFRASTRUCTURE_SERVICES=postgrespollingcdc +export EVENTUATE_LOCAL=yes +export database=postgres +export mode=polling + +./_build-and-test-all.sh $* -P eventuateDriver=local diff --git a/multi-module/build.gradle b/multi-module/build.gradle index 4a46af7..cf56dd0 100755 --- a/multi-module/build.gradle +++ b/multi-module/build.gradle @@ -1,12 +1,16 @@ buildscript { repositories { mavenCentral() + jcenter() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion") + classpath "com.avast.gradle:gradle-docker-compose-plugin:0.9.2" } } +apply plugin: 'docker-compose' + task wrapper(type: Wrapper) { gradleVersion = '3.5' } @@ -21,4 +25,43 @@ subprojects { jcenter() eventuateMavenRepoUrl.split(',').each { repoUrl -> maven { url repoUrl } } } +} + +dockerCompose { + environment.put "EVENTUATE_COMMON_VERSION", eventuateCommonImageVersion + environment.put "EVENTUATE_KAFKA_VERSION", eventuateMessagingKafkaImageVersion + environment.put "EVENTUATE_CDC_VERSION", eventuateCdcImageVersion + + mysqlbinlog { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-mysql.yml"] + } + + mysqlbinlogcdc { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-mysql.yml"] + startedServices = ["cdcservice"] + } + + postgrespolling { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-postgres-polling.yml"] + } + + postgrespollingcdc { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-postgres-polling.yml"] + startedServices = ["cdcservice"] + } + + postgreswal { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-postgres-wal.yml"] + } + + postgreswalcdc { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-postgres-wal.yml"] + startedServices = ["cdcservice"] + } } \ No newline at end of file diff --git a/multi-module/docker-compose-eventuate-local-mysql.yml b/multi-module/docker-compose-eventuate-local-mysql.yml index 70b18a0..d56659d 100644 --- a/multi-module/docker-compose-eventuate-local-mysql.yml +++ b/multi-module/docker-compose-eventuate-local-mysql.yml @@ -1,15 +1,13 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE + image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION ports: - 2181:2181 - - 2888:2888 - - 3888:3888 kafka: - image: eventuateio/eventuate-kafka:0.3.0.RELEASE + image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION ports: - 9092:9092 depends_on: @@ -21,7 +19,7 @@ services: cdcservice: - image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE + image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" depends_on: @@ -44,7 +42,10 @@ services: EVENTUATE_CDC_TYPE: EventuateLocal mysql: - build: ./mysql + build: + context: ./mysql + args: + EVENTUATE_COMMON_VERSION: "$EVENTUATE_COMMON_VERSION" ports: - 3306:3306 environment: diff --git a/multi-module/docker-compose-eventuate-local-postgres-polling.yml b/multi-module/docker-compose-eventuate-local-postgres-polling.yml index b85d06b..434cafb 100644 --- a/multi-module/docker-compose-eventuate-local-postgres-polling.yml +++ b/multi-module/docker-compose-eventuate-local-postgres-polling.yml @@ -1,14 +1,12 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE + image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION ports: - 2181:2181 - - 2888:2888 - - 3888:3888 kafka: - image: eventuateio/eventuate-kafka:0.3.0.RELEASE + image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION ports: - 9092:9092 depends_on: @@ -19,7 +17,10 @@ services: - ZOOKEEPER_SERVERS=zookeeper:2181 postgres: - build: ./postgres + build: + context: ./postgres + args: + EVENTUATE_COMMON_VERSION: "$EVENTUATE_COMMON_VERSION" ports: - 5432:5432 environment: @@ -27,7 +28,7 @@ services: POSTGRES_PASSWORD: eventuate cdcservice: - image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE + image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" depends_on: diff --git a/multi-module/docker-compose-eventuate-local-postgres-wal.yml b/multi-module/docker-compose-eventuate-local-postgres-wal.yml index 0e4f8bf..32a7835 100644 --- a/multi-module/docker-compose-eventuate-local-postgres-wal.yml +++ b/multi-module/docker-compose-eventuate-local-postgres-wal.yml @@ -1,14 +1,12 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE + image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION ports: - 2181:2181 - - 2888:2888 - - 3888:3888 kafka: - image: eventuateio/eventuate-kafka:0.3.0.RELEASE + image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION ports: - 9092:9092 depends_on: @@ -19,7 +17,10 @@ services: - ZOOKEEPER_SERVERS=zookeeper:2181 postgres: - build: ./postgres + build: + context: ./postgres + args: + EVENTUATE_COMMON_VERSION: "$EVENTUATE_COMMON_VERSION" ports: - 5432:5432 environment: @@ -27,7 +28,7 @@ services: POSTGRES_PASSWORD: eventuate cdcservice: - image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE + image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" depends_on: diff --git a/multi-module/gradle.properties b/multi-module/gradle.properties index ba65c90..4de0a07 100755 --- a/multi-module/gradle.properties +++ b/multi-module/gradle.properties @@ -8,4 +8,8 @@ springHateoasVersion=0.17.0.RELEASE springBootVersion=1.5.10.RELEASE eventuateClientVersion=0.22.0.RC1 -eventuateLocalVersion=0.31.0.RC3 \ No newline at end of file +eventuateLocalVersion=0.31.0.RC3 + +eventuateCommonImageVersion=0.8.0.RELEASE +eventuateMessagingKafkaImageVersion=0.3.0.RELEASE +eventuateCdcImageVersion=0.5.0.RELEASE \ No newline at end of file diff --git a/multi-module/mysql/Dockerfile b/multi-module/mysql/Dockerfile index 9964504..d090a13 100644 --- a/multi-module/mysql/Dockerfile +++ b/multi-module/mysql/Dockerfile @@ -1,2 +1,3 @@ -FROM eventuateio/eventuate-mysql:0.8.0.RELEASE +ARG EVENTUATE_COMMON_VERSION +FROM eventuateio/eventuate-mysql:$EVENTUATE_COMMON_VERSION COPY schema-mysql.sql /docker-entrypoint-initdb.d diff --git a/multi-module/postgres/Dockerfile b/multi-module/postgres/Dockerfile index 15cb832..62b744d 100644 --- a/multi-module/postgres/Dockerfile +++ b/multi-module/postgres/Dockerfile @@ -1,2 +1,3 @@ -FROM eventuateio/eventuate-postgres:0.8.0.RELEASE +ARG EVENTUATE_COMMON_VERSION +FROM eventuateio/eventuate-postgres:$EVENTUATE_COMMON_VERSION COPY schema-postgres.sql /docker-entrypoint-initdb.d diff --git a/single-module/_build-and-test-all-eventuate-local-postgres.sh b/single-module/_build-and-test-all-eventuate-local-postgres.sh deleted file mode 100755 index c83415f..0000000 --- a/single-module/_build-and-test-all-eventuate-local-postgres.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/bash - -. ./set-env-postgres.sh - -docker-compose -f docker-compose-eventuate-local-postgres-${MODE}.yml down -docker-compose -f docker-compose-eventuate-local-postgres-${MODE}.yml up --build -d cdcservice - -./gradlew -x e2eTest build -P eventuateDriver=local - -docker-compose -f docker-compose-eventuate-local-postgres-${MODE}.yml up --build -d - -./wait-for-services.sh $DOCKER_HOST_IP 8080 - -./gradlew cleanTest e2eTest -P ignoreE2EFailures=false - -docker-compose -f docker-compose-eventuate-local-postgres-${MODE}.yml down diff --git a/single-module/_build-and-test-all.sh b/single-module/_build-and-test-all.sh index f5eab09..ea81b91 100755 --- a/single-module/_build-and-test-all.sh +++ b/single-module/_build-and-test-all.sh @@ -13,19 +13,10 @@ if [ -z "$DOCKER_HOST_IP" ] ; then echo set DOCKER_HOST_IP $DOCKER_HOST_IP fi -DOCKER_COMPOSE="docker-compose -p java-spring-todo-list" - -while [ "$1" = "-f" ] ; do - shift; - DOCKER_COMPOSE="$DOCKER_COMPOSE -f ${1?}" - shift -done - if [ "$1" = "--use-existing" ] ; then shift; else - ${DOCKER_COMPOSE?} stop - ${DOCKER_COMPOSE?} rm -v --force + ./gradlew ${database}${mode}ComposeDown fi @@ -36,7 +27,10 @@ if [ "$1" = "--no-rm" ] ; then shift fi -${DOCKER_COMPOSE?} up -d mysql $EXTRA_INFRASTRUCTURE_SERVICES +if [ ! -z "$EXTRA_INFRASTRUCTURE_SERVICES" ]; then + ./gradlew ${EXTRA_INFRASTRUCTURE_SERVICES}ComposeBuild + ./gradlew ${EXTRA_INFRASTRUCTURE_SERVICES}ComposeUp +fi ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS $* build @@ -47,15 +41,13 @@ fi ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS --offline $* cleanTest -${DOCKER_COMPOSE?} build - -${DOCKER_COMPOSE?} up -d standaloneservice +./gradlew ${database}${mode}ComposeBuild +./gradlew ${database}${mode}ComposeUp ./wait-for-services.sh $DOCKER_HOST_IP 8080 ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS --offline $* e2eTest if [ $NO_RM = false ] ; then - ${DOCKER_COMPOSE?} stop - ${DOCKER_COMPOSE?} rm -v --force + ./gradlew ${database}${mode}ComposeDown fi diff --git a/single-module/build-and-test-all-eventuate-local-mysql.sh b/single-module/build-and-test-all-eventuate-local-mysql.sh index a42e500..056194b 100755 --- a/single-module/build-and-test-all-eventuate-local-mysql.sh +++ b/single-module/build-and-test-all-eventuate-local-mysql.sh @@ -1,7 +1,10 @@ #! /bin/bash -export EXTRA_INFRASTRUCTURE_SERVICES=cdcservice +. ./set-env-mysql.sh + +export EXTRA_INFRASTRUCTURE_SERVICES=mysqlbinlogcdc export EVENTUATE_LOCAL=yes +export database=mysql +export mode=binlog -. ./set-env-mysql.sh -./_build-and-test-all.sh -f docker-compose-eventuate-local-mysql.yml $BUILD_AND_TEST_ALL_EVENTUATE_LOCAL_EXTRA_COMPOSE_ARGS $* -P eventuateDriver=local +./_build-and-test-all.sh $* -P eventuateDriver=local diff --git a/single-module/build-and-test-all-eventuate-local-postgres-polling.sh b/single-module/build-and-test-all-eventuate-local-postgres-polling.sh index 1695a26..82e6987 100755 --- a/single-module/build-and-test-all-eventuate-local-postgres-polling.sh +++ b/single-module/build-and-test-all-eventuate-local-postgres-polling.sh @@ -1,5 +1,10 @@ #! /bin/bash -export MODE=polling +. ./set-env-postgres.sh -./_build-and-test-all-eventuate-local-postgres.sh +export EXTRA_INFRASTRUCTURE_SERVICES=postgrespollingcdc +export EVENTUATE_LOCAL=yes +export database=postgres +export mode=polling + +./_build-and-test-all.sh $* -P eventuateDriver=local diff --git a/single-module/build-and-test-all-eventuate-local-postgres-wal.sh b/single-module/build-and-test-all-eventuate-local-postgres-wal.sh index 874548a..3728942 100755 --- a/single-module/build-and-test-all-eventuate-local-postgres-wal.sh +++ b/single-module/build-and-test-all-eventuate-local-postgres-wal.sh @@ -1,5 +1,10 @@ #! /bin/bash -export MODE=wal +. ./set-env-postgres.sh -./_build-and-test-all-eventuate-local-postgres.sh +export EXTRA_INFRASTRUCTURE_SERVICES=postgreswalcdc +export EVENTUATE_LOCAL=yes +export database=postgres +export mode=wal + +./_build-and-test-all.sh $* -P eventuateDriver=local diff --git a/single-module/build.gradle b/single-module/build.gradle index f2ac524..7a0d7db 100755 --- a/single-module/build.gradle +++ b/single-module/build.gradle @@ -1,9 +1,11 @@ buildscript { repositories { mavenCentral() + jcenter() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion") + classpath "com.avast.gradle:gradle-docker-compose-plugin:0.9.2" } } @@ -16,6 +18,7 @@ apply plugin: 'spring-boot' apply plugin: VerifyEventStoreEnvironmentPlugin apply plugin: EventuateDependencyPlugin +apply plugin: 'docker-compose' sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -59,3 +62,42 @@ task e2eTest(type: Test) { includeTestsMatching "net.chrisrichardson.eventstore.examples.todolist.e2etests.*" } } + +dockerCompose { + environment.put "EVENTUATE_COMMON_VERSION", eventuateCommonImageVersion + environment.put "EVENTUATE_KAFKA_VERSION", eventuateMessagingKafkaImageVersion + environment.put "EVENTUATE_CDC_VERSION", eventuateCdcImageVersion + + mysqlbinlog { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-mysql.yml"] + } + + mysqlbinlogcdc { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-mysql.yml"] + startedServices = ["cdcservice"] + } + + postgrespolling { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-postgres-polling.yml"] + } + + postgrespollingcdc { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-postgres-polling.yml"] + startedServices = ["cdcservice"] + } + + postgreswal { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-postgres-wal.yml"] + } + + postgreswalcdc { + projectName = null + useComposeFiles = ["docker-compose-eventuate-local-postgres-wal.yml"] + startedServices = ["cdcservice"] + } +} \ No newline at end of file diff --git a/single-module/docker-compose-eventuate-local-mysql.yml b/single-module/docker-compose-eventuate-local-mysql.yml index b0cd0af..d86b46c 100644 --- a/single-module/docker-compose-eventuate-local-mysql.yml +++ b/single-module/docker-compose-eventuate-local-mysql.yml @@ -1,15 +1,13 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE + image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION ports: - 2181:2181 - - 2888:2888 - - 3888:3888 kafka: - image: eventuateio/eventuate-kafka:0.3.0.RELEASE + image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION ports: - 9092:9092 depends_on: @@ -20,7 +18,7 @@ services: - ZOOKEEPER_SERVERS=zookeeper:2181 cdcservice: - image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE + image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" depends_on: @@ -43,7 +41,10 @@ services: EVENTUATE_CDC_TYPE: EventuateLocal mysql: - build: ./mysql + build: + context: ./mysql + args: + EVENTUATE_COMMON_VERSION: "$EVENTUATE_COMMON_VERSION" ports: - 3306:3306 environment: diff --git a/single-module/docker-compose-eventuate-local-postgres-polling.yml b/single-module/docker-compose-eventuate-local-postgres-polling.yml index 600ae83..1d09d36 100644 --- a/single-module/docker-compose-eventuate-local-postgres-polling.yml +++ b/single-module/docker-compose-eventuate-local-postgres-polling.yml @@ -1,14 +1,12 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE + image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION ports: - 2181:2181 - - 2888:2888 - - 3888:3888 kafka: - image: eventuateio/eventuate-kafka:0.3.0.RELEASE + image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION ports: - 9092:9092 depends_on: @@ -19,7 +17,10 @@ services: - ZOOKEEPER_SERVERS=zookeeper:2181 postgres: - build: ./postgres + build: + context: ./postgres + args: + EVENTUATE_COMMON_VERSION: "$EVENTUATE_COMMON_VERSION" ports: - 5432:5432 environment: @@ -27,7 +28,7 @@ services: POSTGRES_PASSWORD: eventuate cdcservice: - image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE + image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" depends_on: diff --git a/single-module/docker-compose-eventuate-local-postgres-wal.yml b/single-module/docker-compose-eventuate-local-postgres-wal.yml index a99bc03..93cf828 100644 --- a/single-module/docker-compose-eventuate-local-postgres-wal.yml +++ b/single-module/docker-compose-eventuate-local-postgres-wal.yml @@ -1,14 +1,12 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:0.8.0.RELEASE + image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION ports: - 2181:2181 - - 2888:2888 - - 3888:3888 kafka: - image: eventuateio/eventuate-kafka:0.3.0.RELEASE + image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION ports: - 9092:9092 depends_on: @@ -19,7 +17,10 @@ services: - ZOOKEEPER_SERVERS=zookeeper:2181 postgres: - build: ./postgres + build: + context: ./postgres + args: + EVENTUATE_COMMON_VERSION: "$EVENTUATE_COMMON_VERSION" ports: - 5432:5432 environment: @@ -27,7 +28,7 @@ services: POSTGRES_PASSWORD: eventuate cdcservice: - image: eventuateio/eventuate-cdc-service:0.5.0.RELEASE + image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" depends_on: diff --git a/single-module/gradle.properties b/single-module/gradle.properties index bc9c180..061997b 100755 --- a/single-module/gradle.properties +++ b/single-module/gradle.properties @@ -8,3 +8,7 @@ springBootVersion=1.5.10.RELEASE eventuateClientVersion=0.22.0.RC1 eventuateLocalVersion=0.31.0.RC3 + +eventuateCommonImageVersion=0.8.0.RELEASE +eventuateMessagingKafkaImageVersion=0.3.0.RELEASE +eventuateCdcImageVersion=0.5.0.RELEASE diff --git a/single-module/mysql/Dockerfile b/single-module/mysql/Dockerfile index 9964504..d090a13 100644 --- a/single-module/mysql/Dockerfile +++ b/single-module/mysql/Dockerfile @@ -1,2 +1,3 @@ -FROM eventuateio/eventuate-mysql:0.8.0.RELEASE +ARG EVENTUATE_COMMON_VERSION +FROM eventuateio/eventuate-mysql:$EVENTUATE_COMMON_VERSION COPY schema-mysql.sql /docker-entrypoint-initdb.d diff --git a/single-module/postgres/Dockerfile b/single-module/postgres/Dockerfile index 15cb832..62b744d 100644 --- a/single-module/postgres/Dockerfile +++ b/single-module/postgres/Dockerfile @@ -1,2 +1,3 @@ -FROM eventuateio/eventuate-postgres:0.8.0.RELEASE +ARG EVENTUATE_COMMON_VERSION +FROM eventuateio/eventuate-postgres:$EVENTUATE_COMMON_VERSION COPY schema-postgres.sql /docker-entrypoint-initdb.d From 3dd25480c6a2908d81599f000abd937e133b6f0f Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Tue, 10 Sep 2019 16:08:26 +0300 Subject: [PATCH 3/7] Fixed readme. Improved test script. --- README.md | 9 +++++++-- single-module/_build-and-test-all.sh | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 92afe78..b6e3009 100644 --- a/README.md +++ b/README.md @@ -84,10 +84,15 @@ Next, launch the services using [Docker Compose](https://docs.docker.com/compose ``` export DOCKER_HOST_IP=... -docker-compose -f docker-compose-eventuate-local.yml build -docker-compose -f docker-compose-eventuate-local.yml up -d +./gradlew ComposeBuild ``` +Where `database-mode` is one of: + +* `mysqlbinlog` - use MySQL with Binlog-based event publishing +* `postgreswal` - use Postgres with Postgres WAL-based event publishing +* `postgrespolling` - use Postgres with generic JDBC polling-based event publishing + Note: You need to set `DOCKER_HOST_IP` before running Docker Compose. This must be an IP address or resolvable hostname. It cannot be `localhost`. diff --git a/single-module/_build-and-test-all.sh b/single-module/_build-and-test-all.sh index ea81b91..1c5b9d8 100755 --- a/single-module/_build-and-test-all.sh +++ b/single-module/_build-and-test-all.sh @@ -2,6 +2,8 @@ set -e +docker="./gradlew ${database}${mode}Compose" + if [ -z "$DOCKER_HOST_IP" ] ; then if [ -z "$DOCKER_HOST" ] ; then export DOCKER_HOST_IP=`hostname` @@ -16,7 +18,7 @@ fi if [ "$1" = "--use-existing" ] ; then shift; else - ./gradlew ${database}${mode}ComposeDown + ${docker}Down fi @@ -41,13 +43,13 @@ fi ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS --offline $* cleanTest -./gradlew ${database}${mode}ComposeBuild -./gradlew ${database}${mode}ComposeUp +${docker}Build +${docker}Up ./wait-for-services.sh $DOCKER_HOST_IP 8080 ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS --offline $* e2eTest if [ $NO_RM = false ] ; then - ./gradlew ${database}${mode}ComposeDown + ${docker}Down fi From bbc3f869aab5caa33a4b48f61036b2f9b6b2a902 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Tue, 10 Sep 2019 17:13:31 +0300 Subject: [PATCH 4/7] Fixed readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b6e3009..4c108e4 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ Next, launch the services using [Docker Compose](https://docs.docker.com/compose ``` export DOCKER_HOST_IP=... ./gradlew ComposeBuild +./gradlew ComposeUp ``` Where `database-mode` is one of: From cae4c8289cbba5b0bcb28177bb6d12a4ddc3180d Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Thu, 12 Mar 2020 16:06:21 +0300 Subject: [PATCH 5/7] Updated libraries. Removed SaaS version. Updated Readme. --- README.md | 18 ---------- multi-module/_build-and-test-all.sh | 5 --- .../groovy/EventuateDependencyPlugin.groovy | 15 -------- multi-module/docker-compose.yml | 36 ------------------- multi-module/gradle.properties | 10 +++--- multi-module/todo-service/build.gradle | 3 +- .../todolist/todoservice/TodoServiceMain.java | 2 +- multi-module/todo-view-service/build.gradle | 3 +- .../queryside/TodoViewServiceMain.java | 2 +- single-module/_build-and-test-all.sh | 5 --- single-module/build.gradle | 4 +-- .../groovy/EventuateDependencyPlugin.groovy | 15 -------- single-module/docker-compose.yml | 24 ------------- single-module/gradle.properties | 10 +++--- .../TodoStandaloneServiceConfiguration.java | 2 +- 15 files changed, 19 insertions(+), 135 deletions(-) delete mode 100644 multi-module/buildSrc/src/main/groovy/EventuateDependencyPlugin.groovy delete mode 100755 multi-module/docker-compose.yml delete mode 100644 single-module/buildSrc/src/main/groovy/EventuateDependencyPlugin.groovy delete mode 100755 single-module/docker-compose.yml diff --git a/README.md b/README.md index 4c108e4..33625be 100644 --- a/README.md +++ b/README.md @@ -53,24 +53,6 @@ You just need to have Java 8 installed. # Building and running the application The steps for building both versions of the application are identical. -However, the details of how to build and run the services depend slightly on whether you are using Eventuate SaaS or Eventuate Local. - -## Building and running using Eventuate SaaS - -First, must [sign up to get your credentials](https://signup.eventuate.io/) in order to get free access to the SaaS version. - -Next, build the application - -``` -./gradlew assemble -``` - -Next, you can launch the services using [Docker Compose](https://docs.docker.com/compose/): - -``` -docker-compose build -docker-compose up -d -``` ## Building and running using Eventuate Local diff --git a/multi-module/_build-and-test-all.sh b/multi-module/_build-and-test-all.sh index 08e2e37..2a93a27 100755 --- a/multi-module/_build-and-test-all.sh +++ b/multi-module/_build-and-test-all.sh @@ -39,11 +39,6 @@ fi ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS $* build -x :e2etest:test -if [ -z "$EVENTUATE_LOCAL" ] && [ -z "$EVENTUATE_API_KEY_ID" -o -z "$EVENTUATE_API_KEY_SECRET" ] ; then - echo You must set EVENTUATE_API_KEY_ID and EVENTUATE_API_KEY_SECRET - exit -1 -fi - ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS --offline $* :e2etest:cleanTest :e2etest:testClasses ./gradlew ${database}${mode}ComposeBuild diff --git a/multi-module/buildSrc/src/main/groovy/EventuateDependencyPlugin.groovy b/multi-module/buildSrc/src/main/groovy/EventuateDependencyPlugin.groovy deleted file mode 100644 index b46a859..0000000 --- a/multi-module/buildSrc/src/main/groovy/EventuateDependencyPlugin.groovy +++ /dev/null @@ -1,15 +0,0 @@ -import org.gradle.api.Plugin -import org.gradle.api.Project - -class EventuateDependencyPlugin implements Plugin { - - @Override - void apply(Project project) { - project.dependencies { - if (project.hasProperty("eventuateDriver") && project.property("eventuateDriver") == "local") { - compile "io.eventuate.local.java:eventuate-local-java-jdbc:${project.eventuateLocalVersion}" - } else - compile "io.eventuate.client.java:eventuate-client-java-http-stomp-spring:${project.eventuateClientVersion}" - } - } -} diff --git a/multi-module/docker-compose.yml b/multi-module/docker-compose.yml deleted file mode 100755 index 31a5813..0000000 --- a/multi-module/docker-compose.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: '3' -services: - commandsideservice: - build: ./todo-service/ - restart: unless-stopped - ports: - - "8081:8080" - depends_on: - - mysql - environment: - EVENTUATE_API_KEY_ID: ${EVENTUATE_API_KEY_ID} - EVENTUATE_API_KEY_SECRET: ${EVENTUATE_API_KEY_SECRET} - SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate - - querysideservice: - build: ./todo-view-service/ - restart: unless-stopped - ports: - - "8082:8080" - depends_on: - - mysql - environment: - EVENTUATE_API_KEY_ID: ${EVENTUATE_API_KEY_ID} - EVENTUATE_API_KEY_SECRET: ${EVENTUATE_API_KEY_SECRET} - SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate - - mysql: - build: ./mysql - ports: - - 3306:3306 - environment: - - MYSQL_ROOT_PASSWORD=rootpassword - - MYSQL_USER=mysqluser - - MYSQL_PASSWORD=mysqlpw - - diff --git a/multi-module/gradle.properties b/multi-module/gradle.properties index 4de0a07..527a21f 100755 --- a/multi-module/gradle.properties +++ b/multi-module/gradle.properties @@ -7,9 +7,9 @@ springHateoasVersion=0.17.0.RELEASE springBootVersion=1.5.10.RELEASE -eventuateClientVersion=0.22.0.RC1 -eventuateLocalVersion=0.31.0.RC3 +eventuateClientVersion=0.23.0.RC4 +eventuateLocalVersion=0.32.0.RC4 -eventuateCommonImageVersion=0.8.0.RELEASE -eventuateMessagingKafkaImageVersion=0.3.0.RELEASE -eventuateCdcImageVersion=0.5.0.RELEASE \ No newline at end of file +eventuateCommonImageVersion=0.9.0.RC4 +eventuateMessagingKafkaImageVersion=0.9.0.RC4 +eventuateCdcImageVersion=0.6.0.RC4 diff --git a/multi-module/todo-service/build.gradle b/multi-module/todo-service/build.gradle index 0341918..a8c3bb1 100644 --- a/multi-module/todo-service/build.gradle +++ b/multi-module/todo-service/build.gradle @@ -1,5 +1,4 @@ apply plugin: VerifyEventStoreEnvironmentPlugin -apply plugin: EventuateDependencyPlugin apply plugin: 'spring-boot' @@ -8,6 +7,8 @@ dependencies { compile project(":common-hateoas") compile project(":common-swagger") + compile "io.eventuate.local.java:eventuate-local-java-spring-jdbc:$eventuateLocalVersion" + compile 'mysql:mysql-connector-java:5.1.36' compile("org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion") diff --git a/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/TodoServiceMain.java b/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/TodoServiceMain.java index c73964d..dbb1cba 100755 --- a/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/TodoServiceMain.java +++ b/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/TodoServiceMain.java @@ -1,6 +1,6 @@ package net.chrisrichardson.eventstore.examples.todolist.todoservice; -import io.eventuate.javaclient.driver.EventuateDriverConfiguration; +import io.eventuate.local.java.spring.javaclient.driver.EventuateDriverConfiguration; import net.chrisrichardson.eventstore.examples.todolist.commonswagger.CommonSwaggerConfiguration; import net.chrisrichardson.eventstore.examples.todolist.todoservice.web.TodoWebConfiguration; import org.springframework.boot.SpringApplication; diff --git a/multi-module/todo-view-service/build.gradle b/multi-module/todo-view-service/build.gradle index da09522..06c5b4b 100644 --- a/multi-module/todo-view-service/build.gradle +++ b/multi-module/todo-view-service/build.gradle @@ -1,5 +1,4 @@ apply plugin: VerifyEventStoreEnvironmentPlugin -apply plugin: EventuateDependencyPlugin apply plugin: 'spring-boot' dependencies { @@ -7,6 +6,8 @@ dependencies { compile project(":common-hateoas") compile project(":common-swagger") + compile "io.eventuate.local.java:eventuate-local-java-spring-jdbc:${project.eventuateLocalVersion}" + compile 'mysql:mysql-connector-java:5.1.36' compile("org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion") diff --git a/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/TodoViewServiceMain.java b/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/TodoViewServiceMain.java index 5e54a6f..7fb7227 100755 --- a/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/TodoViewServiceMain.java +++ b/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/TodoViewServiceMain.java @@ -1,6 +1,6 @@ package net.chrisrichardson.eventstore.examples.todolist.queryside; -import io.eventuate.javaclient.driver.EventuateDriverConfiguration; +import io.eventuate.local.java.spring.javaclient.driver.EventuateDriverConfiguration; import net.chrisrichardson.eventstore.examples.todolist.commonswagger.CommonSwaggerConfiguration; import net.chrisrichardson.eventstore.examples.todolist.queryside.web.TodoViewWebConfiguration; import org.springframework.boot.SpringApplication; diff --git a/single-module/_build-and-test-all.sh b/single-module/_build-and-test-all.sh index 1c5b9d8..92c7893 100755 --- a/single-module/_build-and-test-all.sh +++ b/single-module/_build-and-test-all.sh @@ -36,11 +36,6 @@ fi ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS $* build -if [ -z "$EVENTUATE_LOCAL" ] && [ -z "$EVENTUATE_API_KEY_ID" -o -z "$EVENTUATE_API_KEY_SECRET" ] ; then - echo You must set EVENTUATE_API_KEY_ID and EVENTUATE_API_KEY_SECRET - exit -1 -fi - ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS --offline $* cleanTest ${docker}Build diff --git a/single-module/build.gradle b/single-module/build.gradle index 7a0d7db..c9bbf83 100755 --- a/single-module/build.gradle +++ b/single-module/build.gradle @@ -17,7 +17,6 @@ apply plugin: 'java' apply plugin: 'spring-boot' apply plugin: VerifyEventStoreEnvironmentPlugin -apply plugin: EventuateDependencyPlugin apply plugin: 'docker-compose' sourceCompatibility = 1.8 @@ -31,6 +30,7 @@ repositories { dependencies { compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion" + compile "io.eventuate.local.java:eventuate-local-java-spring-jdbc:$eventuateLocalVersion" compile 'mysql:mysql-connector-java:5.1.36' compile('org.postgresql:postgresql:9.4-1200-jdbc41') { @@ -50,7 +50,7 @@ dependencies { testCompile "junit:junit:4.12" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" - testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion" + testCompile "io.eventuate.client.java:eventuate-client-java-spring-jdbc:$eventuateClientVersion" } test { diff --git a/single-module/buildSrc/src/main/groovy/EventuateDependencyPlugin.groovy b/single-module/buildSrc/src/main/groovy/EventuateDependencyPlugin.groovy deleted file mode 100644 index b46a859..0000000 --- a/single-module/buildSrc/src/main/groovy/EventuateDependencyPlugin.groovy +++ /dev/null @@ -1,15 +0,0 @@ -import org.gradle.api.Plugin -import org.gradle.api.Project - -class EventuateDependencyPlugin implements Plugin { - - @Override - void apply(Project project) { - project.dependencies { - if (project.hasProperty("eventuateDriver") && project.property("eventuateDriver") == "local") { - compile "io.eventuate.local.java:eventuate-local-java-jdbc:${project.eventuateLocalVersion}" - } else - compile "io.eventuate.client.java:eventuate-client-java-http-stomp-spring:${project.eventuateClientVersion}" - } - } -} diff --git a/single-module/docker-compose.yml b/single-module/docker-compose.yml deleted file mode 100755 index 62f4c76..0000000 --- a/single-module/docker-compose.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: '3' -services: - standaloneservice: - build: ./ - restart: unless-stopped - ports: - - "8080:8080" - volumes: - - ./build/libs:/app - depends_on: - - mysql - environment: - EVENTUATE_API_KEY_ID: ${EVENTUATE_API_KEY_ID} - EVENTUATE_API_KEY_SECRET: ${EVENTUATE_API_KEY_SECRET} - SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate - - mysql: - build: ./mysql - ports: - - 3306:3306 - environment: - - MYSQL_ROOT_PASSWORD=rootpassword - - MYSQL_USER=mysqluser - - MYSQL_PASSWORD=mysqlpw diff --git a/single-module/gradle.properties b/single-module/gradle.properties index 061997b..2d2e253 100755 --- a/single-module/gradle.properties +++ b/single-module/gradle.properties @@ -6,9 +6,9 @@ eventuateMavenRepoUrl=https://dl.bintray.com/eventuateio-oss/eventuate-maven-rel springHateoasVersion=0.17.0.RELEASE springBootVersion=1.5.10.RELEASE -eventuateClientVersion=0.22.0.RC1 -eventuateLocalVersion=0.31.0.RC3 +eventuateClientVersion=0.23.0.RC4 +eventuateLocalVersion=0.32.0.RC4 -eventuateCommonImageVersion=0.8.0.RELEASE -eventuateMessagingKafkaImageVersion=0.3.0.RELEASE -eventuateCdcImageVersion=0.5.0.RELEASE +eventuateCommonImageVersion=0.9.0.RC4 +eventuateMessagingKafkaImageVersion=0.9.0.RC4 +eventuateCdcImageVersion=0.6.0.RC4 diff --git a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/TodoStandaloneServiceConfiguration.java b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/TodoStandaloneServiceConfiguration.java index a767f7b..7be7f65 100755 --- a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/TodoStandaloneServiceConfiguration.java +++ b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/TodoStandaloneServiceConfiguration.java @@ -1,6 +1,6 @@ package net.chrisrichardson.eventstore.examples.todolist; -import io.eventuate.javaclient.driver.EventuateDriverConfiguration; +import io.eventuate.local.java.spring.javaclient.driver.EventuateDriverConfiguration; import net.chrisrichardson.eventstore.examples.todolist.backend.TodoBackendConfiguration; import net.chrisrichardson.eventstore.examples.todolist.commonswagger.CommonSwaggerConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; From 50d8a84aa61d7f12da4c0a050a26b9add87416b5 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Fri, 26 Jun 2020 19:26:19 +0300 Subject: [PATCH 6/7] Removed redundant env variables. --- multi-module/_set-env.sh | 1 - multi-module/docker-compose-eventuate-local-mysql.yml | 3 --- .../docker-compose-eventuate-local-postgres-polling.yml | 8 -------- .../docker-compose-eventuate-local-postgres-wal.yml | 4 ---- multi-module/set-env-mysql.sh | 2 -- single-module/_set-env.sh | 1 - single-module/docker-compose-eventuate-local-mysql.yml | 2 -- .../docker-compose-eventuate-local-postgres-polling.yml | 7 ------- .../docker-compose-eventuate-local-postgres-wal.yml | 3 --- single-module/set-env-mysql.sh | 2 -- 10 files changed, 33 deletions(-) diff --git a/multi-module/_set-env.sh b/multi-module/_set-env.sh index afa885b..ebdc81f 100755 --- a/multi-module/_set-env.sh +++ b/multi-module/_set-env.sh @@ -11,5 +11,4 @@ fi echo DOCKER_HOST_IP is $DOCKER_HOST_IP export EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS=$DOCKER_HOST_IP:9092 -export EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING=$DOCKER_HOST_IP:2181 export COMPOSE_HTTP_TIMEOUT=240 diff --git a/multi-module/docker-compose-eventuate-local-mysql.yml b/multi-module/docker-compose-eventuate-local-mysql.yml index d56659d..016c891 100644 --- a/multi-module/docker-compose-eventuate-local-mysql.yml +++ b/multi-module/docker-compose-eventuate-local-mysql.yml @@ -37,7 +37,6 @@ services: EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword EVENTUATELOCAL_CDC_READ_OLD_DEBEZIUM_DB_OFFSET_STORAGE_TOPIC: "false" EVENTUATELOCAL_CDC_READER_NAME: MySqlReader - EVENTUATELOCAL_CDC_OFFSET_STORE_KEY: MySqlBinlog EVENTUATELOCAL_CDC_MYSQL_BINLOG_CLIENT_UNIQUE_ID: 1234567890 EVENTUATE_CDC_TYPE: EventuateLocal @@ -69,7 +68,6 @@ services: SPRING_DATASOURCE_PASSWORD: mysqlpw SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 - EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 EVENTUATELOCAL_CDC_DB_USER_NAME: root EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword @@ -88,7 +86,6 @@ services: SPRING_DATASOURCE_PASSWORD: mysqlpw SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 - EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 EVENTUATELOCAL_CDC_DB_USER_NAME: root EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword diff --git a/multi-module/docker-compose-eventuate-local-postgres-polling.yml b/multi-module/docker-compose-eventuate-local-postgres-polling.yml index 434cafb..af74e20 100644 --- a/multi-module/docker-compose-eventuate-local-postgres-polling.yml +++ b/multi-module/docker-compose-eventuate-local-postgres-polling.yml @@ -39,15 +39,9 @@ services: SPRING_DATASOURCE_URL: jdbc:postgresql://postgres/eventuate SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate - SPRING_DATASOURCE_TEST_ON_BORROW: "true" - SPRING_DATASOURCE_VALIDATION_QUERY: SELECT 1 SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 - EVENTUATELOCAL_CDC_POLLING_INTERVAL_IN_MILLISECONDS: 500 - EVENTUATELOCAL_CDC_MAX_EVENTS_PER_POLLING: 1000 - EVENTUATELOCAL_CDC_MAX_ATTEMPTS_FOR_POLLING: 100 - EVENTUATELOCAL_CDC_POLLING_RETRY_INTERVAL_IN_MILLISECONDS: 500 SPRING_PROFILES_ACTIVE: EventuatePolling EVENTUATELOCAL_CDC_READER_NAME: PostgresPollingReader EVENTUATE_CDC_TYPE: EventuateLocal @@ -67,7 +61,6 @@ services: SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 - EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 querysideservice: build: ./todo-view-service/ @@ -84,7 +77,6 @@ services: SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 - EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 consoleserver: image: eventuateio/eventuateio-local-console:0.15.0 diff --git a/multi-module/docker-compose-eventuate-local-postgres-wal.yml b/multi-module/docker-compose-eventuate-local-postgres-wal.yml index 32a7835..92bbb00 100644 --- a/multi-module/docker-compose-eventuate-local-postgres-wal.yml +++ b/multi-module/docker-compose-eventuate-local-postgres-wal.yml @@ -39,8 +39,6 @@ services: SPRING_DATASOURCE_URL: jdbc:postgresql://postgres/eventuate SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate - SPRING_DATASOURCE_TEST_ON_BORROW: "true" - SPRING_DATASOURCE_VALIDATION_QUERY: SELECT 1 SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 @@ -63,7 +61,6 @@ services: SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 - EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 querysideservice: build: ./todo-view-service/ @@ -80,7 +77,6 @@ services: SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 - EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 consoleserver: image: eventuateio/eventuateio-local-console:0.15.0 diff --git a/multi-module/set-env-mysql.sh b/multi-module/set-env-mysql.sh index ec0ea6d..d82db25 100755 --- a/multi-module/set-env-mysql.sh +++ b/multi-module/set-env-mysql.sh @@ -4,5 +4,3 @@ export SPRING_DATASOURCE_URL=jdbc:mysql://${DOCKER_HOST_IP}/eventuate export SPRING_DATASOURCE_USERNAME=mysqluser export SPRING_DATASOURCE_PASSWORD=mysqlpw export SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.jdbc.Driver -export EVENTUATELOCAL_CDC_DB_USER_NAME=root -export EVENTUATELOCAL_CDC_DB_PASSWORD=rootpassword diff --git a/single-module/_set-env.sh b/single-module/_set-env.sh index afa885b..ebdc81f 100644 --- a/single-module/_set-env.sh +++ b/single-module/_set-env.sh @@ -11,5 +11,4 @@ fi echo DOCKER_HOST_IP is $DOCKER_HOST_IP export EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS=$DOCKER_HOST_IP:9092 -export EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING=$DOCKER_HOST_IP:2181 export COMPOSE_HTTP_TIMEOUT=240 diff --git a/single-module/docker-compose-eventuate-local-mysql.yml b/single-module/docker-compose-eventuate-local-mysql.yml index d86b46c..eb59ba8 100644 --- a/single-module/docker-compose-eventuate-local-mysql.yml +++ b/single-module/docker-compose-eventuate-local-mysql.yml @@ -36,7 +36,6 @@ services: EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword EVENTUATELOCAL_CDC_READ_OLD_DEBEZIUM_DB_OFFSET_STORAGE_TOPIC: "false" EVENTUATELOCAL_CDC_READER_NAME: MySqlReader - EVENTUATELOCAL_CDC_OFFSET_STORE_KEY: MySqlBinlog EVENTUATELOCAL_CDC_MYSQL_BINLOG_CLIENT_UNIQUE_ID: 1234567890 EVENTUATE_CDC_TYPE: EventuateLocal @@ -69,7 +68,6 @@ services: SPRING_DATASOURCE_PASSWORD: mysqlpw SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 - EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 EVENTUATELOCAL_CDC_DB_USER_NAME: root EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword diff --git a/single-module/docker-compose-eventuate-local-postgres-polling.yml b/single-module/docker-compose-eventuate-local-postgres-polling.yml index 1d09d36..6c039f9 100644 --- a/single-module/docker-compose-eventuate-local-postgres-polling.yml +++ b/single-module/docker-compose-eventuate-local-postgres-polling.yml @@ -39,15 +39,9 @@ services: SPRING_DATASOURCE_URL: jdbc:postgresql://postgres/eventuate SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate - SPRING_DATASOURCE_TEST_ON_BORROW: "true" - SPRING_DATASOURCE_VALIDATION_QUERY: SELECT 1 SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 - EVENTUATELOCAL_CDC_POLLING_INTERVAL_IN_MILLISECONDS: 500 - EVENTUATELOCAL_CDC_MAX_EVENTS_PER_POLLING: 1000 - EVENTUATELOCAL_CDC_MAX_ATTEMPTS_FOR_POLLING: 100 - EVENTUATELOCAL_CDC_POLLING_RETRY_INTERVAL_IN_MILLISECONDS: 500 SPRING_PROFILES_ACTIVE: EventuatePolling EVENTUATELOCAL_CDC_READER_NAME: PostgresPollingReader EVENTUATE_CDC_TYPE: EventuateLocal @@ -69,7 +63,6 @@ services: SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 - EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 consoleserver: image: eventuateio/eventuateio-local-console:0.15.0 diff --git a/single-module/docker-compose-eventuate-local-postgres-wal.yml b/single-module/docker-compose-eventuate-local-postgres-wal.yml index 93cf828..8e76bba 100644 --- a/single-module/docker-compose-eventuate-local-postgres-wal.yml +++ b/single-module/docker-compose-eventuate-local-postgres-wal.yml @@ -39,8 +39,6 @@ services: SPRING_DATASOURCE_URL: jdbc:postgresql://postgres/eventuate SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate - SPRING_DATASOURCE_TEST_ON_BORROW: "true" - SPRING_DATASOURCE_VALIDATION_QUERY: SELECT 1 SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 @@ -65,7 +63,6 @@ services: SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 - EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 consoleserver: image: eventuateio/eventuateio-local-console:0.15.0 diff --git a/single-module/set-env-mysql.sh b/single-module/set-env-mysql.sh index ec0ea6d..d82db25 100644 --- a/single-module/set-env-mysql.sh +++ b/single-module/set-env-mysql.sh @@ -4,5 +4,3 @@ export SPRING_DATASOURCE_URL=jdbc:mysql://${DOCKER_HOST_IP}/eventuate export SPRING_DATASOURCE_USERNAME=mysqluser export SPRING_DATASOURCE_PASSWORD=mysqlpw export SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.jdbc.Driver -export EVENTUATELOCAL_CDC_DB_USER_NAME=root -export EVENTUATELOCAL_CDC_DB_PASSWORD=rootpassword From cb5c586c94198da3f9d9e3f809351944cc976602 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Fri, 11 Sep 2020 18:08:36 +0300 Subject: [PATCH 7/7] #36: Upgrade dependencies, update according the style guide. --- .circleci/config.yml | 1 + .circleci/upgrade-docker-compose.sh | 10 ++++ multi-module/_build-and-test-all.sh | 13 ----- multi-module/_set-env.sh | 14 ------ ...uild-and-test-all-eventuate-local-mysql.sh | 5 -- ...st-all-eventuate-local-postgres-polling.sh | 5 -- ...d-test-all-eventuate-local-postgres-wal.sh | 5 -- multi-module/build-and-test-all.sh | 2 + multi-module/build.gradle | 12 ++--- multi-module/common-hateoas/build.gradle | 4 +- .../hateoas/TodoHateoasController.java | 4 +- multi-module/common-swagger/build.gradle | 3 +- .../CommonSwaggerConfiguration.java | 35 ++------------ multi-module/common/build.gradle | 2 +- .../docker-compose-eventuate-local-mysql.yml | 47 ++++++++++++------- ...mpose-eventuate-local-postgres-polling.yml | 44 +++++++++++------ ...r-compose-eventuate-local-postgres-wal.yml | 44 +++++++++++------ .../todolist/e2etests/EndToEndTest.java | 2 +- .../resources/application-postgres.properties | 4 ++ .../src/test/resources/application.properties | 10 ++++ multi-module/gradle.properties | 15 +++--- .../gradle/wrapper/gradle-wrapper.properties | 2 +- multi-module/set-env-mysql.sh | 6 --- multi-module/set-env-postgres.sh | 6 --- multi-module/test-utils/build.gradle | 2 +- .../testutil/BasicWebTestConfiguration.java | 2 +- multi-module/todo-service/Dockerfile | 6 +-- multi-module/todo-service/build.gradle | 4 +- .../backend/TodoBackendConfiguration.java | 2 +- .../backend/TodoViewServiceImpl.java | 11 ++--- .../todoservice/web/TodoController.java | 4 +- multi-module/todo-view-service/Dockerfile | 6 +-- multi-module/todo-view-service/build.gradle | 4 +- .../backend/TodoUpdateServiceImpl.java | 11 ++--- .../backend/TodoViewBackendConfiguration.java | 2 +- .../queryside/web/TodoViewController.java | 4 +- single-module/Dockerfile | 6 +-- single-module/_build-and-test-all.sh | 15 +----- single-module/_set-env.sh | 14 ------ ...uild-and-test-all-eventuate-local-mysql.sh | 4 -- ...st-all-eventuate-local-postgres-polling.sh | 5 +- ...d-test-all-eventuate-local-postgres-wal.sh | 5 +- single-module/build.gradle | 25 +++++----- .../docker-compose-eventuate-local-mysql.yml | 40 ++++++++++------ ...mpose-eventuate-local-postgres-polling.yml | 40 +++++++++++----- ...r-compose-eventuate-local-postgres-wal.yml | 39 ++++++++++----- single-module/gradle.properties | 17 +++---- .../gradle/wrapper/gradle-wrapper.properties | 2 +- single-module/mysql/Dockerfile | 4 +- single-module/postgres/Dockerfile | 4 +- single-module/set-env-mysql.sh | 6 --- single-module/set-env-postgres.sh | 6 --- .../todolist/backend/TodoQueryService.java | 13 ++--- .../CommonSwaggerConfiguration.java | 35 ++------------ .../examples/todolist/web/TodoController.java | 4 +- .../todolist/web/TodoViewController.java | 4 +- .../todolist/web/TodoWebConfiguration.java | 2 +- .../resources/application-postgres.properties | 4 ++ .../src/main/resources/application.properties | 5 +- .../integration/RestAPITestConfiguration.java | 1 + .../testutil/BasicWebTestConfiguration.java | 2 +- .../resources/application-postgres.properties | 4 ++ .../src/test/resources/application.properties | 8 ++++ 63 files changed, 311 insertions(+), 356 deletions(-) create mode 100755 .circleci/upgrade-docker-compose.sh delete mode 100755 multi-module/_set-env.sh create mode 100644 multi-module/e2etest/src/test/resources/application-postgres.properties create mode 100644 multi-module/e2etest/src/test/resources/application.properties delete mode 100755 multi-module/set-env-mysql.sh delete mode 100644 multi-module/set-env-postgres.sh delete mode 100644 single-module/_set-env.sh delete mode 100644 single-module/set-env-mysql.sh delete mode 100644 single-module/set-env-postgres.sh create mode 100644 single-module/src/main/resources/application-postgres.properties mode change 100755 => 100644 single-module/src/main/resources/application.properties create mode 100644 single-module/src/test/resources/application-postgres.properties create mode 100644 single-module/src/test/resources/application.properties diff --git a/.circleci/config.yml b/.circleci/config.yml index 8191be6..48df6c2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,6 +23,7 @@ jobs: # fallback to using the latest cache if no exact match is found - v1-dependencies- + - run: ./.circleci/upgrade-docker-compose.sh - run: cd single-module && ./gradlew dependencies - run: cd multi-module && ./gradlew dependencies diff --git a/.circleci/upgrade-docker-compose.sh b/.circleci/upgrade-docker-compose.sh new file mode 100755 index 0000000..2daf1dd --- /dev/null +++ b/.circleci/upgrade-docker-compose.sh @@ -0,0 +1,10 @@ +#! /bin/bash -e + +docker-compose version +docker version +URL="https://github.com/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m`" +echo Downloading from $URL +curl -L $URL > ~/docker-compose +chmod +x ~/docker-compose +sudo mv ~/docker-compose /usr/local/bin/docker-compose +docker-compose version diff --git a/multi-module/_build-and-test-all.sh b/multi-module/_build-and-test-all.sh index 2a93a27..7670156 100755 --- a/multi-module/_build-and-test-all.sh +++ b/multi-module/_build-and-test-all.sh @@ -2,17 +2,6 @@ set -e -if [ -z "$DOCKER_HOST_IP" ] ; then - if [ -z "$DOCKER_HOST" ] ; then - export DOCKER_HOST_IP=`hostname` - else - echo using ${DOCKER_HOST?} - XX=${DOCKER_HOST%\:*} - export DOCKER_HOST_IP=${XX#tcp\:\/\/} - fi - echo set DOCKER_HOST_IP $DOCKER_HOST_IP -fi - if [ "$1" = "--use-existing" ] ; then shift; else @@ -44,8 +33,6 @@ fi ./gradlew ${database}${mode}ComposeBuild ./gradlew ${database}${mode}ComposeUp -./wait-for-services.sh $DOCKER_HOST_IP 8081 8082 $EXTRA_PORTS_TO_WAIT_FOR - ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS --offline $* -P ignoreE2EFailures=false :e2etest:cleanTest :e2etest:test if [ $NO_RM = false ] ; then diff --git a/multi-module/_set-env.sh b/multi-module/_set-env.sh deleted file mode 100755 index ebdc81f..0000000 --- a/multi-module/_set-env.sh +++ /dev/null @@ -1,14 +0,0 @@ -if [ -z "$DOCKER_HOST_IP" ] ; then - if [ -z "$DOCKER_HOST" ] ; then - export DOCKER_HOST_IP=`hostname` - else - echo using ${DOCKER_HOST?} - XX=${DOCKER_HOST%\:*} - export DOCKER_HOST_IP=${XX#tcp\:\/\/} - fi -fi - -echo DOCKER_HOST_IP is $DOCKER_HOST_IP - -export EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS=$DOCKER_HOST_IP:9092 -export COMPOSE_HTTP_TIMEOUT=240 diff --git a/multi-module/build-and-test-all-eventuate-local-mysql.sh b/multi-module/build-and-test-all-eventuate-local-mysql.sh index 271c397..cef257c 100755 --- a/multi-module/build-and-test-all-eventuate-local-mysql.sh +++ b/multi-module/build-and-test-all-eventuate-local-mysql.sh @@ -1,10 +1,5 @@ #! /bin/bash -. ./set-env-mysql.sh - -export EXTRA_PORTS_TO_WAIT_FOR=8099 -export EXTRA_INFRASTRUCTURE_SERVICES=mysqlbinlogcdc -export EVENTUATE_LOCAL=yes export database=mysql export mode=binlog diff --git a/multi-module/build-and-test-all-eventuate-local-postgres-polling.sh b/multi-module/build-and-test-all-eventuate-local-postgres-polling.sh index 4f89ab7..7c3cd5e 100755 --- a/multi-module/build-and-test-all-eventuate-local-postgres-polling.sh +++ b/multi-module/build-and-test-all-eventuate-local-postgres-polling.sh @@ -1,10 +1,5 @@ #! /bin/bash -. ./set-env-postgres.sh - -export EXTRA_PORTS_TO_WAIT_FOR=8099 -export EXTRA_INFRASTRUCTURE_SERVICES=postgreswalcdc -export EVENTUATE_LOCAL=yes export database=postgres export mode=wal diff --git a/multi-module/build-and-test-all-eventuate-local-postgres-wal.sh b/multi-module/build-and-test-all-eventuate-local-postgres-wal.sh index a895196..c9dba6b 100755 --- a/multi-module/build-and-test-all-eventuate-local-postgres-wal.sh +++ b/multi-module/build-and-test-all-eventuate-local-postgres-wal.sh @@ -1,10 +1,5 @@ #! /bin/bash -. ./set-env-postgres.sh - -export EXTRA_PORTS_TO_WAIT_FOR=8099 -export EXTRA_INFRASTRUCTURE_SERVICES=postgrespollingcdc -export EVENTUATE_LOCAL=yes export database=postgres export mode=polling diff --git a/multi-module/build-and-test-all.sh b/multi-module/build-and-test-all.sh index 569dd71..0411727 100755 --- a/multi-module/build-and-test-all.sh +++ b/multi-module/build-and-test-all.sh @@ -1,3 +1,5 @@ #! /bin/bash +export COMPOSE_HTTP_TIMEOUT=240 + ./_build-and-test-all.sh $* diff --git a/multi-module/build.gradle b/multi-module/build.gradle index cf56dd0..24d8461 100755 --- a/multi-module/build.gradle +++ b/multi-module/build.gradle @@ -11,10 +11,6 @@ buildscript { apply plugin: 'docker-compose' -task wrapper(type: Wrapper) { - gradleVersion = '3.5' -} - subprojects { apply plugin: 'java' sourceCompatibility = 1.8 @@ -29,8 +25,8 @@ subprojects { dockerCompose { environment.put "EVENTUATE_COMMON_VERSION", eventuateCommonImageVersion - environment.put "EVENTUATE_KAFKA_VERSION", eventuateMessagingKafkaImageVersion environment.put "EVENTUATE_CDC_VERSION", eventuateCdcImageVersion + environment.put "EVENTUATE_JAVA_BASE_IMAGE_VERSION", eventuateExamplesBaseImageVersion mysqlbinlog { projectName = null @@ -40,7 +36,7 @@ dockerCompose { mysqlbinlogcdc { projectName = null useComposeFiles = ["docker-compose-eventuate-local-mysql.yml"] - startedServices = ["cdcservice"] + startedServices = ["cdc-service"] } postgrespolling { @@ -51,7 +47,7 @@ dockerCompose { postgrespollingcdc { projectName = null useComposeFiles = ["docker-compose-eventuate-local-postgres-polling.yml"] - startedServices = ["cdcservice"] + startedServices = ["cdc-service"] } postgreswal { @@ -62,6 +58,6 @@ dockerCompose { postgreswalcdc { projectName = null useComposeFiles = ["docker-compose-eventuate-local-postgres-wal.yml"] - startedServices = ["cdcservice"] + startedServices = ["cdc-service"] } } \ No newline at end of file diff --git a/multi-module/common-hateoas/build.gradle b/multi-module/common-hateoas/build.gradle index 0fe4b06..73fe21f 100644 --- a/multi-module/common-hateoas/build.gradle +++ b/multi-module/common-hateoas/build.gradle @@ -3,12 +3,12 @@ apply plugin: 'java' dependencies { compile project(":common") - compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion" + compile "io.eventuate.local.java:eventuate-client-java-spring:$eventuateLocalVersion" compile("org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion") compile("org.springframework.boot:spring-boot-starter-web:$springBootVersion") compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" - compile("org.springframework.hateoas:spring-hateoas:$springHateoasVersion") + compile "org.springframework.boot:spring-boot-starter-hateoas:$springBootVersion" testCompile 'junit:junit:4.12' } \ No newline at end of file diff --git a/multi-module/common-hateoas/src/main/java/net/chrisrichardson/eventstore/examples/todolist/hateoas/TodoHateoasController.java b/multi-module/common-hateoas/src/main/java/net/chrisrichardson/eventstore/examples/todolist/hateoas/TodoHateoasController.java index 492330a..ff8a3c1 100644 --- a/multi-module/common-hateoas/src/main/java/net/chrisrichardson/eventstore/examples/todolist/hateoas/TodoHateoasController.java +++ b/multi-module/common-hateoas/src/main/java/net/chrisrichardson/eventstore/examples/todolist/hateoas/TodoHateoasController.java @@ -10,8 +10,8 @@ import java.util.concurrent.CompletableFuture; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.ControllerLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.ControllerLinkBuilder.methodOn; import static org.springframework.web.bind.annotation.RequestMethod.GET; /** diff --git a/multi-module/common-swagger/build.gradle b/multi-module/common-swagger/build.gradle index 9be8459..832a2e9 100644 --- a/multi-module/common-swagger/build.gradle +++ b/multi-module/common-swagger/build.gradle @@ -1,4 +1,3 @@ dependencies { - compile "io.springfox:springfox-swagger2:2.2.2" - compile 'io.springfox:springfox-swagger-ui:2.2.2' + compile "io.eventuate.util:eventuate-util-spring-swagger:$eventuateUtilVersion" } \ No newline at end of file diff --git a/multi-module/common-swagger/src/main/java/net/chrisrichardson/eventstore/examples/todolist/commonswagger/CommonSwaggerConfiguration.java b/multi-module/common-swagger/src/main/java/net/chrisrichardson/eventstore/examples/todolist/commonswagger/CommonSwaggerConfiguration.java index aaecc2c..c6d73a1 100644 --- a/multi-module/common-swagger/src/main/java/net/chrisrichardson/eventstore/examples/todolist/commonswagger/CommonSwaggerConfiguration.java +++ b/multi-module/common-swagger/src/main/java/net/chrisrichardson/eventstore/examples/todolist/commonswagger/CommonSwaggerConfiguration.java @@ -1,43 +1,14 @@ package net.chrisrichardson.eventstore.examples.todolist.commonswagger; -import com.fasterxml.classmate.TypeResolver; -import org.springframework.beans.factory.annotation.Autowired; +import io.eventuate.util.spring.swagger.EventuateSwaggerConfig; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.ResponseEntity; -import org.springframework.web.context.request.async.DeferredResult; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.schema.WildcardType; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -import java.util.concurrent.CompletableFuture; - -import static springfox.documentation.schema.AlternateTypeRules.newRule; @Configuration -@EnableSwagger2 public class CommonSwaggerConfiguration { @Bean - public Docket api() { - return new Docket(DocumentationType.SWAGGER_2) - .select() - .apis(RequestHandlerSelectors.basePackage("net.chrisrichardson.eventstore.examples.todolist")) - .build() - .pathMapping("/") - .genericModelSubstitutes(ResponseEntity.class, CompletableFuture.class) - .alternateTypeRules( - newRule(typeResolver.resolve(DeferredResult.class, - typeResolver.resolve(ResponseEntity.class, WildcardType.class)), - typeResolver.resolve(WildcardType.class)) - ) - .useDefaultResponseMessages(false) - ; + public EventuateSwaggerConfig eventuateSwaggerConfig() { + return () -> "net.chrisrichardson.eventstore.examples.todolist.web"; } - - @Autowired - private TypeResolver typeResolver; - } diff --git a/multi-module/common/build.gradle b/multi-module/common/build.gradle index 7e5cf6d..e81b162 100755 --- a/multi-module/common/build.gradle +++ b/multi-module/common/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'java' dependencies { - compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion" + compile "io.eventuate.local.java:eventuate-client-java-spring:$eventuateLocalVersion" compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" compile("org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion") diff --git a/multi-module/docker-compose-eventuate-local-mysql.yml b/multi-module/docker-compose-eventuate-local-mysql.yml index 016c891..e8e27c5 100644 --- a/multi-module/docker-compose-eventuate-local-mysql.yml +++ b/multi-module/docker-compose-eventuate-local-mysql.yml @@ -1,24 +1,30 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION + image: confluentinc/cp-zookeeper:5.2.4 ports: - 2181:2181 - + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + KAFKA_HEAP_OPTS: -Xmx64m kafka: - image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION + image: "confluentinc/cp-kafka:5.2.4" ports: - 9092:9092 + - 29092:29092 depends_on: - zookeeper environment: - - ADVERTISED_HOST_NAME=${DOCKER_HOST_IP} - - KAFKA_HEAP_OPTS=-Xmx320m -Xms320m - - ZOOKEEPER_SERVERS=zookeeper:2181 + KAFKA_LISTENERS: LC://kafka:29092,LX://kafka:9092 + KAFKA_ADVERTISED_LISTENERS: LC://kafka:29092,LX://${DOCKER_HOST_IP:-localhost}:9092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LC:PLAINTEXT,LX:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: LC + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_HEAP_OPTS: -Xmx192m - - cdcservice: + cdc-service: image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" @@ -31,7 +37,7 @@ services: SPRING_DATASOURCE_USERNAME: mysqluser SPRING_DATASOURCE_PASSWORD: mysqlpw SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 EVENTUATELOCAL_CDC_DB_USER_NAME: root EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword @@ -52,9 +58,12 @@ services: - MYSQL_USER=mysqluser - MYSQL_PASSWORD=mysqlpw - - commandsideservice: - build: ./todo-service/ + todo-service: + build: + context: ./todo-service/ + args: + baseImageVersion: ${EVENTUATE_JAVA_BASE_IMAGE_VERSION?} + image: eventuateexamples/eventuate-examples-java-spring-todo-list-todo-service restart: unless-stopped ports: - "8081:8080" @@ -67,12 +76,16 @@ services: SPRING_DATASOURCE_USERNAME: mysqluser SPRING_DATASOURCE_PASSWORD: mysqlpw SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 EVENTUATELOCAL_CDC_DB_USER_NAME: root EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword - querysideservice: - build: ./todo-view-service/ + todo-view-service: + build: + context: ./todo-view-service/ + args: + baseImageVersion: ${EVENTUATE_JAVA_BASE_IMAGE_VERSION?} + image: eventuateexamples/eventuate-examples-java-spring-todo-list-todo-view-service restart: unless-stopped ports: - "8082:8080" @@ -85,11 +98,11 @@ services: SPRING_DATASOURCE_USERNAME: mysqluser SPRING_DATASOURCE_PASSWORD: mysqlpw SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 EVENTUATELOCAL_CDC_DB_USER_NAME: root EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword - consoleserver: + console-server: image: eventuateio/eventuateio-local-console:0.15.0 depends_on: - mysql diff --git a/multi-module/docker-compose-eventuate-local-postgres-polling.yml b/multi-module/docker-compose-eventuate-local-postgres-polling.yml index af74e20..225606e 100644 --- a/multi-module/docker-compose-eventuate-local-postgres-polling.yml +++ b/multi-module/docker-compose-eventuate-local-postgres-polling.yml @@ -1,20 +1,28 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION + image: confluentinc/cp-zookeeper:5.2.4 ports: - 2181:2181 + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + KAFKA_HEAP_OPTS: -Xmx64m kafka: - image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION + image: "confluentinc/cp-kafka:5.2.4" ports: - 9092:9092 + - 29092:29092 depends_on: - zookeeper environment: - - ADVERTISED_HOST_NAME=${DOCKER_HOST_IP} - - KAFKA_HEAP_OPTS=-Xmx320m -Xms320m - - ZOOKEEPER_SERVERS=zookeeper:2181 + KAFKA_LISTENERS: LC://kafka:29092,LX://kafka:9092 + KAFKA_ADVERTISED_LISTENERS: LC://kafka:29092,LX://${DOCKER_HOST_IP:-localhost}:9092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LC:PLAINTEXT,LX:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: LC + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_HEAP_OPTS: -Xmx192m postgres: build: @@ -27,7 +35,7 @@ services: POSTGRES_USER: eventuate POSTGRES_PASSWORD: eventuate - cdcservice: + cdc-service: image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" @@ -40,14 +48,18 @@ services: SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 SPRING_PROFILES_ACTIVE: EventuatePolling EVENTUATELOCAL_CDC_READER_NAME: PostgresPollingReader EVENTUATE_CDC_TYPE: EventuateLocal - commandsideservice: - build: ./todo-service/ + todo-service: + build: + context: ./todo-service/ + args: + baseImageVersion: ${EVENTUATE_JAVA_BASE_IMAGE_VERSION?} + image: eventuateexamples/eventuate-examples-java-spring-todo-list-todo-service restart: unless-stopped ports: - "8081:8080" @@ -60,10 +72,14 @@ services: SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 - querysideservice: - build: ./todo-view-service/ + todo-view-service: + build: + context: ./todo-view-service/ + args: + baseImageVersion: ${EVENTUATE_JAVA_BASE_IMAGE_VERSION?} + image: eventuateexamples/eventuate-examples-java-spring-todo-list-todo-view-service restart: unless-stopped ports: - "8082:8080" @@ -76,9 +92,9 @@ services: SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 - consoleserver: + console-server: image: eventuateio/eventuateio-local-console:0.15.0 depends_on: - postgres diff --git a/multi-module/docker-compose-eventuate-local-postgres-wal.yml b/multi-module/docker-compose-eventuate-local-postgres-wal.yml index 92bbb00..3de6f9d 100644 --- a/multi-module/docker-compose-eventuate-local-postgres-wal.yml +++ b/multi-module/docker-compose-eventuate-local-postgres-wal.yml @@ -1,20 +1,28 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION + image: confluentinc/cp-zookeeper:5.2.4 ports: - 2181:2181 + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + KAFKA_HEAP_OPTS: -Xmx64m kafka: - image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION + image: "confluentinc/cp-kafka:5.2.4" ports: - 9092:9092 + - 29092:29092 depends_on: - zookeeper environment: - - ADVERTISED_HOST_NAME=${DOCKER_HOST_IP} - - KAFKA_HEAP_OPTS=-Xmx320m -Xms320m - - ZOOKEEPER_SERVERS=zookeeper:2181 + KAFKA_LISTENERS: LC://kafka:29092,LX://kafka:9092 + KAFKA_ADVERTISED_LISTENERS: LC://kafka:29092,LX://${DOCKER_HOST_IP:-localhost}:9092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LC:PLAINTEXT,LX:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: LC + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_HEAP_OPTS: -Xmx192m postgres: build: @@ -27,7 +35,7 @@ services: POSTGRES_USER: eventuate POSTGRES_PASSWORD: eventuate - cdcservice: + cdc-service: image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" @@ -40,14 +48,18 @@ services: SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 SPRING_PROFILES_ACTIVE: PostgresWal EVENTUATELOCAL_CDC_READER_NAME: PostgresWalReader EVENTUATE_CDC_TYPE: EventuateLocal - commandsideservice: - build: ./todo-service/ + todo-service: + build: + context: ./todo-service/ + args: + baseImageVersion: ${EVENTUATE_JAVA_BASE_IMAGE_VERSION?} + image: eventuateexamples/eventuate-examples-java-spring-todo-list-todo-service restart: unless-stopped ports: - "8081:8080" @@ -60,10 +72,14 @@ services: SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 - querysideservice: - build: ./todo-view-service/ + todo-view-service: + build: + context: ./todo-view-service/ + args: + baseImageVersion: ${EVENTUATE_JAVA_BASE_IMAGE_VERSION?} + image: eventuateexamples/eventuate-examples-java-spring-todo-list-todo-view-service restart: unless-stopped ports: - "8082:8080" @@ -76,9 +92,9 @@ services: SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 - consoleserver: + console-server: image: eventuateio/eventuateio-local-console:0.15.0 depends_on: - postgres diff --git a/multi-module/e2etest/src/test/java/net/chrisrichardson/eventstore/examples/todolist/e2etests/EndToEndTest.java b/multi-module/e2etest/src/test/java/net/chrisrichardson/eventstore/examples/todolist/e2etests/EndToEndTest.java index 9ab8896..8b52599 100755 --- a/multi-module/e2etest/src/test/java/net/chrisrichardson/eventstore/examples/todolist/e2etests/EndToEndTest.java +++ b/multi-module/e2etest/src/test/java/net/chrisrichardson/eventstore/examples/todolist/e2etests/EndToEndTest.java @@ -8,7 +8,7 @@ @SpringBootTest(classes = E2ETestConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.NONE) public class EndToEndTest extends AbstractTodoRestAPITest { - @Value("#{systemEnvironment['DOCKER_HOST_IP']}") + @Value("${service.host}") private String hostName; @Override diff --git a/multi-module/e2etest/src/test/resources/application-postgres.properties b/multi-module/e2etest/src/test/resources/application-postgres.properties new file mode 100644 index 0000000..8338266 --- /dev/null +++ b/multi-module/e2etest/src/test/resources/application-postgres.properties @@ -0,0 +1,4 @@ +spring.datasource.url=jdbc:postgresql://${DOCKER_HOST_IP:localhost}/eventuate +spring.datasource.username=eventuate +spring.datasource.password=eventuate +spring.datasource.driver-class-name=org.postgresql.Driver \ No newline at end of file diff --git a/multi-module/e2etest/src/test/resources/application.properties b/multi-module/e2etest/src/test/resources/application.properties new file mode 100644 index 0000000..b8d000e --- /dev/null +++ b/multi-module/e2etest/src/test/resources/application.properties @@ -0,0 +1,10 @@ +spring.autoconfigure.exclude=io.eventuate.util.spring.swagger.CommonSwaggerConfiguration + +eventuatelocal.kafka.bootstrap.servers=${DOCKER_HOST_IP:localhost}:9092 + +service.host=${DOCKER_HOST_IP:localhost} + +spring.datasource.url=jdbc:mysql://${DOCKER_HOST_IP:localhost}/eventuate +spring.datasource.username=mysqluser +spring.datasource.password=mysqlpw +spring.datasource.driver-class-name=com.mysql.jdbc.Driver diff --git a/multi-module/gradle.properties b/multi-module/gradle.properties index 527a21f..33098ab 100755 --- a/multi-module/gradle.properties +++ b/multi-module/gradle.properties @@ -1,15 +1,14 @@ org.gradle.jvmargs=-XX:MaxPermSize=512m -eventuateMavenRepoUrl=https://dl.bintray.com/eventuateio-oss/eventuate-maven-release,https://dl.bintray.com/eventuateio-oss/eventuate-maven-rc +eventuateMavenRepoUrl=https://dl.bintray.com/eventuateio-oss/eventuate-maven-release,https://dl.bintray.com/eventuateio-oss/eventuate-maven-rc,file:///Users/cer/.m2/testdeploy -springHateoasVersion=0.17.0.RELEASE +springBootVersion=2.2.6.RELEASE -springBootVersion=1.5.10.RELEASE +eventuateLocalVersion=0.36.0.BUILD-SNAPSHOT +eventuateUtilVersion=0.8.1.BUILD-SNAPSHOT -eventuateClientVersion=0.23.0.RC4 -eventuateLocalVersion=0.32.0.RC4 +eventuateExamplesBaseImageVersion=BUILD-6 -eventuateCommonImageVersion=0.9.0.RC4 -eventuateMessagingKafkaImageVersion=0.9.0.RC4 -eventuateCdcImageVersion=0.6.0.RC4 +eventuateCommonImageVersion=0.12.0.RELEASE +eventuateCdcImageVersion=0.9.0.RELEASE diff --git a/multi-module/gradle/wrapper/gradle-wrapper.properties b/multi-module/gradle/wrapper/gradle-wrapper.properties index 676177f..243311b 100755 --- a/multi-module/gradle/wrapper/gradle-wrapper.properties +++ b/multi-module/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip \ No newline at end of file diff --git a/multi-module/set-env-mysql.sh b/multi-module/set-env-mysql.sh deleted file mode 100755 index d82db25..0000000 --- a/multi-module/set-env-mysql.sh +++ /dev/null @@ -1,6 +0,0 @@ -. ./_set-env.sh - -export SPRING_DATASOURCE_URL=jdbc:mysql://${DOCKER_HOST_IP}/eventuate -export SPRING_DATASOURCE_USERNAME=mysqluser -export SPRING_DATASOURCE_PASSWORD=mysqlpw -export SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.jdbc.Driver diff --git a/multi-module/set-env-postgres.sh b/multi-module/set-env-postgres.sh deleted file mode 100644 index 374d422..0000000 --- a/multi-module/set-env-postgres.sh +++ /dev/null @@ -1,6 +0,0 @@ -. ./_set-env.sh - -export SPRING_DATASOURCE_URL=jdbc:postgresql://${DOCKER_HOST_IP}/eventuate -export SPRING_DATASOURCE_USERNAME=eventuate -export SPRING_DATASOURCE_PASSWORD=eventuate -export SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver diff --git a/multi-module/test-utils/build.gradle b/multi-module/test-utils/build.gradle index 0bd3ff6..a066285 100755 --- a/multi-module/test-utils/build.gradle +++ b/multi-module/test-utils/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'java' dependencies { compile project(":common") - compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion" + compile "io.eventuate.local.java:eventuate-client-java-spring:$eventuateLocalVersion" compile("org.springframework.boot:spring-boot-starter-web:$springBootVersion") compile "junit:junit:4.12" diff --git a/multi-module/test-utils/src/main/java/net/chrisrichardson/eventstore/examples/todolist/testutil/BasicWebTestConfiguration.java b/multi-module/test-utils/src/main/java/net/chrisrichardson/eventstore/examples/todolist/testutil/BasicWebTestConfiguration.java index d999fa5..dd488cd 100755 --- a/multi-module/test-utils/src/main/java/net/chrisrichardson/eventstore/examples/todolist/testutil/BasicWebTestConfiguration.java +++ b/multi-module/test-utils/src/main/java/net/chrisrichardson/eventstore/examples/todolist/testutil/BasicWebTestConfiguration.java @@ -5,7 +5,7 @@ import org.apache.http.client.HttpClient; import org.apache.http.impl.client.HttpClients; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.web.HttpMessageConverters; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; diff --git a/multi-module/todo-service/Dockerfile b/multi-module/todo-service/Dockerfile index d074a97..9739f2a 100644 --- a/multi-module/todo-service/Dockerfile +++ b/multi-module/todo-service/Dockerfile @@ -1,3 +1,3 @@ -FROM java:openjdk-8u91-jdk -CMD java ${JAVA_OPTS} -jar todo-service.jar -COPY build/libs/todo-service.jar . \ No newline at end of file +ARG baseImageVersion +FROM eventuateio/eventuate-examples-docker-images-spring-example-base-image:$baseImageVersion +COPY build/libs/todo-service.jar service.jar \ No newline at end of file diff --git a/multi-module/todo-service/build.gradle b/multi-module/todo-service/build.gradle index a8c3bb1..0b86984 100644 --- a/multi-module/todo-service/build.gradle +++ b/multi-module/todo-service/build.gradle @@ -1,6 +1,6 @@ apply plugin: VerifyEventStoreEnvironmentPlugin -apply plugin: 'spring-boot' +apply plugin: 'org.springframework.boot' dependencies { compile project(":common") @@ -14,7 +14,7 @@ dependencies { compile("org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion") compile("org.springframework.boot:spring-boot-starter-web:$springBootVersion") compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" - compile("org.springframework.hateoas:spring-hateoas:$springHateoasVersion") + compile "org.springframework.boot:spring-boot-starter-hateoas:$springBootVersion" testCompile project(":test-utils") } \ No newline at end of file diff --git a/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/backend/TodoBackendConfiguration.java b/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/backend/TodoBackendConfiguration.java index a493319..ade3253 100644 --- a/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/backend/TodoBackendConfiguration.java +++ b/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/backend/TodoBackendConfiguration.java @@ -10,7 +10,7 @@ import net.chrisrichardson.eventstore.examples.todolist.todoservice.backend.domain.TodoEventSubscriber; import net.chrisrichardson.eventstore.examples.todolist.todoservice.backend.domain.TodoService; import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.boot.autoconfigure.web.HttpMessageConverters; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; diff --git a/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/backend/TodoViewServiceImpl.java b/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/backend/TodoViewServiceImpl.java index ec860e0..4a35802 100755 --- a/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/backend/TodoViewServiceImpl.java +++ b/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/backend/TodoViewServiceImpl.java @@ -1,7 +1,5 @@ package net.chrisrichardson.eventstore.examples.todolist.todoservice.backend; - - import io.eventuate.CompletableFutureUtil; import net.chrisrichardson.eventstore.examples.todolist.hateoas.TodoUpdateService; import net.chrisrichardson.eventstore.examples.todolist.TodoRepository; @@ -27,11 +25,10 @@ public List getAll() { @Override public CompletableFuture findById(String todoId) { - Todo res = repository.findOne(todoId); - if (res != null) { - return CompletableFuture.completedFuture(res); - } - return CompletableFutureUtil.failedFuture(new EntityNotFoundException("No todo found for given id")); + return repository + .findById(todoId) + .map(CompletableFuture::completedFuture) + .orElse(CompletableFutureUtil.failedFuture(new EntityNotFoundException("No todo found for given id"))); } } diff --git a/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/web/TodoController.java b/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/web/TodoController.java index 0908b91..0adae78 100644 --- a/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/web/TodoController.java +++ b/multi-module/todo-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/todoservice/web/TodoController.java @@ -8,7 +8,7 @@ import net.chrisrichardson.eventstore.examples.todolist.todoservice.backend.TodoViewServiceImpl; import net.chrisrichardson.eventstore.examples.todolist.todoservice.backend.domain.TodoService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.hateoas.mvc.ControllerLinkBuilder; +import org.springframework.hateoas.server.mvc.ControllerLinkBuilder; import org.springframework.util.Assert; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -20,7 +20,7 @@ import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import static org.springframework.web.bind.annotation.RequestMethod.*; diff --git a/multi-module/todo-view-service/Dockerfile b/multi-module/todo-view-service/Dockerfile index 9ed733b..3b74c8a 100644 --- a/multi-module/todo-view-service/Dockerfile +++ b/multi-module/todo-view-service/Dockerfile @@ -1,3 +1,3 @@ -FROM java:openjdk-8u91-jdk -CMD java ${JAVA_OPTS} -jar todo-view-service.jar -COPY build/libs/todo-view-service.jar . \ No newline at end of file +ARG baseImageVersion +FROM eventuateio/eventuate-examples-docker-images-spring-example-base-image:$baseImageVersion +COPY build/libs/todo-view-service.jar service.jar diff --git a/multi-module/todo-view-service/build.gradle b/multi-module/todo-view-service/build.gradle index 06c5b4b..035508d 100644 --- a/multi-module/todo-view-service/build.gradle +++ b/multi-module/todo-view-service/build.gradle @@ -1,5 +1,5 @@ apply plugin: VerifyEventStoreEnvironmentPlugin -apply plugin: 'spring-boot' +apply plugin: 'org.springframework.boot' dependencies { compile project(":common") @@ -13,7 +13,7 @@ dependencies { compile("org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion") compile("org.springframework.boot:spring-boot-starter-web:$springBootVersion") compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" - compile("org.springframework.hateoas:spring-hateoas:$springHateoasVersion") + compile "org.springframework.boot:spring-boot-starter-hateoas:$springBootVersion" testCompile project(":test-utils") } \ No newline at end of file diff --git a/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/backend/TodoUpdateServiceImpl.java b/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/backend/TodoUpdateServiceImpl.java index 2c88531..042a221 100755 --- a/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/backend/TodoUpdateServiceImpl.java +++ b/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/backend/TodoUpdateServiceImpl.java @@ -28,7 +28,7 @@ public List getAll() { } public void remove(String id) { - repository.delete(id); + repository.deleteById(id); } public void removeAll() { @@ -36,11 +36,10 @@ public void removeAll() { } public CompletableFuture findById(String todoId) { - Todo res = repository.findOne(todoId); - if (res != null) { - return CompletableFuture.completedFuture(res); - } - return CompletableFutureUtil.failedFuture(new NoSuchElementException("No todo with given id found")); + return repository + .findById(todoId) + .map(CompletableFuture::completedFuture) + .orElse(CompletableFutureUtil.failedFuture(new NoSuchElementException("No todo with given id found"))); } } diff --git a/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/backend/TodoViewBackendConfiguration.java b/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/backend/TodoViewBackendConfiguration.java index 0075ba2..69fb9cd 100755 --- a/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/backend/TodoViewBackendConfiguration.java +++ b/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/backend/TodoViewBackendConfiguration.java @@ -3,7 +3,7 @@ import io.eventuate.javaclient.spring.EnableEventHandlers; import net.chrisrichardson.eventstore.examples.todolist.TodoRepository; import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.boot.autoconfigure.web.HttpMessageConverters; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; diff --git a/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/web/TodoViewController.java b/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/web/TodoViewController.java index d0b6642..65acb70 100755 --- a/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/web/TodoViewController.java +++ b/multi-module/todo-view-service/src/main/java/net/chrisrichardson/eventstore/examples/todolist/queryside/web/TodoViewController.java @@ -15,8 +15,8 @@ import java.util.List; import java.util.stream.Collectors; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.ControllerLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.ControllerLinkBuilder.methodOn; import static org.springframework.http.HttpStatus.OK; import static org.springframework.web.bind.annotation.RequestMethod.GET; diff --git a/single-module/Dockerfile b/single-module/Dockerfile index 3845b3f..1e73418 100644 --- a/single-module/Dockerfile +++ b/single-module/Dockerfile @@ -1,3 +1,3 @@ -FROM java:openjdk-8u91-jdk -CMD java ${JAVA_OPTS} -jar eventuate-examples-java-spring-todo-list-single-module.jar -COPY build/libs/eventuate-examples-java-spring-todo-list-single-module.jar . \ No newline at end of file +ARG baseImageVersion +FROM eventuateio/eventuate-examples-docker-images-spring-example-base-image:$baseImageVersion +COPY build/libs/eventuate-examples-java-spring-todo-list-single-module.jar service.jar diff --git a/single-module/_build-and-test-all.sh b/single-module/_build-and-test-all.sh index 92c7893..5a24ff8 100755 --- a/single-module/_build-and-test-all.sh +++ b/single-module/_build-and-test-all.sh @@ -2,18 +2,9 @@ set -e -docker="./gradlew ${database}${mode}Compose" +export COMPOSE_HTTP_TIMEOUT=240 -if [ -z "$DOCKER_HOST_IP" ] ; then - if [ -z "$DOCKER_HOST" ] ; then - export DOCKER_HOST_IP=`hostname` - else - echo using ${DOCKER_HOST?} - XX=${DOCKER_HOST%\:*} - export DOCKER_HOST_IP=${XX#tcp\:\/\/} - fi - echo set DOCKER_HOST_IP $DOCKER_HOST_IP -fi +docker="./gradlew ${database}${mode}Compose" if [ "$1" = "--use-existing" ] ; then shift; @@ -41,8 +32,6 @@ fi ${docker}Build ${docker}Up -./wait-for-services.sh $DOCKER_HOST_IP 8080 - ./gradlew $BUILD_AND_TEST_ALL_EXTRA_GRADLE_ARGS --offline $* e2eTest if [ $NO_RM = false ] ; then diff --git a/single-module/_set-env.sh b/single-module/_set-env.sh deleted file mode 100644 index ebdc81f..0000000 --- a/single-module/_set-env.sh +++ /dev/null @@ -1,14 +0,0 @@ -if [ -z "$DOCKER_HOST_IP" ] ; then - if [ -z "$DOCKER_HOST" ] ; then - export DOCKER_HOST_IP=`hostname` - else - echo using ${DOCKER_HOST?} - XX=${DOCKER_HOST%\:*} - export DOCKER_HOST_IP=${XX#tcp\:\/\/} - fi -fi - -echo DOCKER_HOST_IP is $DOCKER_HOST_IP - -export EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS=$DOCKER_HOST_IP:9092 -export COMPOSE_HTTP_TIMEOUT=240 diff --git a/single-module/build-and-test-all-eventuate-local-mysql.sh b/single-module/build-and-test-all-eventuate-local-mysql.sh index 056194b..4d3f98a 100755 --- a/single-module/build-and-test-all-eventuate-local-mysql.sh +++ b/single-module/build-and-test-all-eventuate-local-mysql.sh @@ -1,9 +1,5 @@ #! /bin/bash -. ./set-env-mysql.sh - -export EXTRA_INFRASTRUCTURE_SERVICES=mysqlbinlogcdc -export EVENTUATE_LOCAL=yes export database=mysql export mode=binlog diff --git a/single-module/build-and-test-all-eventuate-local-postgres-polling.sh b/single-module/build-and-test-all-eventuate-local-postgres-polling.sh index 82e6987..eae662d 100755 --- a/single-module/build-and-test-all-eventuate-local-postgres-polling.sh +++ b/single-module/build-and-test-all-eventuate-local-postgres-polling.sh @@ -1,10 +1,7 @@ #! /bin/bash -. ./set-env-postgres.sh - -export EXTRA_INFRASTRUCTURE_SERVICES=postgrespollingcdc -export EVENTUATE_LOCAL=yes export database=postgres export mode=polling +export SPRING_PROFILES_ACTIVE=postgres ./_build-and-test-all.sh $* -P eventuateDriver=local diff --git a/single-module/build-and-test-all-eventuate-local-postgres-wal.sh b/single-module/build-and-test-all-eventuate-local-postgres-wal.sh index 3728942..c0558c4 100755 --- a/single-module/build-and-test-all-eventuate-local-postgres-wal.sh +++ b/single-module/build-and-test-all-eventuate-local-postgres-wal.sh @@ -1,10 +1,7 @@ #! /bin/bash -. ./set-env-postgres.sh - -export EXTRA_INFRASTRUCTURE_SERVICES=postgreswalcdc -export EVENTUATE_LOCAL=yes export database=postgres export mode=wal +export SPRING_PROFILES_ACTIVE=postgres ./_build-and-test-all.sh $* -P eventuateDriver=local diff --git a/single-module/build.gradle b/single-module/build.gradle index c9bbf83..28472f3 100755 --- a/single-module/build.gradle +++ b/single-module/build.gradle @@ -9,12 +9,8 @@ buildscript { } } -task wrapper(type: Wrapper) { - gradleVersion = '3.5' -} - apply plugin: 'java' -apply plugin: 'spring-boot' +apply plugin: 'org.springframework.boot' apply plugin: VerifyEventStoreEnvironmentPlugin apply plugin: 'docker-compose' @@ -29,7 +25,7 @@ repositories { } dependencies { - compile "io.eventuate.client.java:eventuate-client-java-spring:$eventuateClientVersion" + compile "io.eventuate.local.java:eventuate-client-java-spring:$eventuateLocalVersion" compile "io.eventuate.local.java:eventuate-local-java-spring-jdbc:$eventuateLocalVersion" compile 'mysql:mysql-connector-java:5.1.36' @@ -37,20 +33,21 @@ dependencies { exclude group: 'org.slf4j', module: 'slf4j-simple' } + compile 'org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE' + compile "org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion" compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion" compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion" - compile "org.springframework.hateoas:spring-hateoas:$springHateoasVersion" + compile "org.springframework.boot:spring-boot-starter-hateoas:$springBootVersion" compile "io.reactivex:rxjava:1.1.5" compile "org.apache.httpcomponents:httpclient:4.5" - compile "io.springfox:springfox-swagger2:2.2.2" - compile 'io.springfox:springfox-swagger-ui:2.2.2' + compile "io.eventuate.util:eventuate-util-spring-swagger:$eventuateUtilVersion" testCompile "junit:junit:4.12" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" - testCompile "io.eventuate.client.java:eventuate-client-java-spring-jdbc:$eventuateClientVersion" + testCompile "io.eventuate.local.java:eventuate-client-java-spring-jdbc:$eventuateLocalVersion" } test { @@ -65,8 +62,8 @@ task e2eTest(type: Test) { dockerCompose { environment.put "EVENTUATE_COMMON_VERSION", eventuateCommonImageVersion - environment.put "EVENTUATE_KAFKA_VERSION", eventuateMessagingKafkaImageVersion environment.put "EVENTUATE_CDC_VERSION", eventuateCdcImageVersion + environment.put "EVENTUATE_JAVA_BASE_IMAGE_VERSION", eventuateExamplesBaseImageVersion mysqlbinlog { projectName = null @@ -76,7 +73,7 @@ dockerCompose { mysqlbinlogcdc { projectName = null useComposeFiles = ["docker-compose-eventuate-local-mysql.yml"] - startedServices = ["cdcservice"] + startedServices = ["cdc-service"] } postgrespolling { @@ -87,7 +84,7 @@ dockerCompose { postgrespollingcdc { projectName = null useComposeFiles = ["docker-compose-eventuate-local-postgres-polling.yml"] - startedServices = ["cdcservice"] + startedServices = ["cdc-service"] } postgreswal { @@ -98,6 +95,6 @@ dockerCompose { postgreswalcdc { projectName = null useComposeFiles = ["docker-compose-eventuate-local-postgres-wal.yml"] - startedServices = ["cdcservice"] + startedServices = ["cdc-service"] } } \ No newline at end of file diff --git a/single-module/docker-compose-eventuate-local-mysql.yml b/single-module/docker-compose-eventuate-local-mysql.yml index eb59ba8..4fa0192 100644 --- a/single-module/docker-compose-eventuate-local-mysql.yml +++ b/single-module/docker-compose-eventuate-local-mysql.yml @@ -1,23 +1,30 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION + image: confluentinc/cp-zookeeper:5.2.4 ports: - 2181:2181 - + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + KAFKA_HEAP_OPTS: -Xmx64m kafka: - image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION + image: "confluentinc/cp-kafka:5.2.4" ports: - 9092:9092 + - 29092:29092 depends_on: - zookeeper environment: - - ADVERTISED_HOST_NAME=${DOCKER_HOST_IP} - - KAFKA_HEAP_OPTS=-Xmx320m -Xms320m - - ZOOKEEPER_SERVERS=zookeeper:2181 + KAFKA_LISTENERS: LC://kafka:29092,LX://kafka:9092 + KAFKA_ADVERTISED_LISTENERS: LC://kafka:29092,LX://${DOCKER_HOST_IP:-localhost}:9092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LC:PLAINTEXT,LX:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: LC + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_HEAP_OPTS: -Xmx192m - cdcservice: + cdc-service: image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" @@ -30,20 +37,21 @@ services: SPRING_DATASOURCE_USERNAME: mysqluser SPRING_DATASOURCE_PASSWORD: mysqlpw SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 EVENTUATELOCAL_CDC_DB_USER_NAME: root EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword - EVENTUATELOCAL_CDC_READ_OLD_DEBEZIUM_DB_OFFSET_STORAGE_TOPIC: "false" EVENTUATELOCAL_CDC_READER_NAME: MySqlReader EVENTUATELOCAL_CDC_MYSQL_BINLOG_CLIENT_UNIQUE_ID: 1234567890 + EVENTUATELOCAL_CDC_READ_OLD_DEBEZIUM_DB_OFFSET_STORAGE_TOPIC: "false" EVENTUATE_CDC_TYPE: EventuateLocal + JAVA_OPTS: -Xmx64m mysql: build: context: ./mysql args: - EVENTUATE_COMMON_VERSION: "$EVENTUATE_COMMON_VERSION" + eventuateCommonVersion: $EVENTUATE_COMMON_VERSION ports: - 3306:3306 environment: @@ -51,8 +59,12 @@ services: - MYSQL_USER=mysqluser - MYSQL_PASSWORD=mysqlpw - standaloneservice: - build: ./ + standalone-service: + build: + context: . + args: + baseImageVersion: ${EVENTUATE_JAVA_BASE_IMAGE_VERSION?} + image: eventuateexamples/eventuate-examples-java-spring-todo-list-standalone-service restart: unless-stopped ports: - "8080:8080" @@ -67,11 +79,11 @@ services: SPRING_DATASOURCE_USERNAME: mysqluser SPRING_DATASOURCE_PASSWORD: mysqlpw SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 EVENTUATELOCAL_CDC_DB_USER_NAME: root EVENTUATELOCAL_CDC_DB_PASSWORD: rootpassword - consoleserver: + console-server: image: eventuateio/eventuateio-local-console:0.15.0 depends_on: - mysql diff --git a/single-module/docker-compose-eventuate-local-postgres-polling.yml b/single-module/docker-compose-eventuate-local-postgres-polling.yml index 6c039f9..9fee5ce 100644 --- a/single-module/docker-compose-eventuate-local-postgres-polling.yml +++ b/single-module/docker-compose-eventuate-local-postgres-polling.yml @@ -1,33 +1,41 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION + image: confluentinc/cp-zookeeper:5.2.4 ports: - 2181:2181 + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + KAFKA_HEAP_OPTS: -Xmx64m kafka: - image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION + image: "confluentinc/cp-kafka:5.2.4" ports: - 9092:9092 + - 29092:29092 depends_on: - zookeeper environment: - - ADVERTISED_HOST_NAME=${DOCKER_HOST_IP} - - KAFKA_HEAP_OPTS=-Xmx320m -Xms320m - - ZOOKEEPER_SERVERS=zookeeper:2181 + KAFKA_LISTENERS: LC://kafka:29092,LX://kafka:9092 + KAFKA_ADVERTISED_LISTENERS: LC://kafka:29092,LX://${DOCKER_HOST_IP:-localhost}:9092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LC:PLAINTEXT,LX:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: LC + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_HEAP_OPTS: -Xmx192m postgres: build: context: ./postgres args: - EVENTUATE_COMMON_VERSION: "$EVENTUATE_COMMON_VERSION" + eventuateCommonVersion: $EVENTUATE_COMMON_VERSION ports: - 5432:5432 environment: POSTGRES_USER: eventuate POSTGRES_PASSWORD: eventuate - cdcservice: + cdc-service: image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" @@ -40,14 +48,20 @@ services: SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 - SPRING_PROFILES_ACTIVE: EventuatePolling EVENTUATELOCAL_CDC_READER_NAME: PostgresPollingReader + SPRING_PROFILES_ACTIVE: EventuatePolling EVENTUATE_CDC_TYPE: EventuateLocal + JAVA_OPTS: -Xmx64m - standaloneservice: - build: ./ + + standalone-service: + build: + context: . + args: + baseImageVersion: ${EVENTUATE_JAVA_BASE_IMAGE_VERSION?} + image: eventuateexamples/eventuate-examples-java-spring-todo-list-standalone-service restart: unless-stopped ports: - "8080:8080" @@ -62,9 +76,9 @@ services: SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 - consoleserver: + console-server: image: eventuateio/eventuateio-local-console:0.15.0 depends_on: - postgres diff --git a/single-module/docker-compose-eventuate-local-postgres-wal.yml b/single-module/docker-compose-eventuate-local-postgres-wal.yml index 8e76bba..a3df223 100644 --- a/single-module/docker-compose-eventuate-local-postgres-wal.yml +++ b/single-module/docker-compose-eventuate-local-postgres-wal.yml @@ -1,33 +1,41 @@ version: '3' services: zookeeper: - image: eventuateio/eventuate-zookeeper:$EVENTUATE_COMMON_VERSION + image: confluentinc/cp-zookeeper:5.2.4 ports: - 2181:2181 + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + KAFKA_HEAP_OPTS: -Xmx64m kafka: - image: eventuateio/eventuate-kafka:$EVENTUATE_KAFKA_VERSION + image: "confluentinc/cp-kafka:5.2.4" ports: - 9092:9092 + - 29092:29092 depends_on: - zookeeper environment: - - ADVERTISED_HOST_NAME=${DOCKER_HOST_IP} - - KAFKA_HEAP_OPTS=-Xmx320m -Xms320m - - ZOOKEEPER_SERVERS=zookeeper:2181 + KAFKA_LISTENERS: LC://kafka:29092,LX://kafka:9092 + KAFKA_ADVERTISED_LISTENERS: LC://kafka:29092,LX://${DOCKER_HOST_IP:-localhost}:9092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LC:PLAINTEXT,LX:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: LC + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_HEAP_OPTS: -Xmx192m postgres: build: context: ./postgres args: - EVENTUATE_COMMON_VERSION: "$EVENTUATE_COMMON_VERSION" + eventuateCommonVersion: $EVENTUATE_COMMON_VERSION ports: - 5432:5432 environment: POSTGRES_USER: eventuate POSTGRES_PASSWORD: eventuate - cdcservice: + cdc-service: image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION ports: - "8099:8080" @@ -40,14 +48,19 @@ services: SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 - SPRING_PROFILES_ACTIVE: PostgresWal EVENTUATELOCAL_CDC_READER_NAME: PostgresWalReader + SPRING_PROFILES_ACTIVE: PostgresWal EVENTUATE_CDC_TYPE: EventuateLocal + JAVA_OPTS: -Xmx64m - standaloneservice: - build: ./ + standalone-service: + build: + context: . + args: + baseImageVersion: ${EVENTUATE_JAVA_BASE_IMAGE_VERSION?} + image: eventuateexamples/eventuate-examples-java-spring-todo-list-standalone-service restart: unless-stopped ports: - "8080:8080" @@ -62,9 +75,9 @@ services: SPRING_DATASOURCE_USERNAME: eventuate SPRING_DATASOURCE_PASSWORD: eventuate SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver - EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092 + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 - consoleserver: + console-server: image: eventuateio/eventuateio-local-console:0.15.0 depends_on: - postgres diff --git a/single-module/gradle.properties b/single-module/gradle.properties index 2d2e253..3558e66 100755 --- a/single-module/gradle.properties +++ b/single-module/gradle.properties @@ -1,14 +1,15 @@ org.gradle.jvmargs=-XX:MaxPermSize=512m -eventuateMavenRepoUrl=https://dl.bintray.com/eventuateio-oss/eventuate-maven-release,https://dl.bintray.com/eventuateio-oss/eventuate-maven-rc +eventuateMavenRepoUrl=https://dl.bintray.com/eventuateio-oss/eventuate-maven-release,https://dl.bintray.com/eventuateio-oss/eventuate-maven-rc,file:///Users/cer/.m2/testdeploy -springHateoasVersion=0.17.0.RELEASE -springBootVersion=1.5.10.RELEASE +springBootVersion=2.2.6.RELEASE -eventuateClientVersion=0.23.0.RC4 -eventuateLocalVersion=0.32.0.RC4 +eventuateLocalVersion=0.36.0.BUILD-SNAPSHOT +eventuateUtilVersion=0.8.1.BUILD-SNAPSHOT + +eventuateExamplesBaseImageVersion=BUILD-6 + +eventuateCommonImageVersion=0.12.0.RELEASE +eventuateCdcImageVersion=0.9.0.RELEASE -eventuateCommonImageVersion=0.9.0.RC4 -eventuateMessagingKafkaImageVersion=0.9.0.RC4 -eventuateCdcImageVersion=0.6.0.RC4 diff --git a/single-module/gradle/wrapper/gradle-wrapper.properties b/single-module/gradle/wrapper/gradle-wrapper.properties index 676177f..df9c90e 100755 --- a/single-module/gradle/wrapper/gradle-wrapper.properties +++ b/single-module/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip diff --git a/single-module/mysql/Dockerfile b/single-module/mysql/Dockerfile index d090a13..891fa92 100644 --- a/single-module/mysql/Dockerfile +++ b/single-module/mysql/Dockerfile @@ -1,3 +1,3 @@ -ARG EVENTUATE_COMMON_VERSION -FROM eventuateio/eventuate-mysql:$EVENTUATE_COMMON_VERSION +ARG eventuateCommonVersion +FROM eventuateio/eventuate-mysql:$eventuateCommonVersion COPY schema-mysql.sql /docker-entrypoint-initdb.d diff --git a/single-module/postgres/Dockerfile b/single-module/postgres/Dockerfile index 62b744d..c13454e 100644 --- a/single-module/postgres/Dockerfile +++ b/single-module/postgres/Dockerfile @@ -1,3 +1,3 @@ -ARG EVENTUATE_COMMON_VERSION -FROM eventuateio/eventuate-postgres:$EVENTUATE_COMMON_VERSION +ARG eventuateCommonVersion +FROM eventuateio/eventuate-postgres:$eventuateCommonVersion COPY schema-postgres.sql /docker-entrypoint-initdb.d diff --git a/single-module/set-env-mysql.sh b/single-module/set-env-mysql.sh deleted file mode 100644 index d82db25..0000000 --- a/single-module/set-env-mysql.sh +++ /dev/null @@ -1,6 +0,0 @@ -. ./_set-env.sh - -export SPRING_DATASOURCE_URL=jdbc:mysql://${DOCKER_HOST_IP}/eventuate -export SPRING_DATASOURCE_USERNAME=mysqluser -export SPRING_DATASOURCE_PASSWORD=mysqlpw -export SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.jdbc.Driver diff --git a/single-module/set-env-postgres.sh b/single-module/set-env-postgres.sh deleted file mode 100644 index 374d422..0000000 --- a/single-module/set-env-postgres.sh +++ /dev/null @@ -1,6 +0,0 @@ -. ./_set-env.sh - -export SPRING_DATASOURCE_URL=jdbc:postgresql://${DOCKER_HOST_IP}/eventuate -export SPRING_DATASOURCE_USERNAME=eventuate -export SPRING_DATASOURCE_PASSWORD=eventuate -export SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver diff --git a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/backend/TodoQueryService.java b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/backend/TodoQueryService.java index 5d38216..472ebed 100755 --- a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/backend/TodoQueryService.java +++ b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/backend/TodoQueryService.java @@ -25,7 +25,7 @@ public List getAll() { } public void remove(String id) { - repository.delete(id); + repository.deleteById(id); } public void removeAll() { @@ -33,12 +33,9 @@ public void removeAll() { } public CompletableFuture findById(String todoId) { - Todo res = repository.findOne(todoId); - if (res != null) { - return CompletableFuture.completedFuture(res); - } - return CompletableFutureUtil.failedFuture(new NoSuchElementException("No todo with given id found")); + return repository + .findById(todoId) + .map(CompletableFuture::completedFuture) + .orElse(CompletableFutureUtil.failedFuture(new NoSuchElementException("No todo with given id found"))); } - - } diff --git a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/commonswagger/CommonSwaggerConfiguration.java b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/commonswagger/CommonSwaggerConfiguration.java index aaecc2c..c6d73a1 100644 --- a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/commonswagger/CommonSwaggerConfiguration.java +++ b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/commonswagger/CommonSwaggerConfiguration.java @@ -1,43 +1,14 @@ package net.chrisrichardson.eventstore.examples.todolist.commonswagger; -import com.fasterxml.classmate.TypeResolver; -import org.springframework.beans.factory.annotation.Autowired; +import io.eventuate.util.spring.swagger.EventuateSwaggerConfig; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.ResponseEntity; -import org.springframework.web.context.request.async.DeferredResult; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.schema.WildcardType; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -import java.util.concurrent.CompletableFuture; - -import static springfox.documentation.schema.AlternateTypeRules.newRule; @Configuration -@EnableSwagger2 public class CommonSwaggerConfiguration { @Bean - public Docket api() { - return new Docket(DocumentationType.SWAGGER_2) - .select() - .apis(RequestHandlerSelectors.basePackage("net.chrisrichardson.eventstore.examples.todolist")) - .build() - .pathMapping("/") - .genericModelSubstitutes(ResponseEntity.class, CompletableFuture.class) - .alternateTypeRules( - newRule(typeResolver.resolve(DeferredResult.class, - typeResolver.resolve(ResponseEntity.class, WildcardType.class)), - typeResolver.resolve(WildcardType.class)) - ) - .useDefaultResponseMessages(false) - ; + public EventuateSwaggerConfig eventuateSwaggerConfig() { + return () -> "net.chrisrichardson.eventstore.examples.todolist.web"; } - - @Autowired - private TypeResolver typeResolver; - } diff --git a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoController.java b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoController.java index 4fac8a6..4a15ff7 100644 --- a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoController.java +++ b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoController.java @@ -7,7 +7,7 @@ import net.chrisrichardson.eventstore.examples.todolist.backend.Todo; import net.chrisrichardson.eventstore.examples.todolist.backend.TodoQueryService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.hateoas.mvc.ControllerLinkBuilder; +import org.springframework.hateoas.server.mvc.ControllerLinkBuilder; import org.springframework.util.Assert; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -19,7 +19,7 @@ import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import static org.springframework.web.bind.annotation.RequestMethod.*; diff --git a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoViewController.java b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoViewController.java index d00fb82..0dc6489 100755 --- a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoViewController.java +++ b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoViewController.java @@ -16,8 +16,8 @@ import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; -import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import static org.springframework.http.HttpStatus.OK; import static org.springframework.web.bind.annotation.RequestMethod.GET; diff --git a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoWebConfiguration.java b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoWebConfiguration.java index c20e758..e2fb78b 100644 --- a/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoWebConfiguration.java +++ b/single-module/src/main/java/net/chrisrichardson/eventstore/examples/todolist/web/TodoWebConfiguration.java @@ -1,6 +1,6 @@ package net.chrisrichardson.eventstore.examples.todolist.web; -import org.springframework.boot.autoconfigure.web.HttpMessageConverters; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; diff --git a/single-module/src/main/resources/application-postgres.properties b/single-module/src/main/resources/application-postgres.properties new file mode 100644 index 0000000..8338266 --- /dev/null +++ b/single-module/src/main/resources/application-postgres.properties @@ -0,0 +1,4 @@ +spring.datasource.url=jdbc:postgresql://${DOCKER_HOST_IP:localhost}/eventuate +spring.datasource.username=eventuate +spring.datasource.password=eventuate +spring.datasource.driver-class-name=org.postgresql.Driver \ No newline at end of file diff --git a/single-module/src/main/resources/application.properties b/single-module/src/main/resources/application.properties old mode 100755 new mode 100644 index 3bc4989..87e9694 --- a/single-module/src/main/resources/application.properties +++ b/single-module/src/main/resources/application.properties @@ -1,5 +1,6 @@ +eventuatelocal.kafka.bootstrap.servers=${DOCKER_HOST_IP:localhost}:9092 -spring.datasource.url=jdbc:mysql://localhost:3307/eventuate +spring.datasource.url=jdbc:mysql://${DOCKER_HOST_IP:localhost}/eventuate spring.datasource.username=mysqluser spring.datasource.password=mysqlpw -spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.driver-class-name=com.mysql.jdbc.Driver \ No newline at end of file diff --git a/single-module/src/test/java/net/chrisrichardson/eventstore/examples/todolist/integration/RestAPITestConfiguration.java b/single-module/src/test/java/net/chrisrichardson/eventstore/examples/todolist/integration/RestAPITestConfiguration.java index 0c39db2..ad08d6e 100755 --- a/single-module/src/test/java/net/chrisrichardson/eventstore/examples/todolist/integration/RestAPITestConfiguration.java +++ b/single-module/src/test/java/net/chrisrichardson/eventstore/examples/todolist/integration/RestAPITestConfiguration.java @@ -2,6 +2,7 @@ import io.eventuate.javaclient.spring.jdbc.EmbeddedTestAggregateStoreConfiguration; import net.chrisrichardson.eventstore.examples.todolist.backend.TodoBackendConfiguration; +import net.chrisrichardson.eventstore.examples.todolist.commonswagger.CommonSwaggerConfiguration; import net.chrisrichardson.eventstore.examples.todolist.testutil.BasicWebTestConfiguration; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; diff --git a/single-module/src/test/java/net/chrisrichardson/eventstore/examples/todolist/testutil/BasicWebTestConfiguration.java b/single-module/src/test/java/net/chrisrichardson/eventstore/examples/todolist/testutil/BasicWebTestConfiguration.java index d999fa5..dd488cd 100755 --- a/single-module/src/test/java/net/chrisrichardson/eventstore/examples/todolist/testutil/BasicWebTestConfiguration.java +++ b/single-module/src/test/java/net/chrisrichardson/eventstore/examples/todolist/testutil/BasicWebTestConfiguration.java @@ -5,7 +5,7 @@ import org.apache.http.client.HttpClient; import org.apache.http.impl.client.HttpClients; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.web.HttpMessageConverters; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; diff --git a/single-module/src/test/resources/application-postgres.properties b/single-module/src/test/resources/application-postgres.properties new file mode 100644 index 0000000..8338266 --- /dev/null +++ b/single-module/src/test/resources/application-postgres.properties @@ -0,0 +1,4 @@ +spring.datasource.url=jdbc:postgresql://${DOCKER_HOST_IP:localhost}/eventuate +spring.datasource.username=eventuate +spring.datasource.password=eventuate +spring.datasource.driver-class-name=org.postgresql.Driver \ No newline at end of file diff --git a/single-module/src/test/resources/application.properties b/single-module/src/test/resources/application.properties new file mode 100644 index 0000000..3fe62e4 --- /dev/null +++ b/single-module/src/test/resources/application.properties @@ -0,0 +1,8 @@ +spring.autoconfigure.exclude=io.eventuate.util.spring.swagger.CommonSwaggerConfiguration + +eventuatelocal.kafka.bootstrap.servers=${DOCKER_HOST_IP:localhost}:9092 + +spring.datasource.url=jdbc:mysql://${DOCKER_HOST_IP:localhost}/eventuate +spring.datasource.username=mysqluser +spring.datasource.password=mysqlpw +spring.datasource.driver-class-name=com.mysql.jdbc.Driver