更新PM2配置并添加相关脚本

This commit is contained in:
2025-09-11 16:14:15 +08:00
parent 2430ba5a6c
commit 15b9cd406e
5 changed files with 1306 additions and 130 deletions

View File

@@ -2,12 +2,13 @@ module.exports = {
apps: [{
name: 'jiebanke-backend',
script: './src/server.js',
instances: 'max',
exec_mode: 'cluster',
instances: 1,
exec_mode: 'fork',
// 环境变量
env: {
NODE_ENV: 'development',
PORT: 3200,
WATCH: true
WATCH: false
},
env_production: {
NODE_ENV: 'production',
@@ -20,14 +21,17 @@ module.exports = {
WATCH: false
},
// 日志配置
log_file: '/data/nodejs/jiebanke/logs/combined.log',
out_file: '/data/nodejs/jiebanke/logs/out.log',
error_file: '/data/nodejs/jiebanke/logs/error.log',
log_file: './logs/combined.log',
out_file: './logs/out.log',
error_file: './logs/error.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss',
// 性能配置
max_memory_restart: '1G',
kill_timeout: 3000,
wait_ready: true,
listen_timeout: 3000,
// 重启策略
autorestart: true,
max_restarts: 10,
restart_delay: 4000,
// 监控配置
watch: false,
ignore_watch: [
@@ -35,10 +39,6 @@ module.exports = {
'logs',
'.git',
'uploads'
],
// 重启策略
autorestart: true,
max_restarts: 10,
restart_delay: 4000
]
}]
};