4runr-os 2.9.33 → 2.9.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/gateway/.dockerignore +11 -0
- package/apps/gateway/.eslintrc.json +28 -0
- package/apps/gateway/DEPLOYMENT.md +426 -0
- package/apps/gateway/Dockerfile +122 -0
- package/apps/gateway/Dockerfile.bak +41 -0
- package/apps/gateway/ENV_VARIABLES.md +366 -0
- package/apps/gateway/JWT-RATE-LIMIT-VALIDATION.md +462 -0
- package/apps/gateway/PERSISTENCE-AND-AUTH.md +227 -0
- package/apps/gateway/PHASE5-TESTING.md +222 -0
- package/apps/gateway/README.md +351 -0
- package/apps/gateway/TROUBLESHOOTING.md +541 -0
- package/apps/gateway/create-test-script.sh +386 -0
- package/apps/gateway/debug-api-responses.sh +94 -0
- package/apps/gateway/debug-failing-tests-v2.sh +81 -0
- package/apps/gateway/debug-failing-tests.sh +89 -0
- package/apps/gateway/debug-responses.sh +83 -0
- package/apps/gateway/debug-test-responses.sh +54 -0
- package/apps/gateway/debug-tests.sh +119 -0
- package/apps/gateway/diagnose-test-failure.sh +53 -0
- package/apps/gateway/dist/apps/gateway/src/adapters/redis-sentinel-publisher.d.ts +8 -0
- package/apps/gateway/dist/apps/gateway/src/adapters/redis-sentinel-publisher.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/adapters/redis-sentinel-publisher.js +27 -0
- package/apps/gateway/dist/apps/gateway/src/adapters/redis-sentinel-publisher.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/adapters/sentinel-event-stream.d.ts +14 -0
- package/apps/gateway/dist/apps/gateway/src/adapters/sentinel-event-stream.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/adapters/sentinel-event-stream.js +69 -0
- package/apps/gateway/dist/apps/gateway/src/adapters/sentinel-event-stream.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/agents/definitions-simple.d.ts +10 -0
- package/apps/gateway/dist/apps/gateway/src/agents/definitions-simple.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/agents/definitions-simple.js +372 -0
- package/apps/gateway/dist/apps/gateway/src/agents/definitions-simple.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/agents/definitions.d.ts +14 -0
- package/apps/gateway/dist/apps/gateway/src/agents/definitions.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/agents/definitions.js +210 -0
- package/apps/gateway/dist/apps/gateway/src/agents/definitions.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/agents/local-model-provider.d.ts +25 -0
- package/apps/gateway/dist/apps/gateway/src/agents/local-model-provider.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/agents/local-model-provider.js +144 -0
- package/apps/gateway/dist/apps/gateway/src/agents/local-model-provider.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/agents/tools.d.ts +24 -0
- package/apps/gateway/dist/apps/gateway/src/agents/tools.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/agents/tools.js +110 -0
- package/apps/gateway/dist/apps/gateway/src/agents/tools.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/anthropic-provider.d.ts +14 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/anthropic-provider.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/anthropic-provider.js +139 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/anthropic-provider.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/index.d.ts +6 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/index.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/index.js +6 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/index.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/openai-provider.d.ts +14 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/openai-provider.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/openai-provider.js +136 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/openai-provider.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/provider-manager.d.ts +18 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/provider-manager.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/provider-manager.js +91 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/provider-manager.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/redis-credentials-store.d.ts +15 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/redis-credentials-store.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/redis-credentials-store.js +153 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/redis-credentials-store.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/types.d.ts +54 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/types.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/types.js +2 -0
- package/apps/gateway/dist/apps/gateway/src/ai-providers/types.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/config/persistence.d.ts +5 -0
- package/apps/gateway/dist/apps/gateway/src/config/persistence.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/config/persistence.js +14 -0
- package/apps/gateway/dist/apps/gateway/src/config/persistence.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/crypto/envelope.d.ts +28 -0
- package/apps/gateway/dist/apps/gateway/src/crypto/envelope.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/crypto/envelope.js +111 -0
- package/apps/gateway/dist/apps/gateway/src/crypto/envelope.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/db/prisma.d.ts +4 -0
- package/apps/gateway/dist/apps/gateway/src/db/prisma.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/db/prisma.js +31 -0
- package/apps/gateway/dist/apps/gateway/src/db/prisma.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/db/redis.d.ts +5 -0
- package/apps/gateway/dist/apps/gateway/src/db/redis.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/db/redis.js +68 -0
- package/apps/gateway/dist/apps/gateway/src/db/redis.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/agents-api.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/agents-api.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/agents-api.js +369 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/agents-api.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/metrics-parser.d.ts +46 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/metrics-parser.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/metrics-parser.js +114 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/metrics-parser.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/middleware.d.ts +9 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/middleware.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/middleware.js +23 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/middleware.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/routes.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/routes.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/routes.js +266 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/routes.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/tools-api.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/tools-api.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/tools-api.js +183 -0
- package/apps/gateway/dist/apps/gateway/src/devkit/tools-api.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/health/index.d.ts +22 -0
- package/apps/gateway/dist/apps/gateway/src/health/index.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/health/index.js +180 -0
- package/apps/gateway/dist/apps/gateway/src/health/index.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/index.d.ts +2 -0
- package/apps/gateway/dist/apps/gateway/src/index.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/index.js +982 -0
- package/apps/gateway/dist/apps/gateway/src/index.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/metrics/index.d.ts +33 -0
- package/apps/gateway/dist/apps/gateway/src/metrics/index.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/metrics/index.js +166 -0
- package/apps/gateway/dist/apps/gateway/src/metrics/index.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/auth.d.ts +5 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/auth.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/auth.js +64 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/auth.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/authApiKey.d.ts +4 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/authApiKey.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/authApiKey.js +105 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/authApiKey.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/authJwt.d.ts +12 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/authJwt.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/authJwt.js +75 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/authJwt.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/correlationId.d.ts +4 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/correlationId.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/correlationId.js +11 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/correlationId.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/ddos-protection.d.ts +13 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/ddos-protection.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/ddos-protection.js +178 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/ddos-protection.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/errorHandler.d.ts +14 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/errorHandler.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/errorHandler.js +98 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/errorHandler.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/mfa.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/mfa.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/mfa.js +92 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/mfa.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/rateLimit.d.ts +6 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/rateLimit.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/rateLimit.js +54 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/rateLimit.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/rbac.d.ts +19 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/rbac.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/rbac.js +229 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/rbac.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/security.d.ts +8 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/security.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/security.js +55 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/security.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/validate.d.ts +7 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/validate.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/validate.js +156 -0
- package/apps/gateway/dist/apps/gateway/src/middleware/validate.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/queue/config.d.ts +26 -0
- package/apps/gateway/dist/apps/gateway/src/queue/config.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/queue/config.js +21 -0
- package/apps/gateway/dist/apps/gateway/src/queue/config.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/queue/index.d.ts +13 -0
- package/apps/gateway/dist/apps/gateway/src/queue/index.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/queue/index.js +152 -0
- package/apps/gateway/dist/apps/gateway/src/queue/index.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/queue/processor.d.ts +16 -0
- package/apps/gateway/dist/apps/gateway/src/queue/processor.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/queue/processor.js +316 -0
- package/apps/gateway/dist/apps/gateway/src/queue/processor.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/ai-providers-simple.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/routes/ai-providers-simple.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/ai-providers-simple.js +116 -0
- package/apps/gateway/dist/apps/gateway/src/routes/ai-providers-simple.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/ai-providers.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/routes/ai-providers.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/ai-providers.js +157 -0
- package/apps/gateway/dist/apps/gateway/src/routes/ai-providers.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/chats.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/routes/chats.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/chats.js +150 -0
- package/apps/gateway/dist/apps/gateway/src/routes/chats.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/gdpr.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/routes/gdpr.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/gdpr.js +228 -0
- package/apps/gateway/dist/apps/gateway/src/routes/gdpr.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/mfa.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/routes/mfa.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/mfa.js +191 -0
- package/apps/gateway/dist/apps/gateway/src/routes/mfa.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/sentinel-policies.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/routes/sentinel-policies.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/sentinel-policies.js +142 -0
- package/apps/gateway/dist/apps/gateway/src/routes/sentinel-policies.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/sentinel-predictive.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/routes/sentinel-predictive.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/sentinel-predictive.js +82 -0
- package/apps/gateway/dist/apps/gateway/src/routes/sentinel-predictive.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/shield.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/routes/shield.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/shield.js +71 -0
- package/apps/gateway/dist/apps/gateway/src/routes/shield.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/tool-credentials.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/routes/tool-credentials.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/tool-credentials.js +194 -0
- package/apps/gateway/dist/apps/gateway/src/routes/tool-credentials.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/tool-proxy.d.ts +3 -0
- package/apps/gateway/dist/apps/gateway/src/routes/tool-proxy.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/routes/tool-proxy.js +187 -0
- package/apps/gateway/dist/apps/gateway/src/routes/tool-proxy.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/runs/index.d.ts +5 -0
- package/apps/gateway/dist/apps/gateway/src/runs/index.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/runs/index.js +19 -0
- package/apps/gateway/dist/apps/gateway/src/runs/index.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/runs/memoryRunStore.d.ts +12 -0
- package/apps/gateway/dist/apps/gateway/src/runs/memoryRunStore.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/runs/memoryRunStore.js +78 -0
- package/apps/gateway/dist/apps/gateway/src/runs/memoryRunStore.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/runs/postgresRunStore.d.ts +15 -0
- package/apps/gateway/dist/apps/gateway/src/runs/postgresRunStore.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/runs/postgresRunStore.js +148 -0
- package/apps/gateway/dist/apps/gateway/src/runs/postgresRunStore.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/runs/runStore.d.ts +10 -0
- package/apps/gateway/dist/apps/gateway/src/runs/runStore.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/runs/runStore.js +2 -0
- package/apps/gateway/dist/apps/gateway/src/runs/runStore.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/runs/types.d.ts +44 -0
- package/apps/gateway/dist/apps/gateway/src/runs/types.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/runs/types.js +2 -0
- package/apps/gateway/dist/apps/gateway/src/runs/types.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/schemas/runs.d.ts +126 -0
- package/apps/gateway/dist/apps/gateway/src/schemas/runs.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/schemas/runs.js +63 -0
- package/apps/gateway/dist/apps/gateway/src/schemas/runs.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/utils/circuit-breaker.d.ts +13 -0
- package/apps/gateway/dist/apps/gateway/src/utils/circuit-breaker.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/utils/circuit-breaker.js +72 -0
- package/apps/gateway/dist/apps/gateway/src/utils/circuit-breaker.js.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/utils/log-encryption.d.ts +10 -0
- package/apps/gateway/dist/apps/gateway/src/utils/log-encryption.d.ts.map +1 -0
- package/apps/gateway/dist/apps/gateway/src/utils/log-encryption.js +140 -0
- package/apps/gateway/dist/apps/gateway/src/utils/log-encryption.js.map +1 -0
- package/apps/gateway/dist/packages/adapters/redis/IdempotencyStore.d.ts +41 -0
- package/apps/gateway/dist/packages/adapters/redis/IdempotencyStore.d.ts.map +1 -0
- package/apps/gateway/dist/packages/adapters/redis/IdempotencyStore.js +127 -0
- package/apps/gateway/dist/packages/adapters/redis/IdempotencyStore.js.map +1 -0
- package/apps/gateway/dist/packages/middleware/idempotency/idempotency.d.ts +45 -0
- package/apps/gateway/dist/packages/middleware/idempotency/idempotency.d.ts.map +1 -0
- package/apps/gateway/dist/packages/middleware/idempotency/idempotency.js +145 -0
- package/apps/gateway/dist/packages/middleware/idempotency/idempotency.js.map +1 -0
- package/apps/gateway/dist/src/api/admin.d.ts +7 -0
- package/apps/gateway/dist/src/api/admin.d.ts.map +1 -0
- package/apps/gateway/dist/src/api/admin.js +275 -0
- package/apps/gateway/dist/src/api/admin.js.map +1 -0
- package/apps/gateway/dist/src/api/agents.d.ts +3 -0
- package/apps/gateway/dist/src/api/agents.d.ts.map +1 -0
- package/apps/gateway/dist/src/api/agents.js +66 -0
- package/apps/gateway/dist/src/api/agents.js.map +1 -0
- package/apps/gateway/dist/src/api/proxy.d.ts +3 -0
- package/apps/gateway/dist/src/api/proxy.d.ts.map +1 -0
- package/apps/gateway/dist/src/api/proxy.js +373 -0
- package/apps/gateway/dist/src/api/proxy.js.map +1 -0
- package/apps/gateway/dist/src/api/tokens.d.ts +3 -0
- package/apps/gateway/dist/src/api/tokens.d.ts.map +1 -0
- package/apps/gateway/dist/src/api/tokens.js +116 -0
- package/apps/gateway/dist/src/api/tokens.js.map +1 -0
- package/apps/gateway/dist/src/crypto/envelope.d.ts +26 -0
- package/apps/gateway/dist/src/crypto/envelope.d.ts.map +1 -0
- package/apps/gateway/dist/src/crypto/envelope.js +100 -0
- package/apps/gateway/dist/src/crypto/envelope.js.map +1 -0
- package/apps/gateway/dist/src/models/memory-db.d.ts +149 -0
- package/apps/gateway/dist/src/models/memory-db.d.ts.map +1 -0
- package/apps/gateway/dist/src/models/memory-db.js +295 -0
- package/apps/gateway/dist/src/models/memory-db.js.map +1 -0
- package/apps/gateway/dist/src/observability/metrics.d.ts +62 -0
- package/apps/gateway/dist/src/observability/metrics.d.ts.map +1 -0
- package/apps/gateway/dist/src/observability/metrics.js +205 -0
- package/apps/gateway/dist/src/observability/metrics.js.map +1 -0
- package/apps/gateway/dist/src/policies/validators.d.ts +147 -0
- package/apps/gateway/dist/src/policies/validators.d.ts.map +1 -0
- package/apps/gateway/dist/src/policies/validators.js +105 -0
- package/apps/gateway/dist/src/policies/validators.js.map +1 -0
- package/apps/gateway/dist/src/runtime/cache.d.ts +31 -0
- package/apps/gateway/dist/src/runtime/cache.d.ts.map +1 -0
- package/apps/gateway/dist/src/runtime/cache.js +142 -0
- package/apps/gateway/dist/src/runtime/cache.js.map +1 -0
- package/apps/gateway/dist/src/runtime/circuit.d.ts +57 -0
- package/apps/gateway/dist/src/runtime/circuit.d.ts.map +1 -0
- package/apps/gateway/dist/src/runtime/circuit.js +173 -0
- package/apps/gateway/dist/src/runtime/circuit.js.map +1 -0
- package/apps/gateway/dist/src/runtime/http.d.ts +62 -0
- package/apps/gateway/dist/src/runtime/http.d.ts.map +1 -0
- package/apps/gateway/dist/src/runtime/http.js +102 -0
- package/apps/gateway/dist/src/runtime/http.js.map +1 -0
- package/apps/gateway/dist/src/runtime/lifecycle.d.ts +49 -0
- package/apps/gateway/dist/src/runtime/lifecycle.d.ts.map +1 -0
- package/apps/gateway/dist/src/runtime/lifecycle.js +155 -0
- package/apps/gateway/dist/src/runtime/lifecycle.js.map +1 -0
- package/apps/gateway/dist/src/runtime/retry.d.ts +33 -0
- package/apps/gateway/dist/src/runtime/retry.d.ts.map +1 -0
- package/apps/gateway/dist/src/runtime/retry.js +122 -0
- package/apps/gateway/dist/src/runtime/retry.js.map +1 -0
- package/apps/gateway/dist/src/secrets/provider.d.ts +50 -0
- package/apps/gateway/dist/src/secrets/provider.d.ts.map +1 -0
- package/apps/gateway/dist/src/secrets/provider.js +189 -0
- package/apps/gateway/dist/src/secrets/provider.js.map +1 -0
- package/apps/gateway/dist/src/sentinel/config.d.ts +25 -0
- package/apps/gateway/dist/src/sentinel/config.d.ts.map +1 -0
- package/apps/gateway/dist/src/sentinel/config.js +179 -0
- package/apps/gateway/dist/src/sentinel/config.js.map +1 -0
- package/apps/gateway/dist/src/sentinel/judge.d.ts +24 -0
- package/apps/gateway/dist/src/sentinel/judge.d.ts.map +1 -0
- package/apps/gateway/dist/src/sentinel/judge.js +275 -0
- package/apps/gateway/dist/src/sentinel/judge.js.map +1 -0
- package/apps/gateway/dist/src/sentinel/middleware.d.ts +19 -0
- package/apps/gateway/dist/src/sentinel/middleware.d.ts.map +1 -0
- package/apps/gateway/dist/src/sentinel/middleware.js +231 -0
- package/apps/gateway/dist/src/sentinel/middleware.js.map +1 -0
- package/apps/gateway/dist/src/sentinel/shield.d.ts +116 -0
- package/apps/gateway/dist/src/sentinel/shield.d.ts.map +1 -0
- package/apps/gateway/dist/src/sentinel/shield.js +344 -0
- package/apps/gateway/dist/src/sentinel/shield.js.map +1 -0
- package/apps/gateway/dist/src/sentinel/telemetry.d.ts +79 -0
- package/apps/gateway/dist/src/sentinel/telemetry.d.ts.map +1 -0
- package/apps/gateway/dist/src/sentinel/telemetry.js +313 -0
- package/apps/gateway/dist/src/sentinel/telemetry.js.map +1 -0
- package/apps/gateway/dist/src/sentinel/types.d.ts +283 -0
- package/apps/gateway/dist/src/sentinel/types.d.ts.map +1 -0
- package/apps/gateway/dist/src/sentinel/types.js +2 -0
- package/apps/gateway/dist/src/sentinel/types.js.map +1 -0
- package/apps/gateway/dist/src/services/4runr-cipher.d.ts +9 -0
- package/apps/gateway/dist/src/services/4runr-cipher.d.ts.map +1 -0
- package/apps/gateway/dist/src/services/4runr-cipher.js +64 -0
- package/apps/gateway/dist/src/services/4runr-cipher.js.map +1 -0
- package/apps/gateway/dist/src/services/policyEngine.d.ts +17 -0
- package/apps/gateway/dist/src/services/policyEngine.d.ts.map +1 -0
- package/apps/gateway/dist/src/services/policyEngine.js +310 -0
- package/apps/gateway/dist/src/services/policyEngine.js.map +1 -0
- package/apps/gateway/dist/src/tools/gmail-send.d.ts +19 -0
- package/apps/gateway/dist/src/tools/gmail-send.d.ts.map +1 -0
- package/apps/gateway/dist/src/tools/gmail-send.js +120 -0
- package/apps/gateway/dist/src/tools/gmail-send.js.map +1 -0
- package/apps/gateway/dist/src/tools/http-fetch.d.ts +13 -0
- package/apps/gateway/dist/src/tools/http-fetch.d.ts.map +1 -0
- package/apps/gateway/dist/src/tools/http-fetch.js +86 -0
- package/apps/gateway/dist/src/tools/http-fetch.js.map +1 -0
- package/apps/gateway/dist/src/tools/index.d.ts +71 -0
- package/apps/gateway/dist/src/tools/index.d.ts.map +1 -0
- package/apps/gateway/dist/src/tools/index.js +99 -0
- package/apps/gateway/dist/src/tools/index.js.map +1 -0
- package/apps/gateway/dist/src/tools/mock/gmail_send.mock.d.ts +12 -0
- package/apps/gateway/dist/src/tools/mock/gmail_send.mock.d.ts.map +1 -0
- package/apps/gateway/dist/src/tools/mock/gmail_send.mock.js +10 -0
- package/apps/gateway/dist/src/tools/mock/gmail_send.mock.js.map +1 -0
- package/apps/gateway/dist/src/tools/mock/http_fetch.mock.d.ts +13 -0
- package/apps/gateway/dist/src/tools/mock/http_fetch.mock.d.ts.map +1 -0
- package/apps/gateway/dist/src/tools/mock/http_fetch.mock.js +10 -0
- package/apps/gateway/dist/src/tools/mock/http_fetch.mock.js.map +1 -0
- package/apps/gateway/dist/src/tools/mock/openai.mock.d.ts +9 -0
- package/apps/gateway/dist/src/tools/mock/openai.mock.d.ts.map +1 -0
- package/apps/gateway/dist/src/tools/mock/openai.mock.js +8 -0
- package/apps/gateway/dist/src/tools/mock/openai.mock.js.map +1 -0
- package/apps/gateway/dist/src/tools/mock/serpapi.mock.d.ts +15 -0
- package/apps/gateway/dist/src/tools/mock/serpapi.mock.d.ts.map +1 -0
- package/apps/gateway/dist/src/tools/mock/serpapi.mock.js +12 -0
- package/apps/gateway/dist/src/tools/mock/serpapi.mock.js.map +1 -0
- package/apps/gateway/dist/src/tools/openai.d.ts +27 -0
- package/apps/gateway/dist/src/tools/openai.d.ts.map +1 -0
- package/apps/gateway/dist/src/tools/openai.js +100 -0
- package/apps/gateway/dist/src/tools/openai.js.map +1 -0
- package/apps/gateway/dist/src/tools/serpapi.d.ts +16 -0
- package/apps/gateway/dist/src/tools/serpapi.d.ts.map +1 -0
- package/apps/gateway/dist/src/tools/serpapi.js +56 -0
- package/apps/gateway/dist/src/tools/serpapi.js.map +1 -0
- package/apps/gateway/dist/src/types/policy.d.ts +221 -0
- package/apps/gateway/dist/src/types/policy.d.ts.map +1 -0
- package/apps/gateway/dist/src/types/policy.js +60 -0
- package/apps/gateway/dist/src/types/policy.js.map +1 -0
- package/apps/gateway/dist/src/utils/token-utils.d.ts +5 -0
- package/apps/gateway/dist/src/utils/token-utils.d.ts.map +1 -0
- package/apps/gateway/dist/src/utils/token-utils.js +28 -0
- package/apps/gateway/dist/src/utils/token-utils.js.map +1 -0
- package/apps/gateway/find-gateway.sh +37 -0
- package/apps/gateway/jest.config.cjs +50 -0
- package/apps/gateway/load-tests/README.md +107 -0
- package/apps/gateway/load-tests/k6-basic.js +128 -0
- package/apps/gateway/load-tests/k6-rate-limit.js +57 -0
- package/apps/gateway/minimal-test.sh +60 -0
- package/apps/gateway/package.json +66 -0
- package/apps/gateway/public/sentinel-dashboard.html +428 -0
- package/apps/gateway/quick-debug.sh +70 -0
- package/apps/gateway/scripts/seed-api-key.ts +63 -0
- package/apps/gateway/scripts/setup-test-env.sh +67 -0
- package/apps/gateway/simple-test.sh +72 -0
- package/apps/gateway/src/__tests__/auth.test.ts +272 -0
- package/apps/gateway/src/__tests__/devkit-api.test.ts +268 -0
- package/apps/gateway/src/__tests__/integration/README.md +86 -0
- package/apps/gateway/src/__tests__/integration/authentication.test.ts +155 -0
- package/apps/gateway/src/__tests__/integration/e2e-comprehensive-fixed.test.ts +368 -0
- package/apps/gateway/src/__tests__/integration/e2e-workflow.test.ts +239 -0
- package/apps/gateway/src/__tests__/integration/helpers/test-server.ts +142 -0
- package/apps/gateway/src/__tests__/integration/idempotency.test.ts +213 -0
- package/apps/gateway/src/__tests__/integration/postgres-persistence.test.ts +173 -0
- package/apps/gateway/src/__tests__/integration/rate-limiting.test.ts +148 -0
- package/apps/gateway/src/__tests__/integration/sentinel.test.ts +152 -0
- package/apps/gateway/src/__tests__/no-persistence-mode.test.ts +180 -0
- package/apps/gateway/src/__tests__/rateLimit.test.ts +107 -0
- package/apps/gateway/src/__tests__/validation.test.ts +290 -0
- package/apps/gateway/src/adapters/redis-sentinel-publisher.ts +47 -0
- package/apps/gateway/src/adapters/sentinel-event-stream.ts +106 -0
- package/apps/gateway/src/agents/definitions-simple.ts +531 -0
- package/apps/gateway/src/agents/definitions.ts +297 -0
- package/apps/gateway/src/agents/local-model-provider.ts +219 -0
- package/apps/gateway/src/agents/tools.ts +163 -0
- package/apps/gateway/src/ai-providers/anthropic-provider.ts +194 -0
- package/apps/gateway/src/ai-providers/index.ts +10 -0
- package/apps/gateway/src/ai-providers/openai-provider.ts +193 -0
- package/apps/gateway/src/ai-providers/provider-manager.ts +160 -0
- package/apps/gateway/src/ai-providers/redis-credentials-store.ts +220 -0
- package/apps/gateway/src/ai-providers/types.ts +75 -0
- package/apps/gateway/src/config/persistence.ts +38 -0
- package/apps/gateway/src/crypto/envelope.ts +184 -0
- package/apps/gateway/src/db/prisma.ts +58 -0
- package/apps/gateway/src/db/redis.ts +95 -0
- package/apps/gateway/src/devkit/agents-api.ts +486 -0
- package/apps/gateway/src/devkit/metrics-parser.ts +152 -0
- package/apps/gateway/src/devkit/middleware.ts +53 -0
- package/apps/gateway/src/devkit/routes.ts +344 -0
- package/apps/gateway/src/devkit/tools-api.ts +251 -0
- package/apps/gateway/src/health/index.ts +257 -0
- package/apps/gateway/src/index.ts +1288 -0
- package/apps/gateway/src/metrics/index.ts +218 -0
- package/apps/gateway/src/middleware/auth.ts +118 -0
- package/apps/gateway/src/middleware/authApiKey.ts +156 -0
- package/apps/gateway/src/middleware/authJwt.ts +129 -0
- package/apps/gateway/src/middleware/correlationId.ts +36 -0
- package/apps/gateway/src/middleware/ddos-protection.ts +286 -0
- package/apps/gateway/src/middleware/errorHandler.ts +168 -0
- package/apps/gateway/src/middleware/mfa.ts +137 -0
- package/apps/gateway/src/middleware/rateLimit.ts +104 -0
- package/apps/gateway/src/middleware/rbac.ts +301 -0
- package/apps/gateway/src/middleware/security.ts +116 -0
- package/apps/gateway/src/middleware/validate.ts +194 -0
- package/apps/gateway/src/middleware/validate.ts.backup +153 -0
- package/apps/gateway/src/queue/config.ts +61 -0
- package/apps/gateway/src/queue/index.ts +229 -0
- package/apps/gateway/src/queue/processor.ts +461 -0
- package/apps/gateway/src/routes/ai-providers-simple.ts +166 -0
- package/apps/gateway/src/routes/ai-providers.ts +235 -0
- package/apps/gateway/src/routes/chats.ts +177 -0
- package/apps/gateway/src/routes/gdpr.ts +299 -0
- package/apps/gateway/src/routes/mfa.ts +254 -0
- package/apps/gateway/src/routes/sentinel-policies.ts +204 -0
- package/apps/gateway/src/routes/sentinel-predictive.ts +119 -0
- package/apps/gateway/src/routes/shield.ts +114 -0
- package/apps/gateway/src/routes/tool-credentials.ts +282 -0
- package/apps/gateway/src/routes/tool-proxy.ts +303 -0
- package/apps/gateway/src/runs/index.ts +34 -0
- package/apps/gateway/src/runs/memoryRunStore.ts +105 -0
- package/apps/gateway/src/runs/postgresRunStore.ts +186 -0
- package/apps/gateway/src/runs/runStore.ts +17 -0
- package/apps/gateway/src/runs/types.ts +58 -0
- package/apps/gateway/src/schemas/runs.ts +115 -0
- package/apps/gateway/src/types/fastify-rate-limit.d.ts +12 -0
- package/apps/gateway/src/utils/circuit-breaker.ts +134 -0
- package/apps/gateway/src/utils/log-encryption.ts +212 -0
- package/apps/gateway/test-all-individual.sh +69 -0
- package/apps/gateway/test-all-phases-final.sh +568 -0
- package/apps/gateway/test-all-phases-fixed-v2.sh +523 -0
- package/apps/gateway/test-all-phases-fixed.sh +385 -0
- package/apps/gateway/test-all-phases.sh +663 -0
- package/apps/gateway/test-concurrency.sh +60 -0
- package/apps/gateway/test-debug.sh +44 -0
- package/apps/gateway/test-e2e.sh +96 -0
- package/apps/gateway/test-extraction.sh +48 -0
- package/apps/gateway/test-full-operations-final.sh +328 -0
- package/apps/gateway/test-full-operations.sh +326 -0
- package/apps/gateway/test-idempotency-only.sh +108 -0
- package/apps/gateway/test-idempotency.sh +97 -0
- package/apps/gateway/test-individual.sh +126 -0
- package/apps/gateway/test-queue.sh +94 -0
- package/apps/gateway/tsconfig.json +32 -0
- package/apps/gateway/update-and-test.sh +36 -0
- package/dist/tui-handlers.js +8 -7
- package/dist/tui-handlers.js.map +1 -1
- package/mk3-tui/binaries/win32-x64/mk3-tui.exe +0 -0
- package/mk3-tui/src/main.rs +9 -19
- package/mk3-tui/src/ui/layout.rs +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"parser": "@typescript-eslint/parser",
|
|
4
|
+
"parserOptions": {
|
|
5
|
+
"ecmaVersion": 2022,
|
|
6
|
+
"sourceType": "module"
|
|
7
|
+
},
|
|
8
|
+
"plugins": ["@typescript-eslint"],
|
|
9
|
+
"extends": [
|
|
10
|
+
"eslint:recommended",
|
|
11
|
+
"plugin:@typescript-eslint/recommended"
|
|
12
|
+
],
|
|
13
|
+
"rules": {
|
|
14
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
15
|
+
"@typescript-eslint/no-unused-vars": "warn",
|
|
16
|
+
"@typescript-eslint/no-non-null-assertion": "off"
|
|
17
|
+
},
|
|
18
|
+
"env": {
|
|
19
|
+
"node": true,
|
|
20
|
+
"es2022": true
|
|
21
|
+
},
|
|
22
|
+
"ignorePatterns": [
|
|
23
|
+
"**/__tests__/**",
|
|
24
|
+
"**/*.test.ts",
|
|
25
|
+
"dist/**"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
# Deployment Guide
|
|
2
|
+
|
|
3
|
+
Complete guide for deploying the 4Runr Gateway to production.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [Prerequisites](#prerequisites)
|
|
8
|
+
2. [Pre-Deployment Checklist](#pre-deployment-checklist)
|
|
9
|
+
3. [Environment Setup](#environment-setup)
|
|
10
|
+
4. [Database Setup](#database-setup)
|
|
11
|
+
5. [Deployment Methods](#deployment-methods)
|
|
12
|
+
6. [Post-Deployment Verification](#post-deployment-verification)
|
|
13
|
+
7. [Rollback Procedures](#rollback-procedures)
|
|
14
|
+
8. [Scaling](#scaling)
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
### Infrastructure Requirements
|
|
19
|
+
|
|
20
|
+
- **PostgreSQL 12+**: For persistent storage
|
|
21
|
+
- **Redis 6+**: For queue, rate limiting, and idempotency
|
|
22
|
+
- **Docker & Docker Compose**: For containerized deployment (recommended)
|
|
23
|
+
- **Node.js 18+**: For direct deployment (alternative)
|
|
24
|
+
|
|
25
|
+
### Security Requirements
|
|
26
|
+
|
|
27
|
+
- Strong database passwords
|
|
28
|
+
- Secure JWT secrets (min 32 characters)
|
|
29
|
+
- Encryption keys for sensitive data
|
|
30
|
+
- SSL/TLS certificates for HTTPS
|
|
31
|
+
- Firewall rules configured
|
|
32
|
+
|
|
33
|
+
### Network Requirements
|
|
34
|
+
|
|
35
|
+
- Port 3000: Gateway API (or configure reverse proxy)
|
|
36
|
+
- Port 5432: PostgreSQL (internal only)
|
|
37
|
+
- Port 6379: Redis (internal only)
|
|
38
|
+
|
|
39
|
+
## Pre-Deployment Checklist
|
|
40
|
+
|
|
41
|
+
- [ ] All environment variables configured
|
|
42
|
+
- [ ] Database migrations tested
|
|
43
|
+
- [ ] Secrets generated and stored securely
|
|
44
|
+
- [ ] Health checks configured
|
|
45
|
+
- [ ] Monitoring and alerting set up
|
|
46
|
+
- [ ] Backup strategy in place
|
|
47
|
+
- [ ] Rollback plan documented
|
|
48
|
+
- [ ] Load testing completed
|
|
49
|
+
- [ ] Security audit performed
|
|
50
|
+
|
|
51
|
+
## Environment Setup
|
|
52
|
+
|
|
53
|
+
### 1. Generate Secure Secrets
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Generate JWT secret
|
|
57
|
+
openssl rand -base64 32
|
|
58
|
+
|
|
59
|
+
# Generate encryption key
|
|
60
|
+
openssl rand -base64 32
|
|
61
|
+
|
|
62
|
+
# Generate API keys (if using memory mode)
|
|
63
|
+
openssl rand -hex 32
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 2. Create Production Environment File
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
cd infra
|
|
70
|
+
cp env.example .env.production
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Edit `.env.production` with production values:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
NODE_ENV=production
|
|
77
|
+
GATEWAY_PERSISTENCE=postgres
|
|
78
|
+
DATABASE_URL=postgresql://user:strong-password@db-host:5432/4runr_gateway
|
|
79
|
+
REDIS_URL=redis://redis-host:6379
|
|
80
|
+
|
|
81
|
+
AUTH_ENABLED=true
|
|
82
|
+
AUTH_MODE=mixed
|
|
83
|
+
JWT_SECRET=<generated-secret>
|
|
84
|
+
JWT_ALG=HS256
|
|
85
|
+
|
|
86
|
+
RATE_LIMIT_ENABLED=true
|
|
87
|
+
RATE_LIMIT_MAX=100
|
|
88
|
+
RATE_LIMIT_WINDOW_MS=60000
|
|
89
|
+
|
|
90
|
+
SENTINEL_STORE_PLAIN=false
|
|
91
|
+
SENTINEL_MODE=live
|
|
92
|
+
SENTINEL_SHIELD_MODE=enforce
|
|
93
|
+
|
|
94
|
+
LOG_LEVEL=warn
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 3. Store Secrets Securely
|
|
98
|
+
|
|
99
|
+
**DO NOT** commit secrets to version control. Use:
|
|
100
|
+
- Environment variable management (AWS Secrets Manager, HashiCorp Vault, etc.)
|
|
101
|
+
- Docker secrets
|
|
102
|
+
- Kubernetes secrets
|
|
103
|
+
- CI/CD secret management
|
|
104
|
+
|
|
105
|
+
## Database Setup
|
|
106
|
+
|
|
107
|
+
### 1. Create Database
|
|
108
|
+
|
|
109
|
+
```sql
|
|
110
|
+
CREATE DATABASE 4runr_gateway;
|
|
111
|
+
CREATE USER 4runr WITH PASSWORD 'strong-password';
|
|
112
|
+
GRANT ALL PRIVILEGES ON DATABASE 4runr_gateway TO 4runr;
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 2. Run Migrations
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
cd apps/gateway
|
|
119
|
+
pnpm db:generate
|
|
120
|
+
pnpm db:migrate
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Or via Docker:
|
|
124
|
+
```bash
|
|
125
|
+
docker-compose -f infra/docker-compose.prod.yml run --rm gateway pnpm db:migrate
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 3. Seed Initial Data (Optional)
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Seed API key
|
|
132
|
+
pnpm seed:api-key
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Deployment Methods
|
|
136
|
+
|
|
137
|
+
### Method 1: Docker Compose (Recommended)
|
|
138
|
+
|
|
139
|
+
**Best for**: Single server deployments, small to medium scale
|
|
140
|
+
|
|
141
|
+
1. **Build and start:**
|
|
142
|
+
```bash
|
|
143
|
+
cd infra
|
|
144
|
+
docker-compose -f docker-compose.prod.yml up -d --build
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
2. **Verify services:**
|
|
148
|
+
```bash
|
|
149
|
+
docker-compose -f docker-compose.prod.yml ps
|
|
150
|
+
docker-compose -f docker-compose.prod.yml logs -f gateway
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
3. **Check health:**
|
|
154
|
+
```bash
|
|
155
|
+
curl http://localhost:3000/health
|
|
156
|
+
curl http://localhost:3000/ready
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Method 2: Kubernetes
|
|
160
|
+
|
|
161
|
+
**Best for**: Large scale, high availability
|
|
162
|
+
|
|
163
|
+
1. **Create namespace:**
|
|
164
|
+
```bash
|
|
165
|
+
kubectl create namespace 4runr-gateway
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
2. **Create secrets:**
|
|
169
|
+
```bash
|
|
170
|
+
kubectl create secret generic gateway-secrets \
|
|
171
|
+
--from-literal=jwt-secret='your-secret' \
|
|
172
|
+
--from-literal=database-url='postgresql://...' \
|
|
173
|
+
--namespace=4runr-gateway
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
3. **Deploy:**
|
|
177
|
+
```bash
|
|
178
|
+
kubectl apply -f k8s/gateway-deployment.yaml
|
|
179
|
+
kubectl apply -f k8s/gateway-service.yaml
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Method 3: Direct Node.js
|
|
183
|
+
|
|
184
|
+
**Best for**: Development, custom deployments
|
|
185
|
+
|
|
186
|
+
1. **Build:**
|
|
187
|
+
```bash
|
|
188
|
+
cd apps/gateway
|
|
189
|
+
pnpm install
|
|
190
|
+
pnpm build
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
2. **Start:**
|
|
194
|
+
```bash
|
|
195
|
+
NODE_ENV=production node dist/index.js
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Or use PM2:
|
|
199
|
+
```bash
|
|
200
|
+
pm2 start dist/index.js --name gateway
|
|
201
|
+
pm2 save
|
|
202
|
+
pm2 startup
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Post-Deployment Verification
|
|
206
|
+
|
|
207
|
+
### 1. Health Checks
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Liveness
|
|
211
|
+
curl http://your-server/health
|
|
212
|
+
# Expected: {"status":"ok"}
|
|
213
|
+
|
|
214
|
+
# Readiness
|
|
215
|
+
curl http://your-server/ready
|
|
216
|
+
# Expected: {"ready":true,"checks":{...}}
|
|
217
|
+
|
|
218
|
+
# Startup
|
|
219
|
+
curl http://your-server/startup
|
|
220
|
+
# Expected: {"started":true}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### 2. API Functionality
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
# Create a run
|
|
227
|
+
curl -X POST http://your-server/api/runs \
|
|
228
|
+
-H "x-api-key: your-key" \
|
|
229
|
+
-H "Content-Type: application/json" \
|
|
230
|
+
-d '{"name": "Test Run", "input": {}}'
|
|
231
|
+
|
|
232
|
+
# List runs
|
|
233
|
+
curl http://your-server/api/runs \
|
|
234
|
+
-H "x-api-key: your-key"
|
|
235
|
+
|
|
236
|
+
# Check metrics
|
|
237
|
+
curl http://your-server/metrics
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### 3. Monitor Logs
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Docker
|
|
244
|
+
docker-compose -f infra/docker-compose.prod.yml logs -f gateway
|
|
245
|
+
|
|
246
|
+
# Kubernetes
|
|
247
|
+
kubectl logs -f deployment/gateway -n 4runr-gateway
|
|
248
|
+
|
|
249
|
+
# PM2
|
|
250
|
+
pm2 logs gateway
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### 4. Check Metrics
|
|
254
|
+
|
|
255
|
+
Access Prometheus metrics at `/metrics` and verify:
|
|
256
|
+
- HTTP request counts
|
|
257
|
+
- Run creation/start/completion rates
|
|
258
|
+
- Error rates
|
|
259
|
+
- Queue job metrics
|
|
260
|
+
- Rate limit hits
|
|
261
|
+
|
|
262
|
+
## Rollback Procedures
|
|
263
|
+
|
|
264
|
+
### Quick Rollback (Docker Compose)
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
cd infra
|
|
268
|
+
|
|
269
|
+
# Stop current version
|
|
270
|
+
docker-compose -f docker-compose.prod.yml down
|
|
271
|
+
|
|
272
|
+
# Switch to previous version
|
|
273
|
+
git checkout <previous-version-tag>
|
|
274
|
+
|
|
275
|
+
# Rebuild and start
|
|
276
|
+
docker-compose -f docker-compose.prod.yml up -d --build
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Database Rollback
|
|
280
|
+
|
|
281
|
+
If migrations need to be rolled back:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
cd apps/gateway
|
|
285
|
+
pnpm prisma migrate resolve --rolled-back <migration-name>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Warning**: Only rollback migrations if you're certain no data depends on them.
|
|
289
|
+
|
|
290
|
+
### Configuration Rollback
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Restore previous environment file
|
|
294
|
+
cp .env.production.backup .env.production
|
|
295
|
+
|
|
296
|
+
# Restart services
|
|
297
|
+
docker-compose -f docker-compose.prod.yml restart gateway
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Scaling
|
|
301
|
+
|
|
302
|
+
### Horizontal Scaling
|
|
303
|
+
|
|
304
|
+
The gateway is stateless and can be scaled horizontally:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# Docker Compose (multiple instances)
|
|
308
|
+
docker-compose -f docker-compose.prod.yml up -d --scale gateway=3
|
|
309
|
+
|
|
310
|
+
# Kubernetes
|
|
311
|
+
kubectl scale deployment gateway --replicas=3 -n 4runr-gateway
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Load Balancing
|
|
315
|
+
|
|
316
|
+
Use a load balancer (nginx, HAProxy, AWS ALB) in front of multiple gateway instances:
|
|
317
|
+
|
|
318
|
+
```nginx
|
|
319
|
+
upstream gateway {
|
|
320
|
+
least_conn;
|
|
321
|
+
server gateway1:3000;
|
|
322
|
+
server gateway2:3000;
|
|
323
|
+
server gateway3:3000;
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Database Scaling
|
|
328
|
+
|
|
329
|
+
- Use connection pooling (Prisma handles this)
|
|
330
|
+
- Consider read replicas for read-heavy workloads
|
|
331
|
+
- Monitor connection counts
|
|
332
|
+
|
|
333
|
+
### Redis Scaling
|
|
334
|
+
|
|
335
|
+
- Use Redis Cluster for high availability
|
|
336
|
+
- Configure Redis Sentinel for failover
|
|
337
|
+
- Monitor memory usage
|
|
338
|
+
|
|
339
|
+
## Monitoring & Alerting
|
|
340
|
+
|
|
341
|
+
### Key Metrics to Monitor
|
|
342
|
+
|
|
343
|
+
- **HTTP Request Rate**: Requests per second
|
|
344
|
+
- **Error Rate**: 4xx and 5xx errors
|
|
345
|
+
- **Response Time**: p50, p95, p99 latencies
|
|
346
|
+
- **Queue Depth**: Number of jobs waiting
|
|
347
|
+
- **Database Connections**: Active connections
|
|
348
|
+
- **Memory Usage**: Container/node memory
|
|
349
|
+
- **CPU Usage**: Container/node CPU
|
|
350
|
+
|
|
351
|
+
### Recommended Alerts
|
|
352
|
+
|
|
353
|
+
- Error rate > 1%
|
|
354
|
+
- Response time p95 > 1s
|
|
355
|
+
- Queue depth > 1000
|
|
356
|
+
- Database connections > 80% of max
|
|
357
|
+
- Memory usage > 80%
|
|
358
|
+
- Health check failures
|
|
359
|
+
|
|
360
|
+
## Backup & Recovery
|
|
361
|
+
|
|
362
|
+
### Database Backups
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
# Daily backup script
|
|
366
|
+
pg_dump -h db-host -U 4runr 4runr_gateway > backup-$(date +%Y%m%d).sql
|
|
367
|
+
|
|
368
|
+
# Restore
|
|
369
|
+
psql -h db-host -U 4runr 4runr_gateway < backup-20231119.sql
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Configuration Backups
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
# Backup environment file
|
|
376
|
+
cp .env.production .env.production.backup
|
|
377
|
+
|
|
378
|
+
# Backup docker-compose
|
|
379
|
+
cp docker-compose.prod.yml docker-compose.prod.yml.backup
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Security Hardening
|
|
383
|
+
|
|
384
|
+
### Production Security Checklist
|
|
385
|
+
|
|
386
|
+
- [ ] HTTPS enabled (TLS 1.2+)
|
|
387
|
+
- [ ] Security headers configured
|
|
388
|
+
- [ ] Secrets stored securely (not in code)
|
|
389
|
+
- [ ] Database access restricted (firewall)
|
|
390
|
+
- [ ] Redis access restricted (firewall)
|
|
391
|
+
- [ ] Rate limiting enabled
|
|
392
|
+
- [ ] Authentication required
|
|
393
|
+
- [ ] Error messages masked in production
|
|
394
|
+
- [ ] Logging configured (no sensitive data)
|
|
395
|
+
- [ ] Regular security updates
|
|
396
|
+
|
|
397
|
+
### SSL/TLS Setup
|
|
398
|
+
|
|
399
|
+
Use a reverse proxy (nginx, Traefik) for SSL termination:
|
|
400
|
+
|
|
401
|
+
```nginx
|
|
402
|
+
server {
|
|
403
|
+
listen 443 ssl;
|
|
404
|
+
server_name api.yourdomain.com;
|
|
405
|
+
|
|
406
|
+
ssl_certificate /path/to/cert.pem;
|
|
407
|
+
ssl_certificate_key /path/to/key.pem;
|
|
408
|
+
|
|
409
|
+
location / {
|
|
410
|
+
proxy_pass http://gateway:3000;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## Troubleshooting
|
|
416
|
+
|
|
417
|
+
See [TROUBLESHOOTING.md](./TROUBLESHOOTING.md) for common deployment issues.
|
|
418
|
+
|
|
419
|
+
## Support
|
|
420
|
+
|
|
421
|
+
For deployment issues:
|
|
422
|
+
- Check logs: `docker-compose logs gateway`
|
|
423
|
+
- Verify health: `curl http://localhost/health`
|
|
424
|
+
- Review metrics: `curl http://localhost/metrics`
|
|
425
|
+
- See troubleshooting guide
|
|
426
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
FROM node:20-slim AS base
|
|
2
|
+
WORKDIR /workspace
|
|
3
|
+
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/*
|
|
4
|
+
|
|
5
|
+
FROM base AS deps
|
|
6
|
+
RUN apt-get update && apt-get install -y python3 make g++ openssl libssl-dev && rm -rf /var/lib/apt/lists/*
|
|
7
|
+
COPY pnpm-workspace.yaml package.json tsconfig.json ./
|
|
8
|
+
# Copy .npmrc if it exists (optional - create empty if missing)
|
|
9
|
+
COPY apps/gateway ./apps/gateway
|
|
10
|
+
# Copy packages directory but we'll remove client-side ones immediately
|
|
11
|
+
COPY packages ./packages
|
|
12
|
+
# Remove client-side packages BEFORE pnpm reads the workspace (os-cli depends on unpublished @4runr/devkit)
|
|
13
|
+
RUN rm -rf packages/os-cli packages/cli packages/cli-tool packages/cli-tool-standalone packages/devkit || true
|
|
14
|
+
COPY prisma ./prisma
|
|
15
|
+
COPY src ./src
|
|
16
|
+
# Create .npmrc if it doesn't exist (pnpm will work without it)
|
|
17
|
+
RUN touch .npmrc || true
|
|
18
|
+
RUN corepack enable && corepack prepare pnpm@9.12.1 --activate
|
|
19
|
+
# Set node-linker to hoisted for flat node_modules structure
|
|
20
|
+
RUN pnpm config set node-linker hoisted
|
|
21
|
+
# Skip Prisma generation during install (we'll generate it in build if needed)
|
|
22
|
+
ENV PRISMA_SKIP_POSTINSTALL_GENERATE=1
|
|
23
|
+
RUN pnpm install --filter @4runr/shared --filter @4runr/sentinel --filter @4runr/gateway --workspace-root
|
|
24
|
+
|
|
25
|
+
FROM deps AS build
|
|
26
|
+
# Clean shared and sentinel package dists to ensure fresh build with updated types
|
|
27
|
+
RUN rm -rf packages/shared/dist packages/shared/.tsbuildinfo packages/sentinel/dist packages/sentinel/.tsbuildinfo
|
|
28
|
+
RUN pnpm --filter @4runr/shared run build
|
|
29
|
+
RUN pnpm --filter @4runr/sentinel run build
|
|
30
|
+
# Generate Prisma client before building gateway
|
|
31
|
+
# Use dummy DATABASE_URL for generation (just needs schema, not actual connection)
|
|
32
|
+
# Prisma schema is at /workspace/prisma/schema.prisma
|
|
33
|
+
RUN cd /workspace/apps/gateway && \
|
|
34
|
+
export DATABASE_URL="postgresql://dummy:dummy@localhost:5432/dummy" && \
|
|
35
|
+
pnpm db:generate && \
|
|
36
|
+
(test -d node_modules/.prisma/client || test -d ../../node_modules/.prisma/client) && \
|
|
37
|
+
echo "✓ Prisma client generated" || echo "✗ Prisma client generation failed"
|
|
38
|
+
# Compile root src/crypto folder (used by gateway routes)
|
|
39
|
+
# Create a temporary tsconfig for compiling just the crypto folder
|
|
40
|
+
RUN mkdir -p dist/src/crypto && \
|
|
41
|
+
echo '{"compilerOptions":{"target":"ES2022","module":"ES2022","moduleResolution":"bundler","esModuleInterop":true,"skipLibCheck":true,"outDir":"dist/src/crypto","rootDir":"src/crypto"},"include":["src/crypto/envelope.ts"]}' > /tmp/crypto-tsconfig.json && \
|
|
42
|
+
npx tsc --project /tmp/crypto-tsconfig.json 2>&1 | head -10 && \
|
|
43
|
+
test -f dist/src/crypto/envelope.js && echo "✓ Compiled envelope.js" || echo "⚠ envelope.js compilation may have failed"
|
|
44
|
+
|
|
45
|
+
RUN rm -rf apps/gateway/dist && \
|
|
46
|
+
pnpm --filter @4runr/gateway run build && \
|
|
47
|
+
(test -f apps/gateway/dist/index.js || test -f apps/gateway/dist/apps/gateway/src/index.js) && \
|
|
48
|
+
echo "✓ Gateway build completed successfully" || \
|
|
49
|
+
(echo "✗ Build failed: index.js not found" && exit 1)
|
|
50
|
+
|
|
51
|
+
FROM base AS runner
|
|
52
|
+
WORKDIR /workspace
|
|
53
|
+
RUN apt-get update && apt-get install -y openssl ca-certificates curl && rm -rf /var/lib/apt/lists/*
|
|
54
|
+
# Copy package files, config, and built artifacts
|
|
55
|
+
COPY --from=build /workspace/package.json ./package.json
|
|
56
|
+
COPY --from=build /workspace/pnpm-workspace.yaml ./pnpm-workspace.yaml
|
|
57
|
+
# .npmrc is optional - create empty if it doesn't exist
|
|
58
|
+
RUN touch .npmrc || true
|
|
59
|
+
COPY --from=build /workspace/packages ./packages
|
|
60
|
+
COPY --from=build /workspace/apps/gateway/package.json ./apps/gateway/package.json
|
|
61
|
+
COPY --from=build /workspace/apps/gateway/dist ./apps/gateway/dist
|
|
62
|
+
# Copy public directory (static files like dashboard)
|
|
63
|
+
COPY --from=deps /workspace/apps/gateway/public ./apps/gateway/public
|
|
64
|
+
# Copy node_modules from build stage (hoisted node-linker creates flat structure)
|
|
65
|
+
# Use --chown to set ownership during copy to avoid breaking symlinks
|
|
66
|
+
COPY --from=build --chown=node:node /workspace/node_modules ./node_modules
|
|
67
|
+
# Copy Prisma schema (needed for runtime client generation if needed)
|
|
68
|
+
COPY --from=build /workspace/prisma ./prisma
|
|
69
|
+
# Copy src directory (contains crypto and memory-db for AI providers)
|
|
70
|
+
COPY --from=build /workspace/src ./src
|
|
71
|
+
# Copy compiled crypto (if it was compiled)
|
|
72
|
+
RUN mkdir -p dist/src && (cp -r /workspace/dist/src/* dist/src/ 2>/dev/null || echo "Note: No compiled src found")
|
|
73
|
+
# Verify Prisma client was copied (could be in root node_modules with hoisted linker)
|
|
74
|
+
RUN (test -d node_modules/.prisma/client || test -d apps/gateway/node_modules/.prisma/client) && \
|
|
75
|
+
echo "✓ Prisma client found" || \
|
|
76
|
+
echo "⚠ Prisma client not found - checking..." && \
|
|
77
|
+
find node_modules -name ".prisma" -type d 2>/dev/null | head -5 || \
|
|
78
|
+
echo "⚠ Will generate Prisma client at runtime if needed"
|
|
79
|
+
# Verify shared package is accessible
|
|
80
|
+
RUN test -d packages/shared/dist && echo "✓ shared/dist exists" || echo "✗ shared/dist missing"
|
|
81
|
+
RUN test -f packages/shared/dist/index.js && echo "✓ shared/dist/index.js exists" || echo "✗ shared/dist/index.js missing"
|
|
82
|
+
# Check if @4runr/shared exists and if it's a symlink
|
|
83
|
+
# If not, create it (symlinks don't need special ownership)
|
|
84
|
+
RUN if [ ! -L node_modules/@4runr/shared ] && [ ! -d node_modules/@4runr/shared ]; then \
|
|
85
|
+
echo "✗ @4runr/shared NOT found in node_modules, creating symlink..."; \
|
|
86
|
+
mkdir -p node_modules/@4runr && \
|
|
87
|
+
ln -s ../../packages/shared node_modules/@4runr/shared && \
|
|
88
|
+
echo "✓ Created symlink: node_modules/@4runr/shared -> ../../packages/shared"; \
|
|
89
|
+
fi
|
|
90
|
+
# Verify the shared package's package.json exists (for ESM resolution)
|
|
91
|
+
RUN test -f node_modules/@4runr/shared/package.json && echo "✓ @4runr/shared/package.json exists" || echo "✗ @4runr/shared/package.json missing"
|
|
92
|
+
# Verify the package.json has the correct exports field for ESM resolution
|
|
93
|
+
RUN node -e "try { const pkg = require('./node_modules/@4runr/shared/package.json'); if (pkg.exports && pkg.exports['.']) { console.log('✓ package.json exports field configured correctly'); } else { console.error('✗ package.json missing exports field'); process.exit(1); } } catch(e) { console.error('✗ Error reading shared package.json:', e.message); process.exit(1); }"
|
|
94
|
+
# Verify Sentinel package is accessible
|
|
95
|
+
RUN test -d packages/sentinel/dist && echo "✓ sentinel/dist exists" || echo "✗ sentinel/dist missing"
|
|
96
|
+
RUN test -f packages/sentinel/dist/index.js && echo "✓ sentinel/dist/index.js exists" || echo "✗ sentinel/dist/index.js missing"
|
|
97
|
+
# Check if @4runr/sentinel exists and if it's a symlink
|
|
98
|
+
# If not, create it (symlinks don't need special ownership)
|
|
99
|
+
RUN if [ ! -L node_modules/@4runr/sentinel ] && [ ! -d node_modules/@4runr/sentinel ]; then \
|
|
100
|
+
echo "✗ @4runr/sentinel NOT found in node_modules, creating symlink..."; \
|
|
101
|
+
mkdir -p node_modules/@4runr && \
|
|
102
|
+
ln -s ../../packages/sentinel node_modules/@4runr/sentinel && \
|
|
103
|
+
echo "✓ Created symlink: node_modules/@4runr/sentinel -> ../../packages/sentinel"; \
|
|
104
|
+
fi
|
|
105
|
+
# Verify the Sentinel package's package.json exists (for ESM resolution)
|
|
106
|
+
RUN test -f node_modules/@4runr/sentinel/package.json && echo "✓ @4runr/sentinel/package.json exists" || echo "✗ @4runr/sentinel/package.json missing"
|
|
107
|
+
# Verify the package.json has the correct exports field for ESM resolution
|
|
108
|
+
RUN node -e "try { const pkg = require('./node_modules/@4runr/sentinel/package.json'); if (pkg.exports && pkg.exports['.']) { console.log('✓ Sentinel package.json exports field configured correctly'); } else { console.error('✗ Sentinel package.json missing exports field'); process.exit(1); } } catch(e) { console.error('✗ Error reading Sentinel package.json:', e.message); process.exit(1); }"
|
|
109
|
+
# Verify fastify exists (should be directly in node_modules with hoisted node-linker)
|
|
110
|
+
RUN test -d node_modules/fastify && echo "✓ fastify found in node_modules" || \
|
|
111
|
+
(echo "✗ fastify NOT found!" && ls -la node_modules/ | head -40)
|
|
112
|
+
RUN test -f node_modules/fastify/package.json && echo "✓ fastify package.json exists" || echo "✗ fastify package.json missing"
|
|
113
|
+
# Test Node.js ESM resolution from the gateway dist directory
|
|
114
|
+
RUN cd apps/gateway/dist && \
|
|
115
|
+
node --input-type=module -e "import('fastify').then(() => console.log('✓ Node.js can resolve fastify from dist')).catch(e => console.error('✗ Cannot resolve:', e.message))" || \
|
|
116
|
+
echo "Testing from workspace root:" && \
|
|
117
|
+
cd /workspace && \
|
|
118
|
+
node --input-type=module -e "import('fastify').then(() => console.log('✓ Node.js can resolve fastify from root')).catch(e => console.error('✗ Cannot resolve from root:', e.message))"
|
|
119
|
+
USER node
|
|
120
|
+
WORKDIR /workspace
|
|
121
|
+
# Run from workspace root - Node.js ESM should find node_modules at /workspace/node_modules
|
|
122
|
+
CMD ["node", "apps/gateway/dist/apps/gateway/src/index.js"]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
FROM node:18-alpine AS base
|
|
2
|
+
|
|
3
|
+
# Install dependencies only when needed
|
|
4
|
+
FROM base AS deps
|
|
5
|
+
RUN apk add --no-cache libc6-compat
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
# Install dependencies based on the preferred package manager
|
|
9
|
+
COPY package.json ./
|
|
10
|
+
RUN npm install
|
|
11
|
+
|
|
12
|
+
# Rebuild the source code only when needed
|
|
13
|
+
FROM base AS builder
|
|
14
|
+
WORKDIR /app
|
|
15
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
16
|
+
COPY . .
|
|
17
|
+
|
|
18
|
+
# Build the application
|
|
19
|
+
RUN npm run build
|
|
20
|
+
|
|
21
|
+
# Production image, copy all the files and run the app
|
|
22
|
+
FROM base AS runner
|
|
23
|
+
WORKDIR /app
|
|
24
|
+
|
|
25
|
+
ENV NODE_ENV=production
|
|
26
|
+
|
|
27
|
+
RUN addgroup --system --gid 1001 nodejs
|
|
28
|
+
RUN adduser --system --uid 1001 4runr
|
|
29
|
+
|
|
30
|
+
COPY --from=builder /app/dist ./dist
|
|
31
|
+
COPY --from=builder /app/node_modules ./node_modules
|
|
32
|
+
COPY --from=builder /app/package.json ./package.json
|
|
33
|
+
|
|
34
|
+
USER 4runr
|
|
35
|
+
|
|
36
|
+
EXPOSE 3000
|
|
37
|
+
|
|
38
|
+
ENV PORT=3000
|
|
39
|
+
ENV HOST=0.0.0.0
|
|
40
|
+
|
|
41
|
+
CMD ["node", "dist/index.js"]
|