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: 'npx', args: 'tsx scripts/run-queue-worker.ts', 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', // 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, } ] }