Anshuman Biswas
Anshuman Biswas

Reputation: 789

Meteor Deployment Strategies

I have a meteor deployment that I wish to run on port 80 of a server already running apache. I need a subdomain to point to the meteor deployment. I have already tried to use the apache's mod_proxy to create a proxy to the subdomain with meteor deployed on port 8080. However, mod_proxy doesn't work with web sockets. I have also tried to use the mod_proxy_wstunnel module but that doesn't seem to work either. The server has 5 IPs. So, I have also thought of deploying meteor on a separate IP from the one on which apache is deployed. However, meteor seems to bind to all 5 IPs. I couldn't find a way to separate meteor to unbind from the other Ips and bind to just one. Is there any way of solving this problem ?

Upvotes: 1

Views: 651

Answers (1)

user728291
user728291

Reputation: 4138

Similar to the nginx suggestion in comments, I have done this with haproxy.

Haproxy listens on port 80, passes requests to meteor's subdomain to port 3000, and leaves everything else to apache which I moved to port 8000. Took minutes to setup, supports websockets, and I don't really notice haproxy running.

My haproxy config is based on link above and looks like this:

# this config needs haproxy-1.1.28 or haproxy-1.2.1
global
  daemon
  log /dev/log local0 info
  log /dev/log local0 notice

defaults
  log global
  maxconn 4096
  mode http
  option http-server-close
  option httplog
  option dontlognull
  timeout connect 5s
  timeout client 30s
  timeout server 30s

frontend public
  # HTTP
  bind :80
  use_backend meteor if { hdr_end(Host) meteorSubdomain.yourDomain.com }

  default_backend apache

backend meteor
  server meteor1 127.0.0.1:3000

backend apache
  server apache1 127.0.0.1:8000 

Upvotes: 2

Related Questions