Skip to content

Commit

Permalink
eventuate-tram#14: Replace env variables by properties. Use docker gr…
Browse files Browse the repository at this point in the history
…adle plugin.
  • Loading branch information
dartartem committed Sep 9, 2020
1 parent 8529ed9 commit 688509b
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 70 deletions.
14 changes: 4 additions & 10 deletions _build-and-test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@

set -e

. ./set-env-${DATABASE?}.sh
docker="./gradlew ${DATABASE?}${MODE?}Compose"

docker-compose -f docker-compose-${DATABASE?}-${MODE}.yml down -v
docker-compose -f docker-compose-${DATABASE?}-${MODE}.yml up -d --build zookeeper kafka ${DATABASE?} mongodb

./wait-for-${DATABASE?}.sh

docker-compose -f docker-compose-${DATABASE?}-${MODE}.yml up -d --build cdcservice

./wait-for-services.sh $DOCKER_HOST_IP "8099"
${docker}Down
${docker}Up

./gradlew build

docker-compose -f docker-compose-${DATABASE?}-${MODE}.yml down -v
${docker}Down
18 changes: 0 additions & 18 deletions _set-env.sh

This file was deleted.

1 change: 1 addition & 0 deletions build-and-test-all-postgres-polling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ set -e

export DATABASE=postgres
export MODE=polling
export SPRING_PROFILES_ACTIVE=postgres

./_build-and-test-all.sh
1 change: 1 addition & 0 deletions build-and-test-all-postgres-wal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ set -e

export DATABASE=postgres
export MODE=wal
export SPRING_PROFILES_ACTIVE=postgres

./_build-and-test-all.sh
32 changes: 32 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ buildscript {
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "com.avast.gradle:gradle-docker-compose-plugin:0.13.2"
}
}

apply plugin: 'docker-compose'

allprojects {
group = "io.eventuate.tram.view.support"
}
Expand Down Expand Up @@ -73,6 +76,35 @@ allprojects {

}

dockerCompose {
environment.put "EVENTUATE_COMMON_VERSION", eventuateCommonImageVersion
environment.put "EVENTUATE_CDC_VERSION", eventuateCdcImageVersion
removeOrphans = true

mysqlbinlog {
projectName = null
useComposeFiles = ["docker-compose-mysql-binlog.yml"]
removeContainers = project.ext.removeContainers
}

mysqlpolling {
projectName = null
useComposeFiles = ["docker-compose-mysql-polling.yml"]
removeContainers = project.ext.removeContainers
}

postgrespolling {
projectName = null
useComposeFiles = ["docker-compose-postgres-polling.yml"]
removeContainers = project.ext.removeContainers
}

postgreswal {
projectName = null
useComposeFiles = ["docker-compose-postgres-wal.yml"]
removeContainers = project.ext.removeContainers
}
}

gradle.projectsEvaluated {
task aggregateJavaDocs(type: Javadoc) {
Expand Down
8 changes: 4 additions & 4 deletions docker-compose-mysql-binlog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
ZOOKEEPER_CLIENT_PORT: 2181

kafka:
image: "confluentinc/cp-enterprise-kafka:5.2.4"
image: "confluentinc/cp-kafka:5.2.4"
ports:
- 9092:9092
depends_on:
Expand All @@ -22,7 +22,7 @@ services:
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1

mysql:
image: eventuateio/eventuate-mysql:0.9.0.RELEASE
image: eventuateio/eventuate-mysql:$EVENTUATE_COMMON_VERSION
ports:
- 3306:3306
environment:
Expand All @@ -37,8 +37,8 @@ services:
ports:
- "27017:27017"

cdcservice:
image: eventuateio/eventuate-cdc-service:0.6.0.RELEASE
cdc-service:
image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION
ports:
- "8099:8080"
depends_on:
Expand Down
10 changes: 5 additions & 5 deletions docker-compose-mysql-polling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
ZOOKEEPER_CLIENT_PORT: 2181

kafka:
image: "confluentinc/cp-enterprise-kafka:5.2.4"
image: "confluentinc/cp-kafka:5.2.4"
ports:
- 9092:9092
- 29092:29092
Expand All @@ -23,7 +23,7 @@ services:
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1

mysql:
image: eventuateio/eventuate-mysql:0.9.0.RELEASE
image: eventuateio/eventuate-mysql:$EVENTUATE_COMMON_VERSION
ports:
- 3306:3306
environment:
Expand All @@ -38,8 +38,8 @@ services:
ports:
- "27017:27017"

cdcservice:
image: eventuateio/eventuate-cdc-service:0.6.0.RELEASE
cdc-service:
image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION
ports:
- "8099:8080"
depends_on:
Expand All @@ -51,7 +51,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
Expand Down
16 changes: 5 additions & 11 deletions docker-compose-postgres-polling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
ZOOKEEPER_CLIENT_PORT: 2181

kafka:
image: "confluentinc/cp-enterprise-kafka:5.2.4"
image: "confluentinc/cp-kafka:5.2.4"
ports:
- 9092:9092
- 29092:29092
Expand All @@ -23,7 +23,7 @@ services:
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1

postgres:
image: eventuateio/eventuate-postgres:0.9.0.RELEASE
image: eventuateio/eventuate-postgres:$EVENTUATE_COMMON_VERSION
ports:
- 5432:5432
environment:
Expand All @@ -37,8 +37,8 @@ services:
ports:
- "27017:27017"

cdcservice:
image: eventuateio/eventuate-cdc-service:0.6.0.RELEASE
cdc-service:
image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION
depends_on:
- postgres
- kafka
Expand All @@ -49,14 +49,8 @@ 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_KAFKA_BOOTSTRAP_SERVERS: kafka:29092
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
EVENTUATELOCAL_CDC_READER_NAME: Reader
SPRING_PROFILES_ACTIVE: EventuatePolling
12 changes: 5 additions & 7 deletions docker-compose-postgres-wal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
ZOOKEEPER_CLIENT_PORT: 2181

kafka:
image: "confluentinc/cp-enterprise-kafka:5.2.4"
image: "confluentinc/cp-kafka:5.2.4"
ports:
- 9092:9092
- 29092:29092
Expand All @@ -23,7 +23,7 @@ services:
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1

postgres:
image: eventuateio/eventuate-postgres:0.9.0.RELEASE
image: eventuateio/eventuate-postgres:$EVENTUATE_COMMON_VERSION
ports:
- 5432:5432
environment:
Expand All @@ -37,8 +37,8 @@ services:
ports:
- "27017:27017"

cdcservice:
image: eventuateio/eventuate-cdc-service:0.6.0.RELEASE
cdc-service:
image: eventuateio/eventuate-cdc-service:$EVENTUATE_CDC_VERSION
depends_on:
- postgres
- kafka
Expand All @@ -49,10 +49,8 @@ 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_KAFKA_BOOTSTRAP_SERVERS: kafka:29092
EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181
EVENTUATELOCAL_CDC_READER_NAME: Reader
SPRING_PROFILES_ACTIVE: PostgresWal
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
spring.jpa.generate-ddl=true
spring.jpa.generate-ddl=true

eventuatelocal.kafka.bootstrap.servers=${DOCKER_HOST_IP:localhost}:9092
cdc.service.url=http://${DOCKER_HOST_IP:localhost}:8099
spring.data.mongodb.uri=mongodb://${DOCKER_HOST_IP:localhost}/export_test

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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class SnapshotterConfigurationProperties {
@Value("${cdc.status.service.end.point:#{\"cdc-event-processing-status\"}}")
private String cdcStatusServiceEndPoint;

@Value("${max.iterations.to.check.cdc.processing:#{20}}")
@Value("${max.iterations.to.check.cdc.processing:#{30}}")
private int maxIterationsToCheckCdcProcessing;

@Value("${timeout.between.cdc.processing.checking.iterations.in.milliseconds:#{1000}}")
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
spring.jpa.generate-ddl=true
spring.jpa.generate-ddl=true

eventuatelocal.kafka.bootstrap.servers=${DOCKER_HOST_IP:localhost}:9092
cdc.service.url=http://${DOCKER_HOST_IP:localhost}:8099
spring.data.mongodb.uri=mongodb://${DOCKER_HOST_IP:localhost}/export_test

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
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ eventuateUtilVersion=0.7.0.RELEASE
eventuateMessagingKafkaVersion=0.12.0.RELEASE
version=0.2.0-SNAPSHOT
bintrayRepoType=defineMe

eventuateCommonImageVersion=0.12.0.RELEASE
eventuateCdcImageVersion=0.9.0.RELEASE

removeContainers=false
6 changes: 0 additions & 6 deletions set-env-mysql.sh

This file was deleted.

6 changes: 0 additions & 6 deletions set-env-postgres.sh

This file was deleted.

0 comments on commit 688509b

Please sign in to comment.