-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecosystem.config.js
57 lines (47 loc) · 1.01 KB
/
ecosystem.config.js
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
49
50
51
52
53
54
55
56
57
const NODE_PORT = process.env.NODE_PORT || 3000;
const app = {
name : 'styless',
script : './dist/lib/core',
watch : false,
// max_memory_restart: '500M',
log_date_format: 'YYYY-MM-DD HH:mm Z',
merge_logs: true,
env: {
NODE_ENV: 'development',
NODE_PORT
},
env_staging: {
NODE_ENV: 'staging',
NODE_PORT
},
env_production : {
NODE_ENV: 'production',
NODE_PORT
}
}
const envIndex = process.argv.findIndex(v => v === '--env') + 1
, env = process.argv[envIndex];
if (['production'].indexOf(env) !== -1) {
app.instances = 'max'
app.exec_mode = 'cluster'
} else {
app.name += `-${env}`
app.instances = '2'
app.exec_mode = 'cluster'
}
app.name += `-${NODE_PORT}`
module.exports = {
/**
* Application configuration section
* http://pm2.keymetrics.io/docs/usage/application-declaration/
*/
apps : [
// First application
app
// Second application
// {
// name : 'WEB',
// script : 'web.js'
// }
],
};