-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
253 lines (244 loc) · 13.8 KB
/
docker-compose.yml
File metadata and controls
253 lines (244 loc) · 13.8 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
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ ALLSOURCE - Event Sourcing Platform ║
# ║ Local Development Stack ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ Quick Start: ║
# ║ docker compose up -d # Start core services ║
# ║ docker compose --profile full up -d # Start with Redis ║
# ║ docker compose --profile monitoring up -d # Start with Prometheus ║
# ║ docker compose logs -f # Follow logs ║
# ║ docker compose down # Stop all services ║
# ║ docker compose down -v # Stop and remove volumes ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
#
# ┌─────────────────────────────────────────────────────────────────────────────┐
# │ SERVICE │ PORT │ IMAGE SIZE │ DESCRIPTION │
# ├─────────────────────┼─────────┼──────────────┼──────────────────────────────┤
# │ core │ 3900 │ 15.7 MB │ Rust event store engine │
# │ control-plane │ 8080 │ 27.9 MB │ Go auth & orchestration │
# │ query-service │ 3902 │ 35.1 MB │ Elixir API & real-time │
# └─────────────────────┴─────────┴──────────────┴──────────────────────────────┘
#
# Total production footprint: ~79 MB
services:
# ═══════════════════════════════════════════════════════════════════════════
# CORE - High-Performance Event Store (Rust)
# ═══════════════════════════════════════════════════════════════════════════
# Image: ghcr.io/all-source-os/allsource-core:latest
# Size: 15.7 MB (distroless base)
# Perf: 469K events/sec write throughput
# ═══════════════════════════════════════════════════════════════════════════
core:
image: ghcr.io/all-source-os/allsource-core:${ALLSOURCE_VERSION:-latest}
build:
context: ./apps/core
target: runtime-alpine # Use alpine for Docker healthcheck support
container_name: allsource-core
ports:
- "3900:3900"
environment:
RUST_LOG: allsource_core=info,tower_http=info
ALLSOURCE_HOST: 0.0.0.0
ALLSOURCE_PORT: 3900
ALLSOURCE_DATA_DIR: /app/data
# Dev mode bypasses auth for local development - NEVER use in production
ALLSOURCE_DEV_MODE: "true"
volumes:
- core-data:/app/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3900/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
restart: unless-stopped
networks:
- allsource
# ═══════════════════════════════════════════════════════════════════════════
# CONTROL PLANE - Auth & Orchestration (Go)
# ═══════════════════════════════════════════════════════════════════════════
# Image: ghcr.io/all-source-os/allsource-control-plane:latest
# Size: 27.9 MB (distroless base)
# Auth: JWT + RBAC (4 roles, 7 permissions)
# ═══════════════════════════════════════════════════════════════════════════
control-plane:
image: ghcr.io/all-source-os/allsource-control-plane:${ALLSOURCE_VERSION:-latest}
build:
context: ./apps/control-plane
container_name: allsource-control-plane
ports:
- "8080:8080"
environment:
GIN_MODE: release
PORT: 8080
CORE_SERVICE_URL: http://core:3900
JWT_SECRET: ${JWT_SECRET:-dev-secret-change-in-production-minimum-32-chars}
# Cross-service communication
DATA_PLANE_URL: http://query-service:3902
QUERY_SERVICE_INTERNAL_URL: http://query-service:3902
INTERNAL_API_KEY: ${INTERNAL_API_KEY:-dev-internal-api-key-change-in-production}
# LemonSqueezy billing (optional)
LEMON_SQUEEZY_API_KEY: ${LEMON_SQUEEZY_API_KEY:-}
LEMON_SQUEEZY_STORE_ID: ${LEMON_SQUEEZY_STORE_ID:-}
LEMON_SQUEEZY_WEBHOOK_SECRET: ${LEMON_SQUEEZY_WEBHOOK_SECRET:-}
depends_on:
core:
condition: service_healthy
# Note: Distroless has no shell for healthcheck - use orchestrator probes in production
restart: unless-stopped
networks:
- allsource
# ═══════════════════════════════════════════════════════════════════════════
# QUERY SERVICE - API & Real-time Subscriptions (Elixir)
# ═══════════════════════════════════════════════════════════════════════════
# Image: ghcr.io/all-source-os/allsource-query-service:latest
# Size: 35.1 MB (Alpine + ERTS)
# API: REST, GraphQL, WebSocket subscriptions
# ═══════════════════════════════════════════════════════════════════════════
query-service:
image: ghcr.io/all-source-os/allsource-query-service:${ALLSOURCE_VERSION:-latest}
build:
context: ./apps/query-service
container_name: allsource-query-service
ports:
- "3902:3902"
environment:
SECRET_KEY_BASE: ${SECRET_KEY_BASE:-dev-secret-key-base-must-be-at-least-64-characters-long-for-security}
PORT: 3902
PHX_HOST: localhost
# Core connection (no PostgreSQL required)
CORE_URL: http://core:3900
CORE_WS_URL: ws://core:3900/api/v1/events/stream
CORE_WS_ENABLED: "true"
# Cross-service communication
INTERNAL_API_KEY: ${INTERNAL_API_KEY:-dev-internal-api-key-change-in-production}
JWT_SECRET: ${JWT_SECRET:-dev-secret-change-in-production-minimum-32-chars}
MGMT_PLANE_URL: http://control-plane:8080
# Dev mode bypasses auth for local development - NEVER use in production
AUTH_DISABLED: "true"
depends_on:
core:
condition: service_healthy
healthcheck:
test: ["CMD", "bin/query_service_ex", "rpc", "IO.puts(:ok)"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
restart: unless-stopped
networks:
- allsource
# ═══════════════════════════════════════════════════════════════════════════
# WEB - Dashboard & Documentation (Next.js)
# ═══════════════════════════════════════════════════════════════════════════
# Image: ghcr.io/all-source-os/allsource-web:latest
# Size: ~50 MB (Node.js + Next.js standalone)
# UI: React dashboard, documentation, onboarding
# ═══════════════════════════════════════════════════════════════════════════
web:
image: ghcr.io/all-source-os/allsource-web:${ALLSOURCE_VERSION:-latest}
build:
context: .
dockerfile: apps/web/Dockerfile
container_name: allsource-web
ports:
- "3000:3000"
environment:
NODE_ENV: production
NEXT_PUBLIC_API_URL: http://query-service:3902
NEXT_PUBLIC_CORE_URL: http://core:3900
depends_on:
query-service:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/"]
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
restart: unless-stopped
networks:
- allsource
# ═══════════════════════════════════════════════════════════════════════════
# REDIS - Caching & Sessions (Optional)
# ═══════════════════════════════════════════════════════════════════════════
redis:
image: redis:7-alpine
container_name: allsource-redis
ports:
- "6379:6379"
volumes:
- redis-data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- allsource
profiles:
- full
# ═══════════════════════════════════════════════════════════════════════════
# PROMETHEUS - Metrics Collection
# ═══════════════════════════════════════════════════════════════════════════
prometheus:
image: prom/prometheus:v2.51.0
container_name: allsource-prometheus
ports:
- "9090:9090"
volumes:
- ./deploy/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=15d'
- '--web.enable-lifecycle'
restart: unless-stopped
networks:
- allsource
profiles:
- monitoring
# ═══════════════════════════════════════════════════════════════════════════
# GRAFANA - Metrics Dashboard
# ═══════════════════════════════════════════════════════════════════════════
grafana:
image: grafana/grafana:10.4.0
container_name: allsource-grafana
ports:
- "3000:3000"
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin}
GF_USERS_ALLOW_SIGN_UP: "false"
volumes:
- ./deploy/grafana/provisioning:/etc/grafana/provisioning:ro
- grafana-data:/var/lib/grafana
depends_on:
- prometheus
restart: unless-stopped
networks:
- allsource
profiles:
- monitoring
# ═══════════════════════════════════════════════════════════════════════════════
# VOLUMES
# ═══════════════════════════════════════════════════════════════════════════════
volumes:
core-data:
name: allsource-core-data
redis-data:
name: allsource-redis-data
prometheus-data:
name: allsource-prometheus-data
grafana-data:
name: allsource-grafana-data
# ═══════════════════════════════════════════════════════════════════════════════
# NETWORKS
# ═══════════════════════════════════════════════════════════════════════════════
networks:
allsource:
name: allsource-network
driver: bridge