Recentemente, movi meu servidor Dell de um local para outro. Seu sistema operacional principal/Gerenciador de VM é o Proxmox VE 5.3. Tenho uma VM Nginx que atua como proxy reverso para várias outras VMs, sendo uma delas uma VM Discourse.
Após configurar meu novo roteador, consegui conectar várias das minhas VMs à Internet (sem nem mesmo precisar renovar os certificados SSL). No entanto, com o Discourse, estou recebendo o erro 502 Bad Gateway - nginx/1.14.0 (Ubuntu) ao tentar acessá-lo em um navegador.
Já recebi esse erro antes, mas geralmente uma das soluções abaixo o corrige:
Reiniciar a VM Discourse
Ainda aparece 502 Bad Gateway - nginx/1.14.0 (Ubuntu) no navegador.
Limpar cookies do navegador e tentar outros navegadores
Apenas para garantir que não seja algo do meu lado… não. Mesmo erro 502 Bad Gateway - nginx/1.14.0 (Ubuntu) em vários navegadores.
Limpeza do Discourse e verificação do espaço em disco
Inicialmente, ao fazer a limpeza, foram removidos cerca de 4 GB de dados. Fiquei muito surpreso. Talvez isso tenha causado o problema em primeiro lugar? De qualquer forma, agora, ao tentar fazer a limpeza do Discourse:
> root@forum:/var/discourse# ./launcher cleanup
> WARNING! This will remove all stopped containers.
> Are you sure you want to continue? [y/N] y
> Total reclaimed space: 0B
> WARNING! This will remove all images without at least one container associated to them.
> Are you sure you want to continue? [y/N] y
> Total reclaimed space: 0B
Também quero reiterar que não estou sem espaço em disco:
Git Pull
Está atualizado.
> root@forum:/var/discourse# git pull
> Already up to date.
Reiniciar o Discourse
Foi aqui que descobri dois erros que estou recebendo:
> root@forum:/var/discourse# ./launcher restart app
>
> WARNING: We are about to start downloading the Discourse base image
> This process may take anywhere between a few minutes to an hour, depending on your network speed
>
> Please be patient
>
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> See '/usr/bin/docker run --help'.
> Your Docker installation is not working correctly
>
> See: `https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam`
Verifiquei o link sugerido. Ele recomenda um Git Pull e Reconstruir o Discourse (o que você verá que acontece mais abaixo). Também sugere executar um comando Docker “Hello World”. Funciona (embora pareça ter alguns problemas?):
> root@forum:/var/discourse# docker run -it --rm hello-world
> Unable to find image 'hello-world:latest' locally
> latest: Pulling from library/hello-world
> 1b930d010525: Pull complete
> Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
> Status: Downloaded newer image for hello-world:latest
>
> Hello from Docker!
> This message shows that your installation appears to be working correctly.
>
> To generate this message, Docker took the following steps:
> 1. The Docker client contacted the Docker daemon.
> 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
> (amd64)
> 3. The Docker daemon created a new container from that image which runs the
> executable that produces the output you are currently reading.
> 4. The Docker daemon streamed that output to the Docker client, which sent it
> to your terminal.
>
> To try something more ambitious, you can run an Ubuntu container with:
> $ docker run -it ubuntu bash
>
> Share images, automate workflows, and more with a free Docker ID:
> https://hub.docker.com/
>
> For more examples and ideas, visit:
> https://docs.docker.com/get-started/
>
> failed to resize tty, using default size
Bem, em seguida, tentei o Ubuntu Bash … e erro:
> root@forum:/var/discourse# docker run -it ubuntu bash
> Unable to find image 'ubuntu:latest' locally
> docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/ubuntu/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fubuntu%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> See 'docker run --help'.
Hora de passar para outros métodos que conheço:
Parar e iniciar o Discourse
Recebendo a mesma coisa que com o Reiniciar:
> root@forum:/var/discourse# ./launcher stop app
>
> WARNING: We are about to start downloading the Discourse base image
> This process may take anywhere between a few minutes to an hour, depending on your network speed
>
> Please be patient
>
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> See '/usr/bin/docker run --help'.
> Your Docker installation is not working correctly
>
> See: `https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam`
>
> root@forum:/var/discourse# ./launcher start app
>
> WARNING: We are about to start downloading the Discourse base image
> This process may take anywhere between a few minutes to an hour, depending on your network speed
>
> Please be patient
>
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/discourse/base/manifests/2.0.20191013-2320: Get https://auth.docker.io/token?scope=repository%3Adiscourse%2Fbase%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> See '/usr/bin/docker run --help'.
> Your Docker installation is not working correctly
>
> See: `https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam`
Reconstruir o Discourse
E recebendo os mesmos dois erros novamente.
> root@forum:/var/discourse# ./launcher rebuild app
>
> WARNING: We are about to start downloading the Discourse base image
> This process may take anywhere between a few minutes to an hour, depending on your network speed
>
> Please be patient
>
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> See '/usr/bin/docker run --help'.
> Your Docker installation is not working correctly
>
> See: https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam
Restaurar a partir de um backup anterior
Tenho um snapshot de um momento antes de mover o servidor e fazer a limpeza (que, como mencionado, limpou cerca de 4 GB de arquivos). Tentei tudo acima novamente … e a mesma coisa (menos a Limpeza), além do 502 Bad Gateway - nginx/1.14.0 (Ubuntu) no navegador. Então, talvez isso não tenha nada a ver com a limpeza?
Em todo o meu tempo com o Discourse, nunca encontrei nenhum desses erros. Alguma sugestão sobre o que posso fazer para resolver esses erros e fazer o Discourse rodar no navegador?
