forked from cliftonc/calipso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app-cluster.js
38 lines (34 loc) · 980 Bytes
/
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
/**
* Calipso script for running in clustered mode. Usage: node app-cluster, or
* NODE_ENV=production node app-cluster
*/
var cluster = require('cluster');
var port = 3000;
var path = __dirname;
var app;
/**
* Create an instance of calipso via the normal App.
*/
require('./app').boot(function(app) {
/**
* TODO: Check to ensure that the logs and pids folders exist before launching
*/
cluster(app)
.set('working directory', path)
.set('socket path', path)
.in('development')
.set('workers', 4)
.use(cluster.logger(path + '/logs', 'debug'))
.use(cluster.debug())
.use(cluster.pidfiles(path + '/pids'))
.in('test')
.set('workers', 4)
.use(cluster.logger(path + '/logs', 'warning'))
.use(cluster.pidfiles(path + '/pids'))
.in('production')
.set('workers', 4)
.use(cluster.logger(path + '/logs'))
.use(cluster.pidfiles(path + '/pids'))
.in('all')
.listen(port);
});