From 5d8c5eaf4e6a3d856d232c7ae4a44df24f6ed376 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Wed, 20 May 2020 12:43:27 +0300 Subject: [PATCH 1/6] Fixed snapshot test script --- build-and-test-snapshots.sh | 7 ++----- build.gradle | 15 ++++++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build-and-test-snapshots.sh b/build-and-test-snapshots.sh index d6384d44..ba5ed5de 100755 --- a/build-and-test-snapshots.sh +++ b/build-and-test-snapshots.sh @@ -2,11 +2,9 @@ set -e -dockerall="./gradlew mysqlbinlogCompose" -dockerinfrastructure="./gradlew mysqlbinloginfrastructureCompose" -dockertextsearch="./gradlew mysqlbinlogwithorderhistorytextsearchserviceCompose" +dockerall="./gradlew mysqlbinlogtextsearchCompose" +dockerinfrastructure="./gradlew mysqlbinloginfrastructuretextsearchCompose" -${dockertextsearch}Down ${dockerall}Down ${dockerinfrastructure}Up @@ -16,5 +14,4 @@ ${dockerall}Up ./gradlew :snapshot-tests:cleanTest :snapshot-tests:test -${dockertextsearch}Down ${dockerall}Down diff --git a/build.gradle b/build.gradle index 49c49489..dd6d6615 100644 --- a/build.gradle +++ b/build.gradle @@ -40,22 +40,27 @@ dockerCompose { useComposeFiles = ["docker-compose-mysql-binlog.yml"] } + mysqlbinloginfrastructure { + projectName = null + useComposeFiles = ["docker-compose-mysql-binlog.yml"] + startedServices = ["cdcservice", "zipkin"] + } + mysqlbinlogwithjmeter { projectName = null useComposeFiles = ["docker-compose-mysql-binlog.yml", "docker-compose-jmeter-service.yml"] startedServices = ["jmeterservice", "customerservice"] } - mysqlbinlogwithorderhistorytextsearchservice { + mysqlbinlogtextsearch { projectName = null useComposeFiles = ["docker-compose-mysql-binlog.yml", "docker-compose-snapshots-mysql-binlog.yml"] - startedServices = ["elasticsearch", "orderhistorytextsearchservice"] } - mysqlbinloginfrastructure { + mysqlbinloginfrastructuretextsearch { projectName = null - useComposeFiles = ["docker-compose-mysql-binlog.yml"] - startedServices = ["cdcservice", "zipkin"] + useComposeFiles = ["docker-compose-mysql-binlog.yml", "docker-compose-snapshots-mysql-binlog.yml"] + startedServices = ["cdcservice", "zipkin", "elasticsearch"] } postgrespolling { From 73a0b3ade5edf44ecad4640b4a9b7d0b210f31c7 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Wed, 20 May 2020 13:40:19 +0300 Subject: [PATCH 2/6] temporary disabled snapshot tests. --- .circleci/config.yml | 8 ++++---- build-and-test-snapshots.sh | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7b8fdf27..c898a061 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,10 +22,10 @@ jobs: - ~/.gradle - ~/.m2 key: eventuate-tram-examples-java-spring-todo-list-{{ checksum "gradle.properties" }}-{{ checksum "pom.xml" }} - - run: - command: | - . ./.circleci/setenv-circle-ci.sh - ./build-and-test-snapshots.sh +# - run: +# command: | +# . ./.circleci/setenv-circle-ci.sh +# ./build-and-test-snapshots.sh - run: command: | . ./.circleci/setenv-circle-ci.sh diff --git a/build-and-test-snapshots.sh b/build-and-test-snapshots.sh index ba5ed5de..796da4c9 100755 --- a/build-and-test-snapshots.sh +++ b/build-and-test-snapshots.sh @@ -6,12 +6,12 @@ dockerall="./gradlew mysqlbinlogtextsearchCompose" dockerinfrastructure="./gradlew mysqlbinloginfrastructuretextsearchCompose" ${dockerall}Down -${dockerinfrastructure}Up +#${dockerinfrastructure}Up -./gradlew assemble - -${dockerall}Up - -./gradlew :snapshot-tests:cleanTest :snapshot-tests:test - -${dockerall}Down +#./gradlew assemble +# +#${dockerall}Up +# +#./gradlew :snapshot-tests:cleanTest :snapshot-tests:test +# +#${dockerall}Down From 5e169768eda6696c6b5e1f78e22d5dbec7ca77d6 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Wed, 20 May 2020 14:03:15 +0300 Subject: [PATCH 3/6] Fixed jmeter image --- jmeter-service/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/jmeter-service/Dockerfile b/jmeter-service/Dockerfile index 48506ca7..21ac8b1b 100755 --- a/jmeter-service/Dockerfile +++ b/jmeter-service/Dockerfile @@ -1,4 +1,5 @@ FROM openjdk:8u252-slim-buster +RUN apt-get update && apt-get install -y wget RUN wget -q -O - http://mirror.linux-ia64.org/apache//jmeter/binaries/apache-jmeter-5.2.1.tgz | tar -xzf - -C /usr/local RUN mkdir /usr/local/plans RUN mkdir /usr/local/results From 522545950139802e9b536f8c43e854c3685d08a9 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Wed, 20 May 2020 14:36:40 +0300 Subject: [PATCH 4/6] Enabled snapshot tests. --- .circleci/config.yml | 8 ++++---- build-and-test-snapshots.sh | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c898a061..7b8fdf27 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,10 +22,10 @@ jobs: - ~/.gradle - ~/.m2 key: eventuate-tram-examples-java-spring-todo-list-{{ checksum "gradle.properties" }}-{{ checksum "pom.xml" }} -# - run: -# command: | -# . ./.circleci/setenv-circle-ci.sh -# ./build-and-test-snapshots.sh + - run: + command: | + . ./.circleci/setenv-circle-ci.sh + ./build-and-test-snapshots.sh - run: command: | . ./.circleci/setenv-circle-ci.sh diff --git a/build-and-test-snapshots.sh b/build-and-test-snapshots.sh index 796da4c9..ba5ed5de 100755 --- a/build-and-test-snapshots.sh +++ b/build-and-test-snapshots.sh @@ -6,12 +6,12 @@ dockerall="./gradlew mysqlbinlogtextsearchCompose" dockerinfrastructure="./gradlew mysqlbinloginfrastructuretextsearchCompose" ${dockerall}Down -#${dockerinfrastructure}Up +${dockerinfrastructure}Up -#./gradlew assemble -# -#${dockerall}Up -# -#./gradlew :snapshot-tests:cleanTest :snapshot-tests:test -# -#${dockerall}Down +./gradlew assemble + +${dockerall}Up + +./gradlew :snapshot-tests:cleanTest :snapshot-tests:test + +${dockerall}Down From 7311128d4ee100d536d0eff2e7f39ed241ef820e Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Wed, 20 May 2020 16:58:31 +0300 Subject: [PATCH 5/6] Reorganized snaphost tests. --- build.gradle | 6 +- docker-compose-snapshots-mysql-binlog.yml | 95 +++++++++++++++++++++++ 2 files changed, 98 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index dd6d6615..a242be96 100644 --- a/build.gradle +++ b/build.gradle @@ -54,13 +54,13 @@ dockerCompose { mysqlbinlogtextsearch { projectName = null - useComposeFiles = ["docker-compose-mysql-binlog.yml", "docker-compose-snapshots-mysql-binlog.yml"] + useComposeFiles = ["docker-compose-snapshots-mysql-binlog.yml"] } mysqlbinloginfrastructuretextsearch { projectName = null - useComposeFiles = ["docker-compose-mysql-binlog.yml", "docker-compose-snapshots-mysql-binlog.yml"] - startedServices = ["cdcservice", "zipkin", "elasticsearch"] + useComposeFiles = ["docker-compose-snapshots-mysql-binlog.yml"] + startedServices = ["cdcservice"] } postgrespolling { diff --git a/docker-compose-snapshots-mysql-binlog.yml b/docker-compose-snapshots-mysql-binlog.yml index 7128db62..296f4f0f 100755 --- a/docker-compose-snapshots-mysql-binlog.yml +++ b/docker-compose-snapshots-mysql-binlog.yml @@ -1,5 +1,100 @@ version: '3' services: + orderservice: + build: + context: ./order-service/ + image: eventuateexamples/eventuate-tram-examples-customers-and-orders-order-service + ports: + - "8081:8080" + depends_on: + - mysql + - kafka + - zookeeper + - cdcservice + environment: + SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate + SPRING_DATASOURCE_USERNAME: mysqluser + SPRING_DATASOURCE_PASSWORD: mysqlpw + SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 + EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 + CDC_SERVICE_URL: http://cdcservice:8080 + + customerservice: + build: + context: ./customer-service/ + image: eventuateexamples/eventuate-tram-examples-customers-and-orders-customer-service + ports: + - "8082:8080" + depends_on: + - mysql + - kafka + - zookeeper + - cdcservice + environment: + SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate + SPRING_DATASOURCE_USERNAME: mysqluser + SPRING_DATASOURCE_PASSWORD: mysqlpw + SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver + EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:29092 + EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181 + CDC_SERVICE_URL: http://cdcservice:8080 + + zookeeper: + image: confluentinc/cp-zookeeper:5.2.4 + ports: + - 2181:2181 + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + + kafka: + image: "confluentinc/cp-kafka:5.2.4" + ports: + - 9092:9092 + - 29092:29092 + depends_on: + - zookeeper + environment: + 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 + + + mysql: + image: eventuateio/eventuate-mysql:$EVENTUATE_COMMON_VERSION + ports: + - 3306:3306 + environment: + - MYSQL_ROOT_PASSWORD=rootpassword + - MYSQL_USER=mysqluser + - MYSQL_PASSWORD=mysqlpw + + cdcservice: + image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION + ports: + - "8099:8080" + depends_on: + - mysql + - kafka + - zookeeper + environment: + SPRING_DATASOURCE_URL: jdbc:mysql://mysql/eventuate + SPRING_DATASOURCE_USERNAME: mysqluser + SPRING_DATASOURCE_PASSWORD: mysqlpw + SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver + 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_READER_NAME: MySqlReader + EVENTUATELOCAL_CDC_OFFSET_STORE_KEY: MySqlBinlog + EVENTUATELOCAL_CDC_MYSQL_BINLOG_CLIENT_UNIQUE_ID: 1234567890 + EVENTUATELOCAL_CDC_READ_OLD_DEBEZIUM_DB_OFFSET_STORAGE_TOPIC: "false" + EVENTUATE_CDC_KAFKA_ENABLE_BATCH_PROCESSING: ${EVENTUATE_CDC_KAFKA_ENABLE_BATCH_PROCESSING} + orderhistorytextsearchservice: build: ./order-history-text-search-service/ ports: From 224331ac9ae5e8ba99d07782374462aa02b15746 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Wed, 20 May 2020 17:26:23 +0300 Subject: [PATCH 6/6] Added stopping and removing containers to circleci --- .circleci/config.yml | 1 + .circleci/stop-and-remove-containers.sh | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100755 .circleci/stop-and-remove-containers.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 7b8fdf27..8e770907 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,6 +15,7 @@ jobs: command: | ./.circleci/upgrade-docker-compose.sh . ./.circleci/setenv-circle-ci.sh + . ./.circleci/stop-and-remove-containers.sh ./gradlew testClasses ./mvnw package test-compile -DskipTests - save_cache: diff --git a/.circleci/stop-and-remove-containers.sh b/.circleci/stop-and-remove-containers.sh new file mode 100755 index 00000000..88e9fc43 --- /dev/null +++ b/.circleci/stop-and-remove-containers.sh @@ -0,0 +1,9 @@ +#! /bin/bash -e + +CONTAINER_IDS=$(docker ps -a -q) + +for id in $CONTAINER_IDS ; do + docker stop $id + docker rm $id +done +