Discourse installation on Azure not reachable

I created a new Ubuntu 14.04 VM on Microsoft Azure and installed Discourse using the guide here: discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub

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.

# ifconfig
docker0   Link encap:Ethernet  HWaddr 02:42:4c:29:e0:92  
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:4cff:fe29:e092/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6144 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21683 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:414603 (414.6 KB)  TX bytes:30771613 (30.7 MB)

eth0      Link encap:Ethernet  HWaddr 00:0d:3a:00:15:21  
          inet addr:10.0.0.4  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20d:3aff:fe00:1521/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1079091 errors:0 dropped:0 overruns:0 frame:0
          TX packets:634212 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1254465906 (1.2 GB)  TX bytes:318586926 (318.5 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:7245 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7245 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:986455 (986.4 KB)  TX bytes:986455 (986.4 KB)

vethcb56e42 Link encap:Ethernet  HWaddr 6a:43:07:bb:63:3f  
          inet6 addr: fe80::6843:7ff:febb:633f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2717 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2896 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:225111 (225.1 KB)  TX bytes:3277314 (3.2 MB)

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?

Please help. Thank you.

1 curtida

Currently we do not officially support Discourse installation on Microsoft Azure. We recommend using DigitalOcean.

Supporting Discourse installation on Microsoft Azure is on my to-do list and I plan to make a how-to guide for same by the end of January 2016.

Provided Docker installed correctly, I am unclear why the current guide would not work…

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.

3 curtidas

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.

5 curtidas

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!

Thank you all!

9 curtidas

Hi there!

Resetting my discourse installation on azure, I cannot reach it anymore!

It was working before, but by now, it doesn’t! I map the public ports to the vm and inside the vm to the docker installation. It all worked before.

Any idea where to start over? Where to check, what is up and running? Docker is running (according to pgrep).

Any help appreciated!
Bernd

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…

Regards,
Bernd

Detesto ter que ressuscitar este tópico, mas ele ainda é relevante. Tudo foi instalado perfeitamente no que diz respeito ao Discourse, tudo parece estar certo, mas as portas 80 e 443 não são acessíveis publicamente.


Atualização: A instalação básica funciona imediatamente no Azure no Ubuntu Server.

Estes são os passos que fiz de forma diferente na segunda tentativa:

  1. Após a criação da VM e ao chamar discourse-setup, não interrompi o processo, então tudo foi executado de uma só vez.

    Na primeira vez, percebi que não havia swap e, embora o script discourse-setup configure automaticamente caso esteja ausente, saí para o shell para verificar algumas coisas. Então, algumas das solicitações de instalação foram diferentes das do guia básico, então saí mais uma vez.

    + O que me deixou confuso foi a etapa do Let’s Encrypt, que pede um endereço de e-mail para receber notificações relacionadas, e eu tinha a impressão de que teria que configurar o HTTPS manualmente. Na realidade, o script configura a instância do Discourse com um certificado SSL do Let’s Encrypt.
    + Outra coisa foram as seções de nome de usuário e senha do SMTP; ainda não tenho certeza se poderia ter deixado esses campos em branco, mas apenas adicionei o e-mail do administrador e a senha dessa conta.

  2. Configurei o espaço de swap manualmente de acordo com este tópico do meta.discourse.

    Não acho que isso tenha tido algo a ver com o problema, mas menciono apenas por precaução. Na segunda vez, fiz tudo da mesma forma que na primeira, exceto (1) configurar o swap manualmente e (2) deixar o discourse-setup rodar sem interrupções.

É possível que a primeira instância pudesse ter sido salva, mas a arquitetura do Discourse ainda é um mistério para mim, e não sei como reiniciar os endpoints HTTP/HTTPS. Ao comparar as saídas de netstat -tulpn, fica claro que, na primeira instância, todos os serviços relevantes parecem estar rodando e escutando nas portas corretas (por exemplo, PostgreSQL na 5432, Redis na 6379, etc.), e as únicas duas entradas ausentes são as portas 80 e 443 (sugerindo que o nginx não estava rodando):

1ª instância (falha):

$ 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  -

2ª instância:

(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  -

Algumas anotações para minha futura referência:

  1. Na primeira vez, notei a falta das portas de escuta 80 e 443, mas vi o socket 127.0.0.1:3000 (que eu lembrava ser o padrão do Rails). Ainda não me ocorreu que talvez o nginx não estivesse rodando, e por algum motivo ainda suspeitava que as mapeamentos de portas do Docker fossem os culpados, então fiz um redirecionamento básico com netcat:

    Dentro do Docker: nc -l -p 80 -c "nc 127.0.0.1 3000"
    Fora do Docker, na VM: nc -zv localhost 80 e curl localhost:80 (isso confirmou que o Docker estava ok)

  2. Também achei que as regras de portas de entrada do Azure fossem suspeitas, porque nc -zv continuava retornando Connection refused, mas então percebi que isso só significa que as portas estão abertas, mas ninguém está escutando do outro lado. (Se as portas estivessem bloqueadas, o nc ficaria apenas pendurado.)

1 curtida

O discourse-setup deve falhar se você não tiver as portas 80 e 443 abertas para tráfego de entrada.

Ah. Isso é verdade. Algumas perguntas sobre configuração de e-mail foram alteradas há algum tempo e não foram atualizadas no guia. Acho que a maioria das pessoas lê as perguntas e não o documento de instalação, então ninguém mais reclamou.

Por que você pensou isso? O processo de instalação configura automaticamente o Let’s Encrypt há anos.

Não consigo dizer se você está dizendo que seu site está funcionando ou não.

Se não estiver funcionando, é bem provável que você tenha executado o discourse-setup várias vezes e esgotou seu limite de taxa no letsencrypt.org.

2 curtidas

Aqui está um PR para tornar o install cloud igual ao discourse-setup: update INSTALL-cloud for discourse-setup by pfaffman · Pull Request #14065 · discourse/discourse · GitHub

2 curtidas

Este tópico foi fechado automaticamente após 3095 dias. Novas respostas não são mais permitidas.