Commit ae4920fc authored by lazorfuzz's avatar lazorfuzz
Browse files

log workers started

parent cbc5983f
......@@ -20,6 +20,7 @@
"react/prefer-stateless-function": 0,
"no-underscore-dangle": 0,
"comma-dangle": 0,
"no-use-before-define": 0
"no-use-before-define": 0,
"no-console": 0
}
}
......@@ -5,3 +5,5 @@ ecosystem.config.js
Dockerfile
.drone.yml
dist
.jshintignore
.jshintrc
......@@ -4,7 +4,7 @@ A scalable signaling server for WebRTC using socket.io, NodeJS cluster, and Redi
## What is SignalBuddy?
SignalBuddy is an easy-to-scale signaling solution for WebRTC. SignalBuddy automatically detects and scales across the number of CPU cores in its environment. For instance, if the machine you're testing on has four cores, SignalBuddy will launch a cluster of four processes, each a separate instance of itself, all listening on the same port. Using Redis to store state, peers connected to different worker instances will still be able to broadcast and transmit data to one another.
SignalBuddy is an easy-to-scale signaling solution for WebRTC. SignalBuddy automatically detects and scales across the number of CPU cores in its environment. For instance, if the machine you're testing on has four cores, SignalBuddy will launch a cluster of four processes, each a separate instance of itself, all listening on the same port. Using Redis to store state, peers connected to different worker instances, even on different servers, will still be able to join the same rooms and broadcast data to one another.
## Running
......@@ -53,7 +53,14 @@ Most likely, you'll want the server to be secure. You can either pass in the pat
NODE_ENV=production PRIV_KEY=/etc/example/privKey.pem CERT=/etc/example/cert.pem node dist/server.js
```
Or you can also add your key/cert paths to the production.json file in the config folder.
Or you can add your key/cert paths to the production.json file in the config folder.
To pass in the Redis endpoint and port, use REDIS_ENDPOINT and REDIS_PORT:
```
NODE_ENV=production REDIS_ENDPOINT=localhost REDIS_PORT=6379 node dist/server.js
```
As with keys and certs, you can also add Redis endpoint details to your JSON config files.
---
......
......@@ -6,6 +6,10 @@
"key": null,
"cert": null
},
"redis": {
"endpoint": "localhost",
"port": 6379
},
"rooms": {
"/* maxClients */": "/* maximum number of clients per room. 0 = no limit */",
"maxClients": 0
......
......@@ -60,6 +60,7 @@ if (_cluster2.default.isMaster) {
};
for (var i = 0; i < numProcesses; i += 1) {
console.log('Starting worker ' + (i + 1));
spawn(i);
}
......@@ -96,8 +97,8 @@ if (_cluster2.default.isMaster) {
// Create an http(s) server instance to that socket.io can listen to
if (_getconfig2.default.server.secure) {
server = _https2.default.Server({
key: _fs2.default.readFileSync(_getconfig2.default.server.key),
cert: _fs2.default.readFileSync(_getconfig2.default.server.cert),
key: _fs2.default.readFileSync(process.env.PRIV_KEY || _getconfig2.default.server.key),
cert: _fs2.default.readFileSync(process.env.CERT || _getconfig2.default.server.cert),
passphrase: _getconfig2.default.server.password
}, serverHandler);
} else {
......@@ -122,7 +123,6 @@ if (_cluster2.default.isMaster) {
if (message !== 'sticky-session:connection') {
return;
}
// Emulate a connection event on the server by emitting the
// event with the connection the master sent us.
server.emit('connection', connection);
......
{
"name": "signalbuddy",
"description": "A scalable, socket.io WebRTC signaling solution for LioWebRTC.",
"description": "A scalable socket.io signaling solution for WebRTC using NodeJS cluster and Redis.",
"version": "1.0.0",
"dependencies": {
"farmhash": "^2.1.0",
......
......@@ -27,6 +27,7 @@ if (cluster.isMaster) {
};
for (let i = 0; i < numProcesses; i += 1) {
console.log(`Starting worker ${i + 1}`);
spawn(i);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment