0

This is related to the stackoverflow question here: Run Websocket on GAE and also follows from a previous question I asked here: Google app engine: IP of docker custom runtime container, node.js.

As per the second question, I am trying to deploy a version of mozilla's browserquest in a production google custom runtime nodejs environment with boot2docker parameters as follows:

docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): darwin/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

I've run the app in a sandboxed copy of the production environment locally with success by using the boot2docker ip address.

However I don't know what ip address I should use when deploying to production. My app is at an http://[appname].appspot.com address, but I gather that one cannot go through that domain to access the server; I have tried pinging my app and using that ip to configure my scripts, that doesn't work.

Hence I was wondering if it is possible to either

  • force a docker container in a google app engine custom runtime deployment to have a certain ip address, so that code can be preconfigured for it, or
  • using something like jpettazo's pipework project, autoconfigure the deployment by somehow determining the ip of the container while deploying, and then when the app tries to access the server (say when one has created a character and clicks a button to start the game), it makes a call to the function that provides the relevant ip address.
Community
  • 1
  • 1

1 Answers1

1

hope this wil help you..

var os = require('os');

var interfaces = os.networkInterfaces();
var addresses = [];
for (var k in interfaces) {
    for (var k2 in interfaces[k]) {
        var address = interfaces[k][k2];
        if (address.family === 'IPv4' && !address.internal) {
            addresses.push(address.address);
        }
    }
}

console.log(addresses);
  • Thanks, that's very helpful, I will take a look at this within the day and assess its utility. – user1979000 Feb 18 '15 at 19:56
  • I was hoping to check things first in regards to your response, to see if the npm ip package runs properly in docker containers on google app engine. But your answer certainly puts me ahead of where I was irrespective of this, and any testing of the solution is probably out of scope, so I'm happy to accept on those grounds. – user1979000 Feb 19 '15 at 07:53