Howto bind discourse to a single IP address


(Robert Melton) #1

I have a machine with multiple public facing IP addresses – I want to give a discourse instance only one of those IPs to bind to. I have found lots of stuff about putting discourse behind another server (apache, nginx) but was unable to find anything about letting it bind to :443 / :80 on just a single IP.


(Matt Palmer) #2

Put the IP address before the ports in the expose settings in app.yml.


(Robert Melton) #3

When reading the docker documentation for expose, it didn’t seem like IP was an option?


(Matt Palmer) #4

app.yml does not universally follow Docker naming conventions, because in many cases launcher pre-dates the equivalently named Docker feature. The expose stanza in app.yml corresponds to Docker’s --publish option. You can verify this by reading the ./launcher source, and how it deals with the expose stanza.


(Robert Melton) #5

Thanks much. For those who might come here looking for what to change.

expose:
  - "80:80"   # http
  - "443:443" # https

to

expose:
  - "{public_ip}:80:80"   # http
  - "{public_ip}:443:443" # https

then to get the changes to take I did a

./launcher rebuild app

Question: could I have done a bootstrap instead of rebuild?


(Kane York) #6

The faster method here is a restart replacing a rebuild.