cms.c2sgmbh/ecosystem.config.cjs
Martin Porwoll 0615b22188 feat(monitoring): add snapshot collector to queue worker
Periodic metric collection running in the queue-worker PM2 process.
Collects system metrics every 60s (configurable), stores them in
MonitoringSnapshots, and evaluates alert rules against each snapshot.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:34:28 +00:00

60 lines
1.7 KiB
JavaScript

module.exports = {
apps: [
// Main Payload CMS App
{
name: 'payload',
cwd: '/home/payload/payload-cms',
script: 'pnpm',
args: 'start',
env: {
NODE_ENV: 'production',
PORT: 3000
},
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: '1G',
error_file: '/home/payload/logs/error.log',
out_file: '/home/payload/logs/out.log',
time: true,
max_restarts: 10,
min_uptime: '10s',
restart_delay: 5000
},
// Queue Worker (BullMQ - Email + PDF)
{
name: 'queue-worker',
cwd: '/home/payload/payload-cms',
script: 'node_modules/tsx/dist/cli.mjs',
args: 'scripts/run-queue-worker.ts',
exec_mode: 'fork',
env: {
NODE_ENV: 'production',
// Credentials werden via dotenv aus .env geladen (siehe run-queue-worker.ts)
// Queue-spezifische Env Vars
QUEUE_EMAIL_CONCURRENCY: '3',
QUEUE_PDF_CONCURRENCY: '2',
QUEUE_DEFAULT_RETRY: '3',
QUEUE_REDIS_DB: '1',
// Worker aktivieren/deaktivieren
QUEUE_ENABLE_EMAIL: 'true',
QUEUE_ENABLE_PDF: 'true',
QUEUE_ENABLE_MONITORING: 'true',
MONITORING_SNAPSHOT_INTERVAL: '60000',
// PDF-spezifische Optionen
PDF_OUTPUT_DIR: '/tmp/payload-pdfs',
// PDF_GENERATION_DISABLED: 'true', // Für Tests
},
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: '768M', // PDF-Generierung braucht mehr RAM
error_file: '/home/payload/logs/queue-worker-error.log',
out_file: '/home/payload/logs/queue-worker-out.log',
time: true,
max_restarts: 10,
min_uptime: '5s',
restart_delay: 3000,
}
]
}