added cluster module to node-windshaft

This commit is contained in:
Luis Bosque 2011-12-27 16:35:59 +01:00
parent dcea209ca5
commit a1c0bcac25
2 changed files with 45 additions and 0 deletions

44
cluster.js Executable file
View File

@ -0,0 +1,44 @@
/*
* Windshaft-CartoDB
* ===============
*
* ./app.js [environment]
*
* environments: [development, production]
*/
var cluster = require('cluster');
// sanity check
var ENV = process.argv[2]
if (ENV != 'development' && ENV != 'production'){
console.error("\nnode app.js [environment]");
console.error("environments: [development, production]\n");
process.exit(1);
}
var _ = require('underscore')
, Step = require('step')
, cartoData = require('./lib/cartodb/carto_data')
, CartodbWindshaft = require('./lib/cartodb/cartodb_windshaft');
// set environment specific variables
global.settings = require(__dirname + '/config/settings');
global.environment = require(__dirname + '/config/environments/' + ENV);
_.extend(global.settings, global.environment);
var Windshaft = require('windshaft');
var serverOptions = require('./lib/cartodb/server_options');
ws = CartodbWindshaft(serverOptions);
cluster(ws)
.use(cluster.logger('logs'))
.use(cluster.stats())
.use(cluster.pidfiles('pids'))
.set('workers', 1)
.listen(global.environment.windshaft_port);
//ws.listen(global.environment.windshaft_port);
console.log("Windshaft tileserver started on port " + global.environment.windshaft_port);

View File

@ -15,6 +15,7 @@
"email": "simon@vizzuality.com"
},
"dependencies": {
"cluster": "0.6.4",
"node-varnish": "0.1.0",
"underscore" : "1.1.x",
"windshaft" : "0.4.3",