# 如何使用代理 \`./launcher rebuild app\`

**URL:** <https://meta.discourse.org/t/how-to-use-proxy-in-launcher-rebuild-app/192133>\
**Category:** Self-hosting\
**Created:** [2021年五月31日 03:40 UTC](https://meta.discourse.org/t/how-to-use-proxy-in-launcher-rebuild-app/192133 "2021-05-31T03:40:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![topological](https://avatars.discourse-cdn.com/v4/letter/t/b487fb/32.png) [@topological](https://meta.discourse.org/u/topological)\
**Post date:** [2021年五月31日 03:40 UTC](https://meta.discourse.org/t/how-to-use-proxy-in-launcher-rebuild-app/192133/1 "2021-05-31T03:40:38Z")

</div>

我运行 `./launcher rebuild app` 失败，并收到以下输出信息：

```plaintext
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && git fetch --depth 1 origin tests-passed failed with return #<Process::Status: pid 210 exit 128>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"code", "cmd"=>["git reset --hard", "git clean -f", "git remote set-branches --add origin master", "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"]}

```

我知道服务器无法访问 GitHub，因此已在 Docker 主机上设置了代理配置。  
我尝试过使用 `proxychains`，设置 `http_proxy` 环境变量以及 `git config`，但均无效。  
看起来 Docker 容器内部的命令在尝试从 GitHub 获取数据时并未使用代理。

请问是否可以通过代理安装或更新 Discourse？谢谢。

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2021年五月31日 03:46 UTC](https://meta.discourse.org/t/how-to-use-proxy-in-launcher-rebuild-app/192133/2 "2021-05-31T03:46:20Z")

</div>

上次我做这件事大约是2017年，但大致内容如下：

> [@Install discourse with internet access only via proxy](https://meta.discourse.org/t/install-discourse-with-internet-access-only-via-proxy/66396/5?u=falco):
>
> This is possible, you need: Export http and https ENV variables in your current shell Add the same variables to the env block inside the containers/app.yml file Add the same variables to the docker system.d service config file (read system.d docs on this, you will need to create a new service file somewhere). After this, our official guide will work just fine.
