# 尝试重建 test-passed 分支后出现 502 Bad Gateway

**URL:** <https://meta.discourse.org/t/502-bad-gateway-after-trying-to-rebuild-test-passed-branch/224560>\
**Category:** Self-hosting\
**Created:** [2022年四月17日 21:46 UTC](https://meta.discourse.org/t/502-bad-gateway-after-trying-to-rebuild-test-passed-branch/224560 "2022-04-17T21:46:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![waerfa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waerfa/32/216044_2.png) [@waerfa](https://meta.discourse.org/u/waerfa)\
**Post date:** [2022年四月17日 21:46 UTC](https://meta.discourse.org/t/502-bad-gateway-after-trying-to-rebuild-test-passed-branch/224560/1 "2022-04-17T21:46:04Z")

</div>

我尝试按照以下说明重建应用程序：[更改 Discourse 实例的跟踪分支](https://meta.discourse.org/t/change-tracking-branch-for-your-discourse-instance/17014)，但在更新 app.yml 并重建容器时：

```plaintext
git pull
./launcher rebuild app

```

我遇到了致命错误，显示：

```plaintext
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

```

并且网站显示：

> # 502 Bad Gateway

我该如何解决？

完整的日志在这里：  
[whole log.txt](https://meta.discourse.org/uploads/short-url/t21rdEbZyeaILpFgfVSuRwXDug3.txt) (18.3 KB)

看起来重建失败了，我运行了 ./discourse-doctor，显示：

```plaintext
==================== SERIOUS PROBLEM!!!! ====================

app not running!

Attempting to rebuild

```

---

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [2022年四月17日 22:00 UTC](https://meta.discourse.org/t/502-bad-gateway-after-trying-to-rebuild-test-passed-branch/224560/2 "2022-04-17T22:00:07Z")

</div>

您是否正在使用代理进行出站流量？它似乎无法正常工作。

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

```

---

<div class="post-metadata">

**Author:** ![waerfa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waerfa/32/216044_2.png) [@waerfa](https://meta.discourse.org/u/waerfa)\
**Post date:** [2022年四月17日 22:01 UTC](https://meta.discourse.org/t/502-bad-gateway-after-trying-to-rebuild-test-passed-branch/224560/3 "2022-04-17T22:01:52Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![waerfa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waerfa/32/216044_2.png) [@waerfa](https://meta.discourse.org/u/waerfa)\
**Post date:** [2022年四月17日 22:03 UTC](https://meta.discourse.org/t/502-bad-gateway-after-trying-to-rebuild-test-passed-branch/224560/4 "2022-04-17T22:03:08Z")

</div>

是的，我的服务器在中国大陆，更新总是很困难，默认操作无法从 Github 拉取 git

---

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [2022年四月17日 22:06 UTC](https://meta.discourse.org/t/502-bad-gateway-after-trying-to-rebuild-test-passed-branch/224560/5 "2022-04-17T22:06:09Z")

</div>

这就是问题所在。

这里有很多信息：[Upgrade from within China fails due to git issues](https://meta.discourse.org/t/upgrade-from-within-china-fails-due-to-git-issues/198799)

---

<div class="post-metadata">

**Author:** ![waerfa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waerfa/32/216044_2.png) [@waerfa](https://meta.discourse.org/u/waerfa)\
**Post date:** [2022年四月17日 22:15 UTC](https://meta.discourse.org/t/502-bad-gateway-after-trying-to-rebuild-test-passed-branch/224560/6 "2022-04-17T22:15:37Z")

</div>

我不知道如何在我的服务器上安装代理。。。
