Skip to content

Commit 227aa5d

Browse files
committed
v2
1 parent da9a09d commit 227aa5d

File tree

145 files changed

+3559
-1743
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+3559
-1743
lines changed

.vscode/settings.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

README.md

Lines changed: 392 additions & 288 deletions
Large diffs are not rendered by default.

build.gradle

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,59 @@
11
plugins {
2-
id 'org.springframework.boot' version "${spring_boot_version}"
3-
id 'io.spring.dependency-management' version "${spring_dependency_management_version}"
4-
id 'com.google.cloud.tools.jib' version "${jib_version}"
52
id 'java'
3+
id 'org.springframework.boot' version '3.0.4'
4+
id 'io.spring.dependency-management' version '1.1.0'
65
}
76

87
group = 'com.example'
8+
version = '2.0.0'
99
sourceCompatibility = '17'
1010

11+
repositories {
12+
mavenCentral()
13+
}
14+
1115
configurations {
1216
compileOnly {
1317
extendsFrom annotationProcessor
1418
}
1519
}
1620

17-
repositories {
18-
mavenCentral()
19-
}
20-
21-
jib {
22-
to {
23-
image = "evgeniy-khyst/${project.name}:${project.version}"
24-
}
21+
ext {
22+
set('postgresql_version', '42.5.4')
23+
set('mapstruct_version', '1.5.3.Final')
24+
set('lombok_mapstruct_binding_version', '0.2.0')
25+
set('testcontainers_version', '1.17.6')
2526
}
2627

2728
dependencies {
2829
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
2930
implementation 'org.springframework.boot:spring-boot-starter-web'
31+
implementation 'org.springframework.boot:spring-boot-starter-validation'
3032
implementation 'org.springframework.kafka:spring-kafka'
3133

3234
implementation "org.postgresql:postgresql:${postgresql_version}"
3335
implementation "org.mapstruct:mapstruct:${mapstruct_version}"
3436

35-
runtimeOnly 'org.flywaydb:flyway-core'
37+
implementation 'org.flywaydb:flyway-core'
3638

3739
compileOnly 'org.projectlombok:lombok'
40+
annotationProcessor 'org.projectlombok:lombok'
3841
annotationProcessor "org.projectlombok:lombok-mapstruct-binding:${lombok_mapstruct_binding_version}"
3942
annotationProcessor "org.mapstruct:mapstruct-processor:${mapstruct_version}"
40-
annotationProcessor 'org.projectlombok:lombok'
4143

44+
testCompileOnly 'org.projectlombok:lombok'
45+
testAnnotationProcessor 'org.projectlombok:lombok'
4246
testImplementation 'org.springframework.boot:spring-boot-starter-test'
4347
testImplementation 'org.springframework.kafka:spring-kafka-test'
44-
testRuntimeOnly 'com.h2database:h2'
48+
testImplementation 'org.testcontainers:junit-jupiter'
49+
testImplementation 'org.testcontainers:postgresql'
50+
testImplementation 'org.testcontainers:kafka'
51+
}
52+
53+
dependencyManagement {
54+
imports {
55+
mavenBom "org.testcontainers:testcontainers-bom:${testcontainers_version}"
56+
}
4557
}
4658

4759
test {

docker-compose.yml

Lines changed: 64 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,89 @@
1-
version: '2'
1+
version: '3'
22

33
services:
44
postgres:
5-
image: postgres:14-alpine
5+
image: postgres:15-alpine
66
environment:
77
POSTGRES_DB: postgres
88
POSTGRES_USER: admin
99
POSTGRES_PASSWORD: s3cr3t
1010
ports:
1111
- "5432:5432"
12-
restart: unless-stopped
12+
volumes:
13+
- pgdata:/var/lib/postgresql/data
14+
healthcheck:
15+
test: [ "CMD", "pg_isready", "-q", "-d", "postgres", "-U", "admin" ]
16+
interval: 10s
17+
timeout: 5s
18+
retries: 5
1319

14-
zookeeper:
15-
image: confluentinc/cp-zookeeper:7.1.1
16-
ports:
17-
- "2181:2181"
20+
adminer:
21+
image: adminer
1822
environment:
19-
ZOOKEEPER_CLIENT_PORT: 2181
20-
ZOOKEEPER_TICK_TIME: 2000
21-
restart: unless-stopped
23+
ADMINER_DEFAULT_SERVER: postgres
24+
ADMINER_DESIGN: nette
25+
ADMINER_PLUGINS: tables-filter edit-calendar edit-foreign json-column sql-log
26+
ports:
27+
- 8181:8080
28+
depends_on:
29+
postgres:
30+
condition: service_healthy
2231

2332
kafka:
24-
image: confluentinc/cp-kafka:7.1.1
25-
hostname: kafka
26-
depends_on:
27-
- zookeeper
28-
ports:
29-
- "29092:29092"
33+
image: confluentinc/cp-kafka:7.3.2
3034
environment:
3135
KAFKA_BROKER_ID: 1
32-
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
33-
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
34-
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
36+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'
37+
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092'
3538
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
39+
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
3640
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
3741
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
38-
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
39-
KAFKA_LOG_RETENTION_MS: -1
40-
KAFKA_LOG_RETENTION_BYTES: -1
41-
restart: unless-stopped
42+
KAFKA_JMX_PORT: 9101
43+
KAFKA_JMX_HOSTNAME: localhost
44+
KAFKA_PROCESS_ROLES: 'broker,controller'
45+
KAFKA_NODE_ID: 1
46+
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka:29093'
47+
KAFKA_LISTENERS: 'PLAINTEXT://kafka:29092,CONTROLLER://kafka:29093,PLAINTEXT_HOST://0.0.0.0:9092'
48+
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT'
49+
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
50+
KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'
51+
ports:
52+
- "9092:9092"
53+
- "9101:9101"
54+
volumes:
55+
- kafka-data:/var/lib/kafka/data
56+
- ./kafka/update_run.sh:/tmp/update_run.sh
57+
command: "bash -c 'if [ ! -f /tmp/update_run.sh ]; then echo \"ERROR: Did you forget the update_run.sh file that came with this docker-compose.yml file?\" && exit 1 ; else /tmp/update_run.sh && /etc/confluent/docker/run ; fi'"
58+
healthcheck:
59+
test: [ "CMD", "nc", "-z", "localhost", "9092" ]
60+
start_period: 15s
61+
interval: 10s
62+
timeout: 10s
63+
retries: 5
4264

43-
event-sourcing-app:
44-
image: evgeniy-khyst/postgresql-event-sourcing:${version:-latest}
65+
nginx:
66+
image: nginx:1.23-alpine
4567
ports:
46-
- "8080"
68+
- "8080:80"
69+
volumes:
70+
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
71+
72+
event-sourcing-app:
73+
image: evgeniy-khyst/postgresql-event-sourcing:2.0.0
4774
environment:
4875
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/postgres
4976
SPRING_DATASOURCE_USERNAME: admin
5077
SPRING_DATASOURCE_PASSWORD: s3cr3t
51-
SPRING_KAFKA_BOOTSTRAPSERVERS: kafka:9092
52-
LOGGING_LEVEL_COM_EXAMPLE_EVENTSOURCING: DEBUG
53-
restart: unless-stopped
54-
55-
nginx:
56-
image: nginx:1.21-alpine
78+
SPRING_KAFKA_BOOTSTRAPSERVERS: kafka:29092
5779
ports:
58-
- "8080:8080"
59-
volumes:
60-
- ./default.conf:/etc/nginx/conf.d/default.conf:ro
61-
restart: unless-stopped
80+
- "8080"
81+
depends_on:
82+
postgres:
83+
condition: service_healthy
84+
kafka:
85+
condition: service_healthy
86+
87+
volumes:
88+
pgdata:
89+
kafka-data:

gradle.properties

Lines changed: 0 additions & 9 deletions
This file was deleted.

gradle/wrapper/gradle-wrapper.jar

1.52 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)