-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpm2.js
41 lines (37 loc) · 822 Bytes
/
pm2.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
const pm2 = require('pm2');
const ENV ='development';
const apps = [
{
script: 'index.js',
name: 'resigndesign',
watch: true,
ignore_watch: [
'app/assets',
'.git',
'node_modules',
'app/public',
'app/views',
'log',
'temp*',
],
env: {
DEBUG_COLORS: true,
NODE_ENV: ENV,
},
post_update: ['npm install'],
},
];
pm2.connect(() => {
pm2.killInteract(() => {});
pm2.start(apps, () => {
pm2.launchBus((err, bus) => {
console.log('[PM2] Log streaming started');
bus.on('log:out', (packet) => {
console.log('[App:%s] %s', packet.process.name, packet.data);
});
bus.on('log:err', (packet) => {
console.error('[App:%s][Err] %s', packet.process.name, packet.data);
});
});
});
});