The entire installation went perfectly, but the instance is not reachable publicly. I have the A record configured to the public IP given by Azure. I also tried using the IP address directly.
I suspect this has something to do with the Docker IP and the Eth0 IP address, but not sure how to solve it.
So essentially I have 3 IPs: the public IP, the eth0 IP on the VPN, and then the docker instance IP. I’m guessing I need to somehow route the public IP:80 port to the docker IP?
Crazy cloud shenanigans likely get in the way – there’s probably some equivalent of AWS’ security groups, or perhaps the networking stack needs an extra kick in the pants.
So I sort of found the problem, but not the cure. As expected it has to do with the port forwarding/mapping/routing issue.
Azure VMs are part of a resource group with a common virtual public IP and a VPN/subnet for individual machines. Then there is a Network Security Group, with which one has to define some NAT rules.
I did setup forwarding for the Docker ports, but to no avail. Now trying to diagnose using Docker documentation. Jeff is right, once Docker works correctly, Discourse will work too.
The Azure classic VM should be better because they allow mapping of specific endpoints (ports). Will try installing in one of those.
Will post my updates. For better or for worse, I’m stuck with Azure at the moment.
Ok. So I discarded the instance of Ubuntu and created a new Ubuntu VM of the classic type. Then I chose a fixed Instance IP address. Then I created two endpoints for TCP/80 and TCP/443 to forward from the public to private network. Also I installed Docker from the instructions for Ubuntu and not the script directly.
I’m not sure which of these steps helped, but now Discourse works on Azure!
I finally switched to digital ocean, where it works out of the box. The VM classic type seems not to be available anymore at Azure? Tried to setup an instance without success…
Hate to bump this topic, but it is still relevant. Everything installs beautifully Discourse-wise, all seems fine, but ports 80 and 443 are publicly unreachable.
update: The basic installdoes work out of the box on Azure on Ubuntu Server.
These are what I did differently the second time around:
After VM creation and calling discourse-setup, I didn’t interrupt the process, so everything was run in one go.
The first time I realized I had no swap, and even though the discourse-setup script sets it up if missing, I exited to shell to check stuff. Then some of install prompts were different than in the basic guide, so exited one more time.
+ What baffled me was the Let’s Encrypt one, asking for an email address to receive notifications regarding it, and was under the impression that I would have to set up HTTPS manually. In reality, the script sets up the Discourse instance with a Let’s Encrypt SSL certificate. + Another thing was the SMTP user name and password sections; still not sure if I could’ve just left these blank, but I just added the admin email address and the password for that account.
I don’t think this had anything to do with it, but mentioning it just in case. The second time, I did everything the way I did in the first, except (1) set up swap manually, and (2) let discourse-setup run without interruptions.
It is possible that the first instance could have been saved but Discourse’s architecture is still a mystery to me, and not sure how to restart HTTP/HTTPS endpoints. When comparing netstat -tulpn outputs, it is clear that in the first instance, all the relevant services seem to run and listen on the right ports (e.g., PostgreSQL on 5432, Redis on 6379, etc.) and the only 2 entries missing are the 80 and 443 ports (suggesting that nginx wasn’t running):
1st (failed) instance:
$ sudo -s
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
62396a99737c local_discourse/app "/sbin/boot" 14 hours ago Up 14 hours 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp app
# docker exec -it 62396a99737c bash
(docker)# netstat -tulpn
Active Internet connections (only servers)
Proto Local Address Foreign Address State PID/Program name
tcp 127.0.0.1:3000 0.0.0.0:* LISTEN -
tcp 0.0.0.0:5432 0.0.0.0:* LISTEN -
tcp 0.0.0.0:6379 0.0.0.0:* LISTEN -
tcp6 :::5432 :::* LISTEN -
tcp6 :::6379 :::* LISTEN -
Second instance:
(docker)# netstat -tulpn
Active Internet connections (only servers)
Proto Local Address Foreign Address State PID/Program name
tcp 0.0.0.0:6379 0.0.0.0:* LISTEN -
tcp 0.0.0.0:80 0.0.0.0:* LISTEN 2359/nginx: master
tcp 127.0.0.1:3000 0.0.0.0:* LISTEN -
tcp 0.0.0.0:5432 0.0.0.0:* LISTEN -
tcp 0.0.0.0:443 0.0.0.0:* LISTEN 2359/nginx: master
tcp6 :::6379 :::* LISTEN -
tcp6 :::5432 :::* LISTEN -
Couple notes for future self:
The first time around, I noticed the lack of 80 and 443 listener ports, but saw the 127.0.0.1:3000 socket (which I remembered to be the default Rails one). It didn’t dawn on me yet that maybe nginx wasn’t running, and for some reason I still suspected Docker port mappings to be the culprit, so I did a basic redirect with netcat:
Inside Docker: nc -l -p 80 -c "nc 127.0.0.1 3000"
Outside Docker in the VM: nc -zv localhost 80 and curl localhost:80 (this settled it that Docker was ok)
I also thought the Azure inbound port rules to be suspect, because nc -zv kept returning Connection refused, but then realized that this only means that the ports are open but no one is listening on the other side. (If the ports would be blocking, than nc would just hang.)
discourse-setup should fail if you don’t have ports 80 and 443 open to inbound traffic.
Ah. That’s true. Some of the questions about email configuration were changed a while back and not changed in the guide. I think most people read the prompts and not the install document, so no one else has complained.
Why did you think that? The install process has automatically set up let’s encrypt for years.
I can’t tell if you’re saying that your site is working or not working.
If it’s not working, it’s a good bet that you ran discourse-setup a bunch of times and used up your rate limit at letsencrypt.org.