/** * PM2 进程配置:API + 爬虫(GDELT/RSS uvicorn 服务) * 用法: * pm2 start ecosystem.config.cjs # 启动全部 * pm2 restart ecosystem.config.cjs # 重启全部 * pm2 stop ecosystem.config.cjs # 停止全部 * pm2 logs nsa_api / pm2 logs nsa_crawler * 需 .env 时可在启动前 source .env,或在应用内用 dotenv 加载。 */ module.exports = { apps: [ { name: 'nsa_api', script: 'server/index.js', cwd: __dirname, interpreter: 'node', instances: 1, autorestart: true, watch: false, max_memory_restart: '300M', env: { NODE_ENV: 'production', API_PORT: 3001, }, }, { name: 'nsa_crawler', script: 'crawler/run_uvicorn.sh', cwd: __dirname, interpreter: 'bash', instances: 1, autorestart: true, watch: false, max_memory_restart: '300M', env: { CLEANER_AI_DISABLED: '1', PARSER_AI_DISABLED: '0', GDELT_DISABLED: '1', RSS_INTERVAL_SEC: '60', }, }, ], };