生产环境修正

This commit is contained in:
2025-10-05 13:34:28 +08:00
parent 47576fdb30
commit b0b748f6d1
47 changed files with 1152 additions and 217 deletions

View File

@@ -1,38 +1,40 @@
module.exports = {
apps: [{
name: 'ggl-app',
script: 'start-production.cjs',
cwd: '/www/wwwroot/ggl',
instances: 1,
exec_mode: 'fork',
env: {
NODE_ENV: 'production',
PORT: 4001,
FRONTEND_PORT: 4002
},
env_production: {
NODE_ENV: 'production',
PORT: 4001,
FRONTEND_PORT: 4002
},
// 日志配置
log_file: './logs/combined.log',
out_file: './logs/out.log',
error_file: './logs/error.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
// 进程管理配置
autorestart: true,
watch: false,
max_memory_restart: '1G',
// 启动配置
min_uptime: '10s',
max_restarts: 10,
restart_delay: 4000,
// 其他配置
merge_logs: true,
time: true
}]
apps: [
{
name: 'ggl-xi-plus-production',
script: 'start-production.cjs',
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: '1G',
min_uptime: '10s',
max_restarts: 10,
restart_delay: 4000,
env: {
NODE_ENV: 'production',
PORT: 4001,
FRONTEND_PORT: 4002,
DOMAIN: 'ggl.xi.plus'
},
log_file: './logs/pm2-combined.log',
out_file: './logs/pm2-out.log',
error_file: './logs/pm2-error.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
merge_logs: true,
kill_timeout: 5000,
listen_timeout: 8000,
shutdown_with_message: true
}
],
deploy: {
production: {
user: 'www',
host: 'localhost',
ref: 'origin/main',
repo: 'git@github.com:username/ggl.git',
path: '/www/wwwroot/ggl',
'post-deploy': 'npm install && npm run build && pm2 reload ecosystem.config.js --env production'
}
}
};