- Complete Fastify gateway with 8-stage pipeline - Circuit breaker (opossum) per model tier - Rate limiting per caller - Ban list validation (EN/DE/auto-detected) - TIP validator (SFF-8024, part numbers, wavelengths) - Prometheus metrics - pg-boss async queue - PostgreSQL audit log + review queue - 9 prompt templates (TIP, LinkedIn, ShieldX) - Learning engine scaffolding - Auto-learning: ban-list, few-shot, routing, prompt optimizer
60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
/**
|
|
* PM2 Ecosystem Config — LLM Gateway on Erik (217.154.82.179)
|
|
*
|
|
* Deploy: pm2 start deploy/ecosystem.config.cjs
|
|
* Reload: pm2 reload llm-gateway llm-learning
|
|
* Logs: pm2 logs llm-gateway
|
|
* Status: pm2 status
|
|
*/
|
|
module.exports = {
|
|
apps: [
|
|
{
|
|
name: 'llm-gateway',
|
|
script: 'packages/gateway/dist/server.js',
|
|
cwd: '/opt/llm-gateway',
|
|
instances: 1,
|
|
exec_mode: 'fork',
|
|
env: {
|
|
NODE_ENV: 'production',
|
|
PORT: 3100,
|
|
DATABASE_URL: 'postgresql://llm:llm_secure_password@localhost:5432/llm_gateway',
|
|
TIP_DATABASE_URL: 'postgresql://tip:tip_prod_2026@localhost:5433/transceiver_db',
|
|
OLLAMA_URL: 'http://192.168.178.169:11434',
|
|
LOG_LEVEL: 'info',
|
|
},
|
|
// Restart on crash, but not on intentional stop
|
|
autorestart: true,
|
|
watch: false,
|
|
max_memory_restart: '512M',
|
|
// Graceful shutdown: wait up to 10s for in-flight requests
|
|
kill_timeout: 10000,
|
|
// Log rotation
|
|
error_file: '/var/log/llm-gateway/error.log',
|
|
out_file: '/var/log/llm-gateway/out.log',
|
|
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
|
|
merge_logs: true,
|
|
},
|
|
{
|
|
name: 'llm-learning',
|
|
script: 'packages/learning/src/index.ts',
|
|
interpreter: 'node',
|
|
interpreter_args: '--import tsx/esm',
|
|
cwd: '/opt/llm-gateway',
|
|
instances: 1,
|
|
exec_mode: 'fork',
|
|
env: {
|
|
NODE_ENV: 'production',
|
|
DATABASE_URL: 'postgresql://llm:llm_secure_password@localhost:5432/llm_gateway',
|
|
GATEWAY_URL: 'http://localhost:3100',
|
|
},
|
|
autorestart: true,
|
|
watch: false,
|
|
max_memory_restart: '256M',
|
|
kill_timeout: 5000,
|
|
error_file: '/var/log/llm-gateway/learning-error.log',
|
|
out_file: '/var/log/llm-gateway/learning-out.log',
|
|
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
|
|
},
|
|
],
|
|
}
|