Howto bind discourse to a single IP address

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.

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

3 Likes

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

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.

4 Likes

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?

2 Likes

The faster method here is a restart replacing a rebuild.