Files
chuanqi-qycq-web/ecosystem.config.cjs
艾贤凌 6d4a72161f inint
2026-03-16 12:05:55 +08:00

48 lines
1.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// PM2 进程守护配置
// 使用方式:
// pm2 start ecosystem.config.cjs
// pm2 save
// pm2 startup
module.exports = {
apps: [
{
name: 'chuanqi-server',
script: 'index.js',
cwd: './module/server',
// 使用 Node.js ESMpackage.json type:module
interpreter: 'node',
interpreter_args: '--env-file=.env',
// 实例数量cluster 模式多核利用(生产推荐)
// 单核服务器改为 instances: 1, exec_mode: 'fork'
instances: 1,
exec_mode: 'fork',
// 自动重启
watch: false,
autorestart: true,
max_restarts: 10,
restart_delay: 3000,
// 内存超出 512MB 自动重启
max_memory_restart: '512M',
// 日志配置
out_file: './logs/pm2-out.log',
error_file: './logs/pm2-error.log',
merge_logs: true,
log_date_format: 'YYYY-MM-DD HH:mm:ss',
// 环境变量
env: {
NODE_ENV: 'production',
},
env_development: {
NODE_ENV: 'development',
},
}
]
}