clusterisation du serveur
This commit is contained in:
parent
1b9623600c
commit
0de920ed93
8
README
8
README
@ -63,8 +63,16 @@ sudo ln -s ~/Movies /media/plex
|
|||||||
configurer vos chaines sur: http://localhost:32400/web/index.html
|
configurer vos chaines sur: http://localhost:32400/web/index.html
|
||||||
|
|
||||||
|
|
||||||
|
===================
|
||||||
|
COMPILATION
|
||||||
|
|
||||||
|
npm install enclose -g
|
||||||
|
enclose -o bin/mac_bin --loglevel info -c enclose_config.js -v 0.12.7 ./bin/www
|
||||||
|
|
||||||
|
|
||||||
===================
|
===================
|
||||||
TODO Liste
|
TODO Liste
|
||||||
|
ajouter une présentation sur l'index, configurable dans config.js
|
||||||
gérer les images des vignettes
|
gérer les images des vignettes
|
||||||
faire une page spéciales pour les séries
|
faire une page spéciales pour les séries
|
||||||
gérer les téléchargements multi-source en proposant un lien aria2 (voir aria2.sourceforge.net)
|
gérer les téléchargements multi-source en proposant un lien aria2 (voir aria2.sourceforge.net)
|
||||||
|
51
bin/www
51
bin/www
@ -1,33 +1,56 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
//On commence par la mise en cluster
|
||||||
|
var cluster = require('cluster');
|
||||||
|
|
||||||
/**
|
// Code to run if we're in the master process
|
||||||
|
if (cluster.isMaster) {
|
||||||
|
// Count the machine's CPUs
|
||||||
|
var cpuCount = require('os').cpus().length;
|
||||||
|
|
||||||
|
// Create a worker for each CPU
|
||||||
|
for (var i = 0; i < cpuCount; i += 1) {
|
||||||
|
console.log('Création du fork ' + i);
|
||||||
|
cluster.fork();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Listen for dying workers
|
||||||
|
cluster.on('exit', function (worker) {
|
||||||
|
// Replace the dead worker, we're not sentimental
|
||||||
|
console.log('Worker ' + worker.id + ' died :(');
|
||||||
|
cluster.fork();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Code to run if we're in a worker process
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
* Module dependencies.
|
* Module dependencies.
|
||||||
*/
|
*/
|
||||||
|
var app = require('../app');
|
||||||
|
var debug = require('debug')('plex_webdown:server');
|
||||||
|
var http = require('http');
|
||||||
|
|
||||||
var app = require('../app');
|
/**
|
||||||
var debug = require('debug')('plex_webdown:server');
|
|
||||||
var http = require('http');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get port from environment and store in Express.
|
* Get port from environment and store in Express.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var port = normalizePort(process.env.PORT || '3000');
|
var port = normalizePort(process.env.PORT || '3000');
|
||||||
app.set('port', port);
|
app.set('port', port);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create HTTP server.
|
* Create HTTP server.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var server = http.createServer(app);
|
var server = http.createServer(app);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listen on provided port, on all network interfaces.
|
* Listen on provided port, on all network interfaces.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
server.listen(port);
|
server.listen(port);
|
||||||
server.on('error', onError);
|
server.on('error', onError);
|
||||||
server.on('listening', onListening);
|
server.on('listening', onListening);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalize a port into a number, string, or false.
|
* Normalize a port into a number, string, or false.
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"jade": "~1.11.0",
|
"jade": "~1.11.0",
|
||||||
"morgan": "~1.6.1",
|
"morgan": "~1.6.1",
|
||||||
"serve-favicon": "~2.3.0",
|
"serve-favicon": "~2.3.0",
|
||||||
"sqlite3": "~3"
|
"sqlite3": "~3",
|
||||||
|
"cluster":"~0.7.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
contenu test
|
|
Loading…
Reference in New Issue
Block a user