module.exports = { apps: [{ name: 'stock-agent', script: 'backend/app/main.py', interpreter: 'python3', interpreter_args: '--u', // 自动获取当前目录 cwd: process.cwd(), instances: 1, autorestart: true, watch: false, max_memory_restart: '1G', error_file: './logs/pm2-error.log', out_file: './logs/pm2-out.log', log_file: './logs/pm2-combined.log', time: true, // 进程管理 kill_timeout: 5000, wait_ready: true, // 健康检查 min_uptime: '10s', max_restarts: 10, // 环境变量 env_production: { NODE_ENV: 'production', DEBUG: 'False' }, env_development: { NODE_ENV: 'development', DEBUG: 'True' } }] };