Вопрос

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

Это было полезно?

Решение

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

Другие советы

Okay, so got things working. Second ethernet card wasn't configured.

sudo nano /etc/network/interfaces    
  auto eth0
  iface eth0 inet static
      address aaa.bbb.ccc.ddd
      gateway aaa.bbb.ccc.eee

  auto eth1
  iface eth1 inet static
      address aaa.bbb.ccc.fff
      gateway aaa.bbb.ccc.ggg

sudo ifconfig eth1 up
sudo /etc/init.d/networking restart

Then had to make sure firewalls were working...

sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT    
sudo iptables -L -n -v

Then confirmed the site was running on the correct IP address with a big of curl...

curl -XGET http://aaa.bbb.ccc.fff/main.js
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top