forked from cliftonc/express-mvc-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp-cluster.js
46 lines (38 loc) · 1.07 KB
/
app-cluster.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
/**
* Module dependencies.
*/
var cluster = require('cluster');
var app;
/**
* Initial bootstrapping
*/
exports.boot = function(port,path){
//Create our express instance
app = require('./app').boot();
// TODO : ENABLE Reload
/**
* var watchFolders = [path + '/models',
path + '/controllers',
path + '/views',
path + '/utils']
.use(cluster.reload(watchFolders,{ signal: 'SIGQUIT', interval: 60000 }))
*/
cluster(app)
.set('working directory', path)
.set('socket path',path)
.in('development')
.set('workers', 1)
.use(cluster.logger(path + '/logs', 'debug'))
.use(cluster.debug())
.use(cluster.pidfiles(path + '/pids'))
.in('test')
.set('workers', 1)
.use(cluster.logger(path + '/logs', 'warning'))
.use(cluster.pidfiles(path + '/pids'))
.in('production')
.set('workers', 2)
.use(cluster.logger(path + '/logs'))
.use(cluster.pidfiles(path + '/pids'))
.in('all')
.listen(parseInt(port));
};