This repository was archived by the owner on May 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
295 lines (274 loc) · 9.64 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
295 lines (274 loc) · 9.64 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# Copyright 2025 Steven Lopez
#
# Licensed under the Apache License, Version 2.0 (the "License");
# SPDX-License-Identifier: Apache-2.0
version: "3.8"
name: streamkernel-local
services:
# =======================================================================
# OPEN POLICY AGENT (OPA) — Authorization
# =======================================================================
opa:
image: openpolicyagent/opa:latest-debug
container_name: arena-opa
ports:
- "8181:8181"
volumes:
- ./policies:/policies:ro
command:
- "run"
- "--server"
- "--addr=0.0.0.0:8181"
- "--log-level=info"
- "/policies"
healthcheck:
# NOTE: uses wget; if missing, replace with curl -fsS ...
test: ["CMD-SHELL", "wget -qO- http://localhost:8181/health >/dev/null 2>&1 || exit 1"]
interval: 5s
timeout: 3s
retries: 30
start_period: 5s
restart: unless-stopped
# =======================================================================
# KAFKA (KRaft, single-node) — Host + Container access, plus Internal mTLS
#
# Host access:
# PLAINTEXT_HOST -> localhost:9092
# SSL_HOST -> localhost:9093 (mTLS)
#
# Container access:
# PLAINTEXT -> broker:29092
# SSL -> broker:29094 (mTLS)
# =======================================================================
broker:
image: confluentinc/cp-kafka:7.6.1
container_name: arena-broker
hostname: broker
ports:
- "9092:9092"
- "9093:9093"
# Optional: exposing internal SSL can be useful for debugging from host
- "29094:29094"
volumes:
- kafka-data-volume:/var/lib/kafka/data
- ./secrets:/etc/kafka/secrets:ro
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_CONTROLLER_QUORUM_VOTERS: "1@broker:29093"
KAFKA_LISTENERS: >-
PLAINTEXT://0.0.0.0:29092,
CONTROLLER://0.0.0.0:29093,
PLAINTEXT_HOST://0.0.0.0:9092,
SSL_HOST://0.0.0.0:9093,
SSL://0.0.0.0:29094
KAFKA_ADVERTISED_LISTENERS: >-
PLAINTEXT://broker:29092,
PLAINTEXT_HOST://localhost:9092,
SSL://broker:29094,
SSL_HOST://localhost:9093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: >-
CONTROLLER:PLAINTEXT,
PLAINTEXT:PLAINTEXT,
PLAINTEXT_HOST:PLAINTEXT,
SSL:SSL,
SSL_HOST:SSL
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
CLUSTER_ID: "MkU3OEVBNTcwNTJENDM2Qk"
# --- PERFORMANCE TUNING ---
KAFKA_NUM_NETWORK_THREADS: 8
KAFKA_NUM_IO_THREADS: 8
KAFKA_LOG_SEGMENT_BYTES: 1073741824
KAFKA_LOG_RETENTION_HOURS: -1
KAFKA_LOG_RETENTION_BYTES: 536870912000
KAFKA_NUM_PARTITIONS: 10
KAFKA_MESSAGE_MAX_BYTES: 10485760
KAFKA_SOCKET_REQUEST_MAX_BYTES: 104857600
# --- DURABILITY TUNING (single-node dev) ---
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_NUM_REPLICA_FETCHERS: 4
# --- SECURITY (mTLS) ---
KAFKA_SSL_KEYSTORE_CREDENTIALS: keystore_creds
KAFKA_SSL_KEY_CREDENTIALS: key_creds
KAFKA_SSL_TRUSTSTORE_CREDENTIALS: truststore_creds
KAFKA_SSL_KEYSTORE_FILENAME: kafka.server.keystore.p12
KAFKA_SSL_TRUSTSTORE_FILENAME: kafka.truststore.p12
KAFKA_SSL_KEYSTORE_LOCATION: /etc/kafka/secrets/kafka.server.keystore.p12
KAFKA_SSL_TRUSTSTORE_LOCATION: /etc/kafka/secrets/kafka.truststore.p12
KAFKA_SSL_KEYSTORE_PASSWORD: changeit
KAFKA_SSL_KEY_PASSWORD: changeit
KAFKA_SSL_TRUSTSTORE_PASSWORD: changeit
KAFKA_SSL_CLIENT_AUTH: required
KAFKA_SSL_KEYSTORE_TYPE: PKCS12
KAFKA_SSL_TRUSTSTORE_TYPE: PKCS12
healthcheck:
test: ["CMD-SHELL", "kafka-broker-api-versions --bootstrap-server localhost:9092 >/dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 5s
retries: 25
start_period: 20s
restart: unless-stopped
# =======================================================================
# Schema Registry — enabled by default because many enterprise profiles use it
# Disable by running compose without it (or create a "no-sr" profile later).
# =======================================================================
schema-registry:
image: confluentinc/cp-schema-registry:7.6.1
container_name: arena-schema-registry
depends_on:
broker:
condition: service_healthy
ports:
- "8081:8081"
environment:
SCHEMA_REGISTRY_HOST_NAME: schema-registry
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: "broker:29092"
SCHEMA_REGISTRY_LISTENERS: "http://0.0.0.0:8081"
healthcheck:
# NOTE: uses curl; if missing, replace with wget -qO- ...
test: ["CMD-SHELL", "curl -fsS http://localhost:8081/subjects >/dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 5s
retries: 25
start_period: 20s
restart: unless-stopped
# =======================================================================
# StreamKernel runtime (Option A) — depends only on what the active profile needs
#
# Keep this "core" runtime minimal. Enable optional backends
# (mongo/postgres/etc.) via compose profiles when testing those connectors.
# =======================================================================
streamkernel:
build: .
container_name: streamkernel
depends_on:
broker:
condition: service_healthy
opa:
condition: service_healthy
schema-registry:
condition: service_healthy
ports:
- "8080:8080" # Prometheus metrics endpoint
volumes:
- ./config:/etc/streamkernel/config:ro
- ./secrets:/etc/streamkernel/secrets:ro
environment:
# Select the docker-mode profile for the pipeline you want to run.
SK_CONFIG_PATH: /etc/streamkernel/config/profiles/secure-durable-mtls-opa.docker.properties
healthcheck:
# NOTE: Requires wget in the StreamKernel image (recommended: apk add wget)
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/metrics >/dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 5s
retries: 30
start_period: 20s
restart: unless-stopped
# =======================================================================
# Kafka Exporter (Prometheus)
# =======================================================================
kafka-exporter:
image: danielqsj/kafka-exporter:latest
container_name: arena-kafka-exporter
depends_on:
broker:
condition: service_healthy
command:
- "--kafka.server=broker:29092"
ports:
- "9308:9308"
restart: unless-stopped
# =======================================================================
# Postgres + Exporter — Optional (enable with: --profile postgres)
# =======================================================================
postgres:
profiles: ["postgres"]
image: postgres:16
container_name: arena-postgres
environment:
POSTGRES_USER: arena
POSTGRES_PASSWORD: arena
POSTGRES_DB: arena_db
ports:
- "5432:5432"
volumes:
- postgres-data-volume:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U arena -d arena_db -h localhost -p 5432 >/dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 5s
retries: 25
start_period: 20s
restart: unless-stopped
postgres-exporter:
profiles: ["postgres"]
image: prometheuscommunity/postgres-exporter:latest
container_name: arena-postgres-exporter
depends_on:
postgres:
condition: service_healthy
environment:
DATA_SOURCE_NAME: "postgresql://arena:arena@postgres:5432/arena_db?sslmode=disable"
ports:
- "9187:9187"
restart: unless-stopped
# =======================================================================
# MongoDB — Optional (enable with: --profile mongo)
# =======================================================================
mongodb:
profiles: ["mongo"]
image: mongo:7.0
container_name: arena-mongodb
ports:
- "27017:27017"
volumes:
- mongo-data-volume:/data/db
environment:
MONGO_INITDB_DATABASE: support_db
healthcheck:
test: ["CMD-SHELL", "mongosh --quiet --host localhost --eval 'db.runCommand({ ping: 1 }).ok' | grep 1 >/dev/null || exit 1"]
interval: 10s
timeout: 5s
retries: 25
start_period: 20s
restart: unless-stopped
# =======================================================================
# Prometheus
# =======================================================================
prometheus:
image: prom/prometheus:latest
container_name: arena-prometheus
depends_on:
kafka-exporter:
condition: service_started
streamkernel:
condition: service_healthy
# Note: postgres-exporter is optional; if profile isn't enabled, it won't exist.
volumes:
- ./config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
ports:
- "9090:9090"
extra_hosts:
- "host.docker.internal:host-gateway"
restart: unless-stopped
# =======================================================================
# Grafana
# =======================================================================
grafana:
image: grafana/grafana:latest
container_name: arena-grafana
depends_on:
prometheus:
condition: service_started
ports:
- "3000:3000"
environment:
GF_SECURITY_ADMIN_PASSWORD: admin
restart: unless-stopped
volumes:
kafka-data-volume: {}
postgres-data-volume: {}
mongo-data-volume: {}