-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.standalone.yml
More file actions
163 lines (146 loc) · 4.23 KB
/
Copy pathdocker-compose.standalone.yml
File metadata and controls
163 lines (146 loc) · 4.23 KB
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
###############################################################################
# Multi-Version Microservice Demo — Standalone (no Kubernetes)
#
# Runs everything as plain Docker containers with Dapr sidecars.
# For the full Kubernetes experience, use the main docker-compose.yml instead.
#
# Usage:
# docker compose -f docker-compose.standalone.yml up --build
# docker compose -f docker-compose.standalone.yml down -v
###############################################################################
services:
# ======================== Infrastructure ========================
zookeeper:
image: confluentinc/cp-zookeeper:7.5.0
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- "2181:2181"
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "2181"]
interval: 10s
timeout: 5s
retries: 5
kafka:
image: confluentinc/cp-kafka:7.5.0
depends_on:
zookeeper:
condition: service_healthy
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
ports:
- "9092:9092"
healthcheck:
test: ["CMD", "kafka-topics", "--bootstrap-server", "localhost:9092", "--list"]
interval: 10s
timeout: 10s
retries: 10
schema-registry:
image: confluentinc/cp-schema-registry:7.5.0
depends_on:
kafka:
condition: service_healthy
environment:
SCHEMA_REGISTRY_HOST_NAME: schema-registry
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: kafka:9092
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
ports:
- "8081:8081"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081/subjects"]
interval: 10s
timeout: 5s
retries: 5
mongodb:
image: mongo:7.0
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
# ======================== Kafka UI (Visualizer) ========================
dashboard:
build: ./dashboard
ports:
- "5001:5001"
environment:
CONSUMER_URL: http://consumer:8080
PRODUCER_URL: http://producer:8080
SCHEMA_REGISTRY_URL: http://schema-registry:8081
depends_on:
kafka:
condition: service_healthy
# ======================== Dapr ========================
dapr-placement:
image: daprio/placement:1.12.4
command: ["./placement", "-port", "50006"]
ports:
- "50006:50006"
# ======================== Producer ========================
producer:
build: ./producer
environment:
DAPR_HTTP_PORT: 3500
PRODUCER_INTERVAL_MS: 1000
depends_on:
kafka:
condition: service_healthy
schema-registry:
condition: service_healthy
producer-dapr:
image: daprio/daprd:1.12.4
command:
[
"./daprd",
"-app-id", "producer",
"-app-port", "8080",
"-placement-host-address", "dapr-placement:50006",
"-resources-path", "/components",
"-log-level", "info",
]
volumes:
- ./dapr/components:/components:ro
depends_on:
- dapr-placement
network_mode: "service:producer"
# ======================== Consumer (all versions) ========================
consumer:
build: ./consumer-service
environment:
DAPR_HTTP_PORT: 3500
SUPPORTED_VERSIONS: "1,2,3"
SPRING_APPLICATION_NAME: consumer
depends_on:
kafka:
condition: service_healthy
mongodb:
condition: service_healthy
consumer-dapr:
image: daprio/daprd:1.12.4
command:
[
"./daprd",
"-app-id", "consumer",
"-app-port", "8080",
"-placement-host-address", "dapr-placement:50006",
"-resources-path", "/components",
"-log-level", "info",
]
volumes:
- ./dapr/components:/components:ro
depends_on:
- dapr-placement
network_mode: "service:consumer"
volumes:
mongodb_data: