-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathecosystem.config.js
More file actions
48 lines (42 loc) · 954 Bytes
/
ecosystem.config.js
File metadata and controls
48 lines (42 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* PM2 配置文件
* 生产环境集群模式运行
*/
module.exports = {
apps: [
{
name: 'prexis',
script: './dist/server.js',
instances: 'max', // 使用所有 CPU 核心
exec_mode: 'cluster',
autorestart: true,
watch: false,
max_memory_restart: '1G',
// 环境变量
env: {
NODE_ENV: 'dev',
PORT: 3000,
},
env_production: {
NODE_ENV: 'prod',
PORT: 3000,
},
// 日志配置
log_date_format: 'YYYY-MM-DD HH:mm:ss',
error_file: './logs/pm2-error.log',
out_file: './logs/pm2-out.log',
merge_logs: true,
// 性能优化
node_args: [
'--max-old-space-size=2048',
'--optimize-for-size',
],
// 优雅重启
kill_timeout: 5000,
wait_ready: true,
listen_timeout: 10000,
// 指数退避重启
exp_backoff_restart_delay: 100,
},
],
}