fix:优化pm2配置项

This commit is contained in:
Daniel
2026-03-05 19:53:05 +08:00
parent 004b03b374
commit 98d928f457
10 changed files with 125 additions and 10 deletions

43
ecosystem.config.cjs Normal file
View File

@@ -0,0 +1,43 @@
/**
* 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',
},
},
],
};