-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose-prod.yml
More file actions
196 lines (187 loc) · 6.91 KB
/
Copy pathcompose-prod.yml
File metadata and controls
196 lines (187 loc) · 6.91 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
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
191
192
193
194
195
196
services:
kafka:
image: 'confluentinc/cp-kafka:7.8.0'
container_name: kafka
environment:
# Enables automatic topic creation on the broker.
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
# KRaft settings
# The unique identifier for this Kafka node in the cluster.
KAFKA_NODE_ID: 1
# Defines the roles of this node. 'broker,controller' means it acts as both a broker and a KRaft controller.
KAFKA_PROCESS_ROLES: 'broker,controller'
# The list of voters in the KRaft controller quorum. For a single-node setup, it's just itself.
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka:9093'
# Listener settings
# The listener name used by the KRaft controller.
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
# The listener name for communication between brokers.
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT'
# Maps listener names to security protocols.
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'
# The listeners advertised to clients. 'PLAINTEXT://kafka:29092' is for internal communication,
# and 'PLAINTEXT_HOST://localhost:9092' is for external clients on the host machine.
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:29092,PLAINTEXT_HOST://kafka:9092'
# The listeners that the broker will bind to. Use 0.0.0.0 to listen on all interfaces.
KAFKA_LISTENERS: 'PLAINTEXT://kafka:29092,CONTROLLER://kafka:9093,PLAINTEXT_HOST://kafka:9092'
# Cluster and topic settings
# A unique ID for the Kafka cluster, required for KRaft mode.
# CLUSTER_ID value: docker run --rm -i confluentinc/cp-kafka:7.8.0 sh -c '/bin/kafka-storage random-uuid'
CLUSTER_ID: 'vgpmmmjLS_e4JdKsu0j69A'
# The replication factor for the internal offsets' topic. '1' is required for a single-node setup.
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
# The replication factor for the transaction state log. '1' is required for a single-node setup.
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
# The minimum number of in-sync replicas for the transaction state log. '1' is required for a single-node setup.
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
# Development settings
# The delay before the first rebalance for a consumer group. '0' speeds up startup in development.
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
# Sets the root logger level for Kafka's Log4j logging to reduce noise.
KAFKA_LOG4J_ROOT_LOGLEVEL: 'ERROR'
# Broker-wide maximum message size (10MB)
KAFKA_MESSAGE_MAX_BYTES: 10485760
# Must also adjust the replica fetch size to handle the larger messages
KAFKA_REPLICA_FETCH_MAX_BYTES: 10485760
ports:
- "9092"
healthcheck:
test: [ "CMD", "kafka-broker-api-versions", "--bootstrap-server", "kafka:9092" ]
interval: 10s
timeout: 5s
retries: 3
restart: on-failure
kafka-ui:
image: provectuslabs/kafka-ui:latest
container_name: kafka-ui
restart: unless-stopped
ports:
- "8081:8080"
environment:
KAFKA_CLUSTERS_0_NAME: 'prod-cluster'
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: 'kafka:9092'
depends_on:
kafka:
condition: service_healthy
demo-app:
build:
context: .
dockerfile: Dockerfile
image: demo-app:v1
environment:
JAVA_OPTS: |-
-XX:+ExitOnOutOfMemoryError
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/var/dumps
-XX:MaxRAMPercentage=50
-Xss256k
-XX:ReservedCodeCacheSize=64m
-XX:MaxMetaspaceSize=96m
-XX:+UseStringDeduplication
--enable-native-access=ALL-UNNAMED
KAFKA_CONSUMER_TOPICS: 'prod-in-topic'
KAFKA_CONSUMER_GROUP_ID: 'prod-group'
KAFKA_CONSUMER_BOOTSTRAP_SERVERS: 'kafka:9092'
KAFKA_PRODUCER_TOPICS: 'prod-out-topic'
KAFKA_PRODUCER_BOOTSTRAP_SERVERS: 'kafka:9092'
SPRING_APPLICATION_NAME: 'kafka-app-prod'
command: |-
--server.shutdown=graceful
--spring.profiles.active=kafka,prod
--spring.threads.virtual.enabled=true
--management.tracing.sampling.probability=0.5
--management.otlp.metrics.export.url=http://otel-collector:4318/v1/metrics
--management.otlp.tracing.endpoint=http://otel-collector:4317/v1/traces
--management.otlp.logging.endpoint=http://otel-collector:4317/v1/logs
ports:
- "8080:8080"
restart: on-failure
healthcheck:
test: ["CMD-SHELL", "nc -z localhost 8080 || exit 1"]
interval: 10s
timeout: 5s
retries: 3
depends_on:
kafka:
condition: service_healthy
otel-collector:
condition: service_started
volumes:
- /tmp/app/dumps:/var/dumps
otel-collector:
image: otel/opentelemetry-collector-contrib:latest
container_name: otel-collector
command: ["--config=/etc/otel-collector-config.yaml"]
restart: always
ports:
- "4318:4318" # OTLP http receiver
- "4317:4317" # OTLP gRPC receiver
- "13133:13133" # health_check extension: http://localhost:13133
- "55679:55679" # zpages extension: http://localhost:55679/debug/servicez
- "8889:8889" # Prometheus exporter metrics
volumes:
- ./otel/otel-collector-config.yaml:/etc/otel-collector-config.yaml:ro
depends_on:
- loki
- tempo
- jaeger
- zipkin
prometheus:
image: prom/prometheus:latest
container_name: prometheus
command:
- --config.file=/etc/prometheus/prometheus.yml
- --enable-feature=exemplar-storage
- --web.enable-remote-write-receiver
restart: always
ports:
- '9090:9090' # Prometheus web UI & as grafana datasource
volumes:
- ./otel/prometheus.yml:/etc/prometheus/prometheus.yml:ro
depends_on:
- otel-collector
loki:
image: grafana/loki:latest
container_name: loki
command: -config.file=/etc/loki/local-config.yaml
restart: always
ports:
- "3100" # Loki as grafana datasource
tempo:
image: grafana/tempo:latest
container_name: tempo
command: -config.file=/etc/tempo/tempo.yaml
restart: always
ports:
- "3200" # Tempo as grafana datasource
volumes:
- ./otel/tempo-config.yaml:/etc/tempo/tempo.yaml:ro
jaeger:
image: jaegertracing/all-in-one:latest
container_name: jaeger
environment:
- COLLECTOR_OTLP_ENABLED=true
restart: always
ports:
- "4317" # OTLP grpc
- "16686:16686" # Jaeger UI
zipkin:
image: openzipkin/zipkin:latest
container_name: zipkin
restart: always
ports:
- "9411:9411" # Zipkin UI
grafana:
container_name: grafana
image: grafana/grafana:latest
restart: always
ports:
- "3000:3000" # Grafana UI
volumes:
- ./otel/grafana-datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml:ro
depends_on:
- prometheus
- loki
- tempo
- jaeger
- zipkin