-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmulti-instance.yaml
More file actions
317 lines (295 loc) · 9.42 KB
/
Copy pathmulti-instance.yaml
File metadata and controls
317 lines (295 loc) · 9.42 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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# DEVELOPMENT ONLY — do not deploy to production. Sets MTLS_REQUIRED=false and admin cors_origin=*.
#
# Aether Gateway Multi-Instance Testing
# Docker Compose configuration for testing horizontal scaling with session affinity
#
# This setup includes:
# - 3 gateway instances with unique IDs
# - nginx load balancer with session affinity
# - Redis (valkey) for session registry and KV store
# - RabbitMQ with Streams plugin for messaging
# - PostgreSQL for task persistence
#
# Required environment variables:
# RABBITMQ_PASS — RabbitMQ password (no default; must be set explicitly)
#
# Optional environment variables:
# RABBITMQ_USER — RabbitMQ username (default: aether)
#
# Usage:
# RABBITMQ_PASS=yourpassword docker-compose -f server/deployments/docker-compose/multi-instance.yaml up
# docker-compose -f server/deployments/docker-compose/multi-instance.yaml down
version: '3.8'
services:
# =============================================================================
# Infrastructure Services
# =============================================================================
# PostgreSQL - Task persistence and metadata storage
postgres:
image: postgres:15-alpine
container_name: aether-postgres
environment:
POSTGRES_DB: aether
POSTGRES_USER: aether
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD required}
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U aether"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aether
# Redis (Valkey) - Session registry, KV store, checkpoint store
redis:
image: valkey/valkey:latest
container_name: aether-redis
command:
- valkey-server
- --bind
- "0.0.0.0"
- --protected-mode
- "no"
- --appendonly
- "no"
- --save
- ""
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aether
# RabbitMQ with Streams - Message routing backbone
rabbitmq:
image: ghcr.io/scitrera/rabbitmq-stream:4-management
container_name: aether-rabbitmq
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER:-aether}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASS:?RABBITMQ_PASS required}
ports:
- "5552:5552" # Stream protocol
- "5672:5672" # AMQP
- "15672:15672" # Management UI
volumes:
- rabbitmq-data:/var/lib/rabbitmq
- ./nginx/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "ping"]
interval: 30s
timeout: 10s
retries: 5
networks:
- aether
# =============================================================================
# Gateway Instances (3 replicas for high availability)
# =============================================================================
gateway-1:
image: scitrera/aether-gateway:latest
container_name: aether-gateway-1
build:
context: ../..
dockerfile: server/Dockerfile
environment:
# Gateway identity
AETHER_GATEWAY_ID: gateway-1
GATEWAY_PORT: "50051"
GATEWAY_HTTP_PORT: "8080"
# PostgreSQL
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: aether
POSTGRES_USER: aether
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD required}
POSTGRES_SSL_MODE: disable
POSTGRES_MAX_CONNECTIONS: "25"
POSTGRES_MAX_IDLE_CONNECTIONS: "5"
# Redis
REDIS_CLUSTER_ADDR_0: redis:6379
REDIS_PASSWORD: ""
REDIS_DB: "0"
# RabbitMQ
RABBITMQ_STREAM_URL: rabbitmq-stream://${RABBITMQ_USER:-aether}:${RABBITMQ_PASS:?RABBITMQ_PASS required}@rabbitmq:5552
RABBITMQ_AMQP_URL: amqp://${RABBITMQ_USER:-aether}:${RABBITMQ_PASS:?RABBITMQ_PASS required}@rabbitmq:5672/
# mTLS (disabled for local testing)
MTLS_REQUIRED: "false"
MTLS_MODE: relaxed
# Observability
OBSERVABILITY_LOG_LEVEL: info
OBSERVABILITY_PROMETHEUS_PORT: "9090"
# Cleanup settings
CLEANUP_TASK_PURGE_INTERVAL: 24h
CLEANUP_COMPLETED_TASK_RETENTION: 168h
CLEANUP_FAILED_TASK_RETENTION: 336h
CLEANUP_CANCELLED_TASK_RETENTION: 168h
CLEANUP_RECONCILIATION_INTERVAL: 1m
# Checkpoint settings
CHECKPOINT_DEFAULT_TTL: 3600s
ports:
- "50051:50051"
- "8081:8080"
- "9091:9090"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health/live"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- aether
gateway-2:
image: scitrera/aether-gateway:latest
container_name: aether-gateway-2
build:
context: ../..
dockerfile: server/Dockerfile
environment:
AETHER_GATEWAY_ID: gateway-2
GATEWAY_PORT: "50051"
GATEWAY_HTTP_PORT: "8080"
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: aether
POSTGRES_USER: aether
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD required}
POSTGRES_SSL_MODE: disable
POSTGRES_MAX_CONNECTIONS: "25"
POSTGRES_MAX_IDLE_CONNECTIONS: "5"
REDIS_CLUSTER_ADDR_0: redis:6379
REDIS_PASSWORD: ""
REDIS_DB: "0"
RABBITMQ_STREAM_URL: rabbitmq-stream://${RABBITMQ_USER:-aether}:${RABBITMQ_PASS:?RABBITMQ_PASS required}@rabbitmq:5552
RABBITMQ_AMQP_URL: amqp://${RABBITMQ_USER:-aether}:${RABBITMQ_PASS:?RABBITMQ_PASS required}@rabbitmq:5672/
MTLS_REQUIRED: "false"
MTLS_MODE: relaxed
OBSERVABILITY_LOG_LEVEL: info
OBSERVABILITY_PROMETHEUS_PORT: "9090"
CLEANUP_TASK_PURGE_INTERVAL: 24h
CLEANUP_COMPLETED_TASK_RETENTION: 168h
CLEANUP_FAILED_TASK_RETENTION: 336h
CLEANUP_CANCELLED_TASK_RETENTION: 168h
CLEANUP_RECONCILIATION_INTERVAL: 1m
CHECKPOINT_DEFAULT_TTL: 3600s
ports:
- "50052:50051"
- "8082:8080"
- "9092:9090"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health/live"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- aether
gateway-3:
image: scitrera/aether-gateway:latest
container_name: aether-gateway-3
build:
context: ../..
dockerfile: server/Dockerfile
environment:
AETHER_GATEWAY_ID: gateway-3
GATEWAY_PORT: "50051"
GATEWAY_HTTP_PORT: "8080"
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: aether
POSTGRES_USER: aether
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD required}
POSTGRES_SSL_MODE: disable
POSTGRES_MAX_CONNECTIONS: "25"
POSTGRES_MAX_IDLE_CONNECTIONS: "5"
REDIS_CLUSTER_ADDR_0: redis:6379
REDIS_PASSWORD: ""
REDIS_DB: "0"
RABBITMQ_STREAM_URL: rabbitmq-stream://${RABBITMQ_USER:-aether}:${RABBITMQ_PASS:?RABBITMQ_PASS required}@rabbitmq:5552
RABBITMQ_AMQP_URL: amqp://${RABBITMQ_USER:-aether}:${RABBITMQ_PASS:?RABBITMQ_PASS required}@rabbitmq:5672/
MTLS_REQUIRED: "false"
MTLS_MODE: relaxed
OBSERVABILITY_LOG_LEVEL: info
OBSERVABILITY_PROMETHEUS_PORT: "9090"
CLEANUP_TASK_PURGE_INTERVAL: 24h
CLEANUP_COMPLETED_TASK_RETENTION: 168h
CLEANUP_FAILED_TASK_RETENTION: 336h
CLEANUP_CANCELLED_TASK_RETENTION: 168h
CLEANUP_RECONCILIATION_INTERVAL: 1m
CHECKPOINT_DEFAULT_TTL: 3600s
ports:
- "50053:50051"
- "8083:8080"
- "9093:9090"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health/live"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- aether
# =============================================================================
# Load Balancer (nginx with session affinity)
# =============================================================================
nginx:
image: nginx:alpine
container_name: aether-nginx
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "50050:50050" # gRPC load balanced endpoint
- "8080:8080" # HTTP health check endpoint
depends_on:
gateway-1:
condition: service_healthy
gateway-2:
condition: service_healthy
gateway-3:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aether
# =============================================================================
# Volumes
# =============================================================================
volumes:
postgres-data:
driver: local
rabbitmq-data:
driver: local
# =============================================================================
# Networks
# =============================================================================
networks:
aether:
driver: bridge