502 Bad Gateway after trying to rebuild test-passed branch

AI-generated summary

waerfa encountered a “502 Bad Gateway” error after attempting to rebuild their Discourse instance using the tests-passed branch, following instructions from Change tracking branch for your Discourse instance. The rebuild failed with a git fetch error (exit code 128), specifically: Received HTTP code 503 from proxy after CONNECT, indicating a network issue. RGJ identified that the server likely uses a misconfigured or non-functional outbound proxy. waerfa confirmed the server is located in mainland China, suspecting interference from the Great Firewall (GFW) blocking GitHub access — a known issue documented in Upgrade from within China fails due to git issues RGJ. waerfa expressed uncertainty about how to set up a working proxy on the server to bypass the restriction. The ./discourse-doctor tool confirmed the app was not running and attempted to rebuild, but the underlying connectivity issue remains unresolved.

I tried to rebuild app after I followed the instruction about this: Change tracking branch for your Discourse instance, but when I update the app.yml and rebuild the container:

git pull
./launcher rebuild app

I got the fatal error which shows:

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && git fetch --depth 1 origin tests-passed failed with return #<Process::Status: pid 140 exit 128>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"code", "cmd"=>["git reset --hard", "git clean -f", "git remote set-branches --add origin main", "git remote set-branches origin $version", "git fetch --depth 1 origin $version", "git checkout $version", "mkdir -p tmp", "chown discourse:www-data tmp", "mkdir -p tmp/pids", "mkdir -p tmp/sockets", "touch tmp/.gitkeep", "mkdir -p                    /shared/log/rails", "bash -c \"touch -a           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log\"", "bash -c \"ln    -s           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log $home/log\"", "bash -c \"mkdir -p           /shared/{uploads,backups}\"", "bash -c \"ln    -s           /shared/{uploads,backups} $home/public\"", "bash -c \"mkdir -p           /shared/tmp/{backups,restores}\"", "bash -c \"ln    -s           /shared/tmp/{backups,restores} $home/tmp\"", "chown -R discourse:www-data /shared/log/rails /shared/uploads /shared/backups /shared/tmp", "find public/plugins/ -maxdepth 1 -xtype l -delete"]}
bootstrap failed with exit code 128
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
14b470c4c6575f2bc366dff1fa8559f98bce37abe5703f63c070b939f67dab65

And the website shows:

502 Bad Gateway

How do I fix it?

The whole log is in here:

whole log.txt (18.3 KB)

It seems like the rebuild is FAILED, and I used the ./discourse-doctor, shows:

==================== SERIOUS PROBLEM!!!! ====================

app not running!

Attempting to rebuild

Are you using a proxy for outbound traffic? It does not seem to be working correctly.

fatal: unable to access 'https://github.com/discourse/discourse.git/': 
  Received HTTP code 503 from proxy after CONNECT

My server is in China mainland, I have doubt that whether it was influenced by the GFW, make the rebuild action can not get the branch on Github?

Yes, my server is in China Mainland, and the update is always very hard, the default action can’t pull git from Github

That is the problem.

Lots of information here: Upgrade from within China fails due to git issues

I don’t know how to install a proxy in my server。。。