Unable to Rebuild Discourse: GitHub Connection Error and Port 443 Issues on GCP

Hi Discourse Community,

I’m having trouble rebuilding my Discourse instance on a Google Cloud Platform (GCP) VM (Ubuntu 22.04, 16GB RAM, 8 CPU cores). The rebuild fails due to a GitHub connection error, and I’m also facing issues with port 443 accessibility. I’ve tried several steps, but I’m stuck and would appreciate your help.

GitHub Connection Error During Rebuild

When running ./launcher rebuild app or ./discourse-setup, the rebuild fails with the following error in the logs:

fatal: unable to access ’ https://github.com/discourse/discourse.git/ ': Failed to connect to github.com port 443 after 3 ms: Couldn’t connect to server

Pups::ExecError: cd /var/www/discourse && sudo -H -E -u discourse bash -c ‘… git fetch …’ failed with return #<Process::Status: pid 145 exit 128>

However, testing GitHub connectivity from the host works fine:

curl -I https://github.com

HTTP/2 200

But running as the discourse user fails:

sudo -u discourse -H git ls-remote https://github.com/discourse/discourse.git

fatal: unable to access ’ https://github.com/discourse/discourse.git/ ': Failed to connect to github.com port 443 after 3 ms: Couldn’t connect to server

DNS resolution for github.com works:

sudo -u discourse -H nslookup github.com 8.8.8.8

Server:         8.8.8.8

Address:        8.8.8.8#53

Name:   github.com

Address: 192.30.255.113

Do you have a firewall enabled? It’s probably to blame.

Is that inside the container? There can be differernt firewall rules applied to docker than the host.

I’ve set up self-hosting on Google Cloud a couple of times before. However, my last attempt, a week ago, didn’t work. It keeps giving me 443 and GitHub data path errors, and I can’t rebuild.

The fact it failed to connect after only 3ms means the problem lies on the host or very near it.

What changes have you made on the host? Have you started a firewall? Perhaps it’s overwriting the necessary forwarding rules for docker.

Start with examining the IP connectivity of the container.