build & pm2 start
This commit is contained in:
23
ecosystem.config.js
Normal file
23
ecosystem.config.js
Normal file
@@ -0,0 +1,23 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: 'shorturl-analytics',
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start',
|
||||
instances: 'max', // 使用所有可用CPU核心
|
||||
exec_mode: 'cluster', // 集群模式允许负载均衡
|
||||
watch: false, // 生产环境不要启用watch
|
||||
env: {
|
||||
PORT: 3007,
|
||||
NODE_ENV: 'production',
|
||||
},
|
||||
max_memory_restart: '1G', // 如果内存使用超过1GB则重启
|
||||
exp_backoff_restart_delay: 100, // 故障自动重启延迟
|
||||
error_file: 'logs/err.log',
|
||||
out_file: 'logs/out.log',
|
||||
log_date_format: 'YYYY-MM-DD HH:mm:ss',
|
||||
merge_logs: true,
|
||||
autorestart: true
|
||||
}
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user