Question

I have set up up a node.js 0.10 gear in OpenShift which I deployed a simple server which is based off peerjs-server. All I want this server to do is act as a signalling server to communicate the connection info between peers connected to my application and from then on they communicate peer-to-peer using WebRTC. Everything works when pointing to the demo "PeerJS Cloud" signalling server but when trying to use my own server set up I keep getting returned 503 status codes.

Here is the server creation code I use:

var host = process.env.OPENSHIFT_NODEJS_IP;
var port = process.env.OPENSHIFT_NODEJS_PORT || 8080;

var server = new PeerServer({ port: port, host: host});

NB: I have added host to peerjs-server so I can use OpenShift's IP, not sure if this was necessary but it wasn't working without this either.

The server peerjs-server uses is restify. Here is the server create and listen code:

this._app = restify.createServer(this._options.ssl);

/* A lot of set up code that I have not changed from peerjs-server */

this._app.listen(this._options.port, this._options.host);

Where this._options.port and this._options.host are the ones defined in the previous code segment and I am not using SSL so nothing is being passed in there.

When deploying this code to OpenShift I get no errors but when accessing the site on port 80 or 8000 (the open external ports) I get 503's. I also checked rhc tail and this is what I get: Screenshot (Can't post images because I have no reputation..). Not sure exactly what that means if anything.

Any help is much appreciated, and if more info is needed I can add more, was not sure what was important information or not.

UPDATE: It's a scaled application using 1-3 small gears.

Was it helpful?

Solution

from https://github.com/peers/peerjs-server/blob/master/lib/server.js:

// Listen on user-specified port and IP address.
if (this._options.ip) {
  this._app.listen(this._options.port, this._options.ip);
} else {
  this._app.listen(this._options.port);
}

So, use 'ip' and not 'host'. Worked for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top