node.jsinterfacemeteorproductionmultihomed

Meteor on Multihomed Server?


Does anybody have any experience running Meteor on multihomed servers? We're bring an app into production, and have some servers that have two network cards each. The one interface on eth0 connects to our internal network with our Mongo cluster, and the other interface eth1 connects to our DMZ. We're well past development, and are in post-bundle workflow. So, it's a question of running the following command only on eth1:

MONGO_URL='mongodb://mongodb:27017/?replicaSet=meteor' PORT='80' ROOT_URL='http://app.domain.org' node main.js

I don't know enough about node to know exactly how to specify a single interface. Is this specified with an environment variable? In our /etc/network/interfaces file? iptables? Something else?

I'm finding resources like the following on the web, but I'm not sure if I'm on the right track with them. Does getting a node.js server running on a specific interface require this kind of fussing? Is there something easier?

https://gist.github.com/logicalparadox/2142595
how to set node.js as a service on a private server?[can't access the node application]

Any help would be much appreciated! Thanks!
Abigail


Solution

  • Meteor will listen on 0.0.0.0 (all interfaces) unless your specify the environment variable BIND_IP.

    Explicitly- the value of BIND_IP is passed as the hostname parameter to http://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback

    Source: https://github.com/meteor/meteor/blob/master/packages/webapp/webapp_server.js#L541