-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunway.yaml
More file actions
385 lines (319 loc) · 8.05 KB
/
runway.yaml
File metadata and controls
385 lines (319 loc) · 8.05 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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# Runway Platform Deployment Configuration
# Production deployment for StackMemory MCP Server
name: stackmemory-mcp
version: 1.0.0
description: "Lossless memory runtime for AI coding tools with authentication"
# Global environment variables (can be overridden per service)
environment:
NODE_ENV: production
LOG_LEVEL: info
ENABLE_ANALYTICS: "true"
ENABLE_LINEAR_SYNC: "true"
ENABLE_WEBSOCKET: "true"
services:
# Main MCP Server Application
- name: mcp-server
type: web
runtime: node20
dockerfile: Dockerfile.runway
build:
command: npm run build
environment:
NODE_ENV: production
start:
command: node --max-old-space-size=2048 dist/src/runway/index.js
health_check:
path: /health
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
environment:
# Injected from Runway secrets
DATABASE_URL: ${DATABASE_URL}
REDIS_URL: ${REDIS_URL}
AUTH0_DOMAIN: ${AUTH0_DOMAIN}
AUTH0_AUDIENCE: ${AUTH0_AUDIENCE}
AUTH0_CLIENT_ID: ${AUTH0_CLIENT_ID}
AUTH0_CLIENT_SECRET: ${AUTH0_CLIENT_SECRET}
JWT_SECRET: ${JWT_SECRET}
DATADOG_API_KEY: ${DATADOG_API_KEY}
SENTRY_DSN: ${SENTRY_DSN}
# Service configuration
PORT: 8080
DATABASE_POOL_SIZE: 20
RATE_LIMIT_FREE: 100
RATE_LIMIT_PRO: 1000
RATE_LIMIT_ENTERPRISE: 10000
CORS_ORIGINS: "https://claude.ai,https://app.stackmemory.com"
resources:
cpu: 2000m # 2 vCPUs
memory: 4096Mi # 4GB RAM
storage: 20Gi # 20GB disk
scaling:
min_instances: 2
max_instances: 20
target_cpu_utilization: 70
target_memory_utilization: 80
scale_down_delay: 300s
scale_up_delay: 30s
ports:
- protocol: TCP
port: 8080
expose: true
domains:
- mcp.stackmemory.com
- stackmemory-mcp.runway.app
tls:
enabled: true
redirect_http: true
min_version: "1.2"
# Background Worker for Queue Processing
- name: queue-worker
type: worker
runtime: node20
dockerfile: Dockerfile.runway
start:
command: node dist/src/runway/queue/worker.js
environment:
DATABASE_URL: ${DATABASE_URL}
REDIS_URL: ${REDIS_URL}
WORKER_CONCURRENCY: 5
WORKER_MAX_JOBS: 100
resources:
cpu: 1000m
memory: 2048Mi
scaling:
min_instances: 1
max_instances: 10
target_queue_size: 100
scale_down_delay: 600s
# Database Migration Job
- name: db-migrate
type: job
runtime: node20
dockerfile: Dockerfile.runway
command: node dist/src/runway/database/migrate.js
environment:
DATABASE_URL: ${DATABASE_URL}
resources:
cpu: 500m
memory: 1024Mi
schedule: "@deployment" # Run on each deployment
timeout: 300s
retries: 3
databases:
# PostgreSQL Database
- name: postgres
type: postgresql
version: "15"
plan: production-4vcpu-8gb
configuration:
max_connections: 200
shared_buffers: 2GB
effective_cache_size: 6GB
work_mem: 10MB
maintenance_work_mem: 512MB
random_page_cost: 1.1
effective_io_concurrency: 200
backup:
enabled: true
schedule: "0 2 * * *" # Daily at 2 AM
retention: 30 # Keep 30 days of backups
type: continuous # Point-in-time recovery
high_availability:
enabled: true
replicas: 2
regions:
- us-east-1
- us-west-2
monitoring:
enabled: true
slow_query_log: true
slow_query_threshold: 1000ms
caches:
# Redis Cache
- name: redis
type: redis
version: "7.0"
plan: production-2vcpu-4gb
configuration:
maxmemory: 4GB
maxmemory_policy: allkeys-lru
appendonly: yes
appendfsync: everysec
high_availability:
enabled: true
replicas: 2
failover: automatic
persistence:
enabled: true
type: aof # Append-only file
storage:
# Object Storage for file uploads
- name: uploads
type: s3
size: 100Gi
lifecycle:
- rule: delete-old-temp-files
prefix: /tmp/
expiration_days: 7
- rule: archive-old-contexts
prefix: /contexts/
transition_to_glacier_days: 90
cors:
- allowed_origins:
- "https://app.stackmemory.com"
- "https://claude.ai"
allowed_methods:
- GET
- PUT
- POST
allowed_headers:
- "*"
max_age_seconds: 3600
monitoring:
# DataDog Integration
datadog:
enabled: true
api_key: ${DATADOG_API_KEY}
tags:
- "env:production"
- "service:stackmemory-mcp"
apm:
enabled: true
sample_rate: 0.1
logs:
enabled: true
include_patterns:
- "*.log"
- "stdout"
- "stderr"
metrics:
enabled: true
custom_metrics: true
# Sentry Error Tracking
sentry:
enabled: true
dsn: ${SENTRY_DSN}
environment: production
traces_sample_rate: 0.1
profiles_sample_rate: 0.1
# CloudWatch Logs
cloudwatch:
enabled: true
log_group: /runway/stackmemory-mcp
retention_days: 30
alerts:
# PagerDuty Integration
pagerduty:
enabled: true
integration_key: ${PAGERDUTY_KEY}
rules:
- name: high-error-rate
condition: "error_rate > 0.05"
duration: 5m
severity: critical
- name: high-latency
condition: "p95_latency > 2000"
duration: 10m
severity: warning
- name: database-connection-pool
condition: "db_connections_used / db_connections_total > 0.9"
duration: 5m
severity: warning
- name: memory-usage
condition: "memory_used / memory_total > 0.9"
duration: 10m
severity: warning
- name: disk-usage
condition: "disk_used / disk_total > 0.85"
duration: 15m
severity: warning
security:
# Web Application Firewall
waf:
enabled: true
mode: blocking
rules:
- owasp-top-10
- known-bad-inputs
- sql-injection
- xss
rate_limiting:
enabled: true
requests_per_minute: 1000
burst: 100
ip_whitelist:
- "35.235.240.0/20" # Claude.ai IP range
geo_blocking:
enabled: false
blocked_countries: []
# DDoS Protection
ddos_protection:
enabled: true
mode: automatic
threshold: 10000 # requests per second
# Secrets Management
secrets:
provider: runway-vault
auto_rotate: true
rotation_days: 90
deployment:
strategy: rolling
max_surge: 2
max_unavailable: 1
pre_deployment:
- name: database-backup
command: ./scripts/backup-db.sh
- name: run-tests
command: npm test
post_deployment:
- name: smoke-tests
command: ./scripts/smoke-test.sh
timeout: 300s
- name: notify-team
command: ./scripts/notify-deployment.sh
rollback:
automatic: true
on_error_rate: 0.1
on_latency_p99: 5000
canary:
enabled: true
percentage: 10
duration: 30m
metrics:
- error_rate
- latency_p95
- success_rate
compliance:
# GDPR Compliance
gdpr:
enabled: true
data_retention_days: 365
right_to_be_forgotten: true
data_portability: true
# SOC2 Compliance
soc2:
enabled: true
audit_logging: true
encryption_at_rest: true
encryption_in_transit: true
cost_optimization:
# Auto-scaling policies to optimize costs
quiet_hours:
enabled: true
schedule: "0 22 * * 1-5" # 10 PM weekdays
min_instances: 1
weekend_scaling:
enabled: true
schedule: "0 0 * * 6" # Saturday midnight
min_instances: 1
max_instances: 5
# Runway CLI commands
commands:
deploy: runway deploy --environment production --wait
status: runway status stackmemory-mcp
logs: runway logs stackmemory-mcp --tail 100
scale: runway scale stackmemory-mcp --replicas
rollback: runway rollback stackmemory-mcp --to-previous