-
Notifications
You must be signed in to change notification settings - Fork 8
/
compose.yaml
190 lines (178 loc) · 5.46 KB
/
compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# base configuration
services:
# MICROSERVICES
book-service:
image: kudryashovroman/event-driven-architecture:book-service
container_name: book-service
restart: always
depends_on:
- book-db
environment:
THC_PATH: "/actuator/health"
healthcheck:
test: [ "CMD", "/workspace/health-check" ]
interval: 1m
retries: 3
start_period: 10s
timeout: 3s
user-service:
image: kudryashovroman/event-driven-architecture:user-service
container_name: user-service
restart: always
depends_on:
- user-db
environment:
THC_PATH: "/actuator/health"
healthcheck:
test: [ "CMD", "/workspace/health-check" ]
interval: 1m
retries: 3
start_period: 10s
timeout: 3s
user-service-2:
image: kudryashovroman/event-driven-architecture:user-service
container_name: user-service-2
restart: always
depends_on:
- user-db
environment:
SPRING_APPLICATION_NAME: user-service-2
THC_PATH: "/actuator/health"
healthcheck:
test: [ "CMD", "/workspace/health-check" ]
interval: 1m
retries: 3
start_period: 10s
timeout: 3s
notification-service:
image: kudryashovroman/event-driven-architecture:notification-service
container_name: notification-service
restart: always
depends_on:
- notification-db
environment:
THC_PATH: "/actuator/health"
healthcheck:
test: [ "CMD", "/workspace/health-check" ]
interval: 1m
retries: 3
start_period: 10s
timeout: 3s
# DATABASES FOR MICROSERVICES
book-db:
image: postgres:17.0
container_name: book-db
restart: always
environment:
POSTGRES_DB: book
POSTGRES_PASSWORD: ${BOOK_DB_PASSWORD}
healthcheck:
test: "pg_isready -U postgres"
interval: 10s
retries: 3
start_period: 10s
timeout: 3s
command: >
postgres -c wal_level=logical
-c timezone=Europe/Moscow
user-db:
image: postgres:17.0
container_name: user-db
restart: always
environment:
POSTGRES_DB: user
POSTGRES_PASSWORD: ${USER_DB_PASSWORD}
healthcheck:
test: "pg_isready -U postgres"
interval: 10s
retries: 3
start_period: 10s
timeout: 3s
command: >
postgres -c wal_level=logical
-c timezone=Europe/Moscow
notification-db:
image: postgres:17.0
container_name: notification-db
restart: always
environment:
POSTGRES_DB: notification
POSTGRES_PASSWORD: ${NOTIFICATION_DB_PASSWORD}
healthcheck:
test: "pg_isready -U postgres"
interval: 10s
retries: 3
start_period: 10s
timeout: 3s
command: >
postgres -c wal_level=logical
-c timezone=Europe/Moscow
# INFRASTRUCTURE
# One Kafka Connect instance is for the purposes of simplicity. Do your own research to set up a cluster
kafka-connect:
image: quay.io/debezium/connect:3.0.1.Final
container_name: kafka-connect
restart: always
depends_on: [ kafka, schema-registry, book-db, user-db, notification-db ]
environment:
BOOTSTRAP_SERVERS: kafka:9092
GROUP_ID: kafka-connect-cluster
CONFIG_STORAGE_TOPIC: kafka-connect.config
OFFSET_STORAGE_TOPIC: kafka-connect.offset
STATUS_STORAGE_TOPIC: kafka-connect.status
ENABLE_APICURIO_CONVERTERS: true
ENABLE_DEBEZIUM_SCRIPTING: true
CONNECT_EXACTLY_ONCE_SOURCE_SUPPORT: enabled
CONNECT_CONFIG_PROVIDERS: "file"
CONNECT_CONFIG_PROVIDERS_FILE_CLASS: "org.apache.kafka.common.config.provider.FileConfigProvider"
CONNECT_LOG4J_LOGGER_org.apache.kafka.clients: ERROR
volumes:
- ./kafka-connect/filtering/groovy:/kafka/connect/debezium-connector-postgres/filtering/groovy
- ./kafka-connect/postgres.properties:/secrets/postgres.properties:ro
- ./kafka-connect/logs/:/kafka/logs/
connectors-loader:
image: bash:5.2
container_name: connectors-loader
depends_on: [ kafka-connect ]
volumes:
- ./kafka-connect/connectors/:/usr/connectors:ro
- ./kafka-connect/load-connectors.sh/:/usr/load-connectors.sh:ro
command: bash /usr/load-connectors.sh
schema-registry:
image: apicurio/apicurio-registry:3.0.3
container_name: schema-registry
restart: always
# One Kafka instance is for the purposes of simplicity. Do your own research to set up a cluster
kafka:
image: bitnami/kafka:3.8.0
container_name: kafka
restart: always
environment:
# KRaft settings
KAFKA_CFG_NODE_ID: 0
KAFKA_CFG_PROCESS_ROLES: controller,broker
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka:9093
# listeners
KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://:9092
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_CFG_INTER_BROKER_LISTENER_NAME: PLAINTEXT
# other
KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: false
volumes:
- ./misc/kafka_data:/bitnami
caddy:
image: kudryashovroman/event-driven-architecture:caddy
container_name: caddy
restart: always
depends_on: [ book-service, notification-service ]
environment:
DOMAIN: eda-demo.romankudryashov.com
ports:
- "80:80"
- "443:443"
volumes:
- ./misc/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
- ./misc/caddy/data:/data
- ./misc/caddy/config:/config