-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
208 lines (187 loc) · 5.91 KB
/
docker-compose.yml
File metadata and controls
208 lines (187 loc) · 5.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
197
198
199
200
201
202
203
204
205
206
207
208
services:
# PostgreSQL - Primary storage
postgres:
image: postgres:18-alpine
container_name: ingestkit-postgres
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-ingestkit}
POSTGRES_USER: ${POSTGRES_USER:-ingestkit}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ingestkit_dev}
ports:
- "${POSTGRES_PORT:-5433}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init-db:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-ingestkit}"]
interval: 5s
timeout: 5s
retries: 5
networks:
- ingestkit
# Redpanda - Message broker (Kafka-compatible)
redpanda:
image: docker.redpanda.com/redpandadata/redpanda:v23.3.5
container_name: ingestkit-redpanda
restart: unless-stopped
command:
- redpanda
- start
- --kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19092
- --advertise-kafka-addr internal://redpanda:9092,external://localhost:19092
- --pandaproxy-addr internal://0.0.0.0:8082,external://0.0.0.0:18082
- --advertise-pandaproxy-addr internal://redpanda:8082,external://localhost:18082
- --schema-registry-addr internal://0.0.0.0:8081,external://0.0.0.0:18081
- --rpc-addr redpanda:33145
- --advertise-rpc-addr redpanda:33145
ports:
- "18081:18081" # Schema Registry
- "18082:18082" # HTTP Proxy
- "19092:19092" # Kafka API
- "19644:9644" # Admin API
volumes:
- redpanda_data:/var/lib/redpanda/data
healthcheck:
test: ["CMD-SHELL", "rpk cluster health | grep -E 'Healthy:.+true' || exit 1"]
interval: 15s
timeout: 3s
retries: 5
start_period: 5s
networks:
- ingestkit
# Redpanda Console - Web UI for Redpanda
redpanda-console:
image: docker.redpanda.com/redpandadata/console:v2.4.3
container_name: ingestkit-redpanda-console
restart: unless-stopped
entrypoint: /bin/sh
command: -c 'echo "$$CONSOLE_CONFIG_FILE" > /tmp/config.yml; /app/console'
environment:
CONFIG_FILEPATH: /tmp/config.yml
CONSOLE_CONFIG_FILE: |
kafka:
brokers: ["redpanda:9092"]
schemaRegistry:
enabled: true
urls: ["http://redpanda:8081"]
redpanda:
adminApi:
enabled: true
urls: ["http://redpanda:9644"]
ports:
- "8090:8080"
depends_on:
redpanda:
condition: service_healthy
networks:
- ingestkit
# Database Migrations - Run once on startup
migrate:
image: migrate/migrate:latest
entrypoint: /bin/sh
command: -c "migrate -path /migrations -database 'postgres://${POSTGRES_USER:-ingestkit}:${POSTGRES_PASSWORD:-ingestkit_dev}@postgres:5432/${POSTGRES_DB:-ingestkit}?sslmode=disable' up || exit 0"
volumes:
- ./migrations:/migrations
depends_on:
postgres:
condition: service_healthy
networks:
- ingestkit
restart: "no" # Run once and exit
# IngestKit API Server
api:
build:
context: .
dockerfile: Dockerfile.api
restart: unless-stopped
environment:
# API Configuration
API_PORT: ${API_PORT:-8080}
RATE_LIMIT_RPS: ${RATE_LIMIT_RPS:-20000}
GOMAXPROCS: ${GOMAXPROCS:-6}
GOMEMLIMIT: ${GOMEMLIMIT:-3GiB}
LOG_LEVEL: ${LOG_LEVEL:-warn}
# API Keys (format: key:tenant_id)
API_KEY_1: ${API_KEY_1:-dev_key_1234567890:default}
API_KEY_2: ${API_KEY_2:-sk_test_tenant_alpha:tenant_alpha}
API_KEY_3: ${API_KEY_3:-dev_key_ecommerce:ecommerce-demo}
# Admin Key for schema push
ADMIN_SCHEMA_KEY: ${ADMIN_SCHEMA_KEY:-}
# Database
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_USER: ${POSTGRES_USER:-ingestkit}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ingestkit_dev}
POSTGRES_DB: ${POSTGRES_DB:-ingestkit}
# Redpanda
REDPANDA_ADDR: redpanda:9092
REDPANDA_TOPIC: ${REDPANDA_TOPIC:-ingestkit.events}
ports:
- "${API_PORT:-8080}:8080"
depends_on:
postgres:
condition: service_healthy
redpanda:
condition: service_healthy
migrate:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 10s
timeout: 3s
retries: 3
start_period: 5s
networks:
- ingestkit
# IngestKit Consumer Worker
consumer:
build:
context: .
dockerfile: Dockerfile.consumer
restart: unless-stopped
environment:
# Consumer Configuration
CONSUMER_WORKERS: ${CONSUMER_WORKERS:-4}
CONSUMER_BATCH_SIZE: ${CONSUMER_BATCH_SIZE:-500}
CONSUMER_BATCH_TIMEOUT_MS: ${CONSUMER_BATCH_TIMEOUT_MS:-20}
GOMAXPROCS: ${GOMAXPROCS:-6}
GOMEMLIMIT: ${GOMEMLIMIT:-3GiB}
LOG_LEVEL: ${LOG_LEVEL:-warn}
# Database (using DB_* prefix that consumer expects)
DB_HOST: postgres
DB_PORT: 5432
DB_USER: ${POSTGRES_USER:-ingestkit}
DB_PASSWORD: ${POSTGRES_PASSWORD:-ingestkit_dev}
DB_NAME: ${POSTGRES_DB:-ingestkit}
# Redpanda
REDPANDA_ADDR: redpanda:9092
REDPANDA_TOPIC: ${REDPANDA_TOPIC:-ingestkit.events}
CONSUMER_GROUP_ID: ${CONSUMER_GROUP_ID:-ingestkit-consumer}
# Metrics
METRICS_PORT: ${METRICS_PORT:-8081}
ports:
- "${METRICS_PORT:-8081}:8081"
depends_on:
postgres:
condition: service_healthy
redpanda:
condition: service_healthy
migrate:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8081/health"]
interval: 10s
timeout: 3s
retries: 3
start_period: 10s
networks:
- ingestkit
volumes:
postgres_data:
driver: local
redpanda_data:
driver: local
networks:
ingestkit:
driver: bridge