# 升级失败 - 希望能通过 SSH 协助修复

**URL:** https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869
**Category:** Support
**Created:** [2019年三月17日 20:57 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869 "2019-03-17T20:57:06Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![asampal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/asampal/32/134300_2.png) [@asampal](https://meta.discourse.org/u/asampal)
#### Post date: [2019年三月17日 20:57 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/1 "2019-03-17T20:57:06Z")

</div>

Yesterday I had an admin message about upgrades. From the web UI, I did the Docker upgrade first and this seemed to go well. After it finished, the upgrade button for Discourse was enabled and I initiated that. At some point something broke and now our site is down. I was on my phone at the time and I didn’t manage to look at the log carefully to see where exactly things broke, before

I’m currently pocking around over SSH and about to try `./launcher rebuild app` to hopefully get a better idea about what exactly is the problem in the upgrade. I’ve never done Discourse command-line repair and I want to make sure that I don’t blow away our data. Looking over app.yml, I see that the container is stateless - great - and that all the data is on the host, accessed as a shared volume.

I ran `discourse-doctor` and it looks like disk space is not the issue. Will the rebuild app command touch the local data store?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2019年三月17日 21:06 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/2 "2019-03-17T21:06:51Z")

</div>

Yes, do the `./launcher rebuild app` that _should_ do it. It will not blow away your data.

If you’d rather not to it yourself, please see [Automatic Rebuilds When You Need Them](https://meta.discourse.org/t/automatic-rebuilds-when-you-need-them/110775).

---

<div class="post-metadata">

### Author: ![asampal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/asampal/32/134300_2.png) [@asampal](https://meta.discourse.org/u/asampal)
#### Post date: [2019年三月17日 21:29 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/3 "2019-03-17T21:29:38Z")

</div>

Thanks, the rebuild seems to have worked - the GitHub avatars and favicon don’t show for some reason, though.

---

<div class="post-metadata">

### Author: ![Alexandra\_Staicu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexandra_staicu/32/199175_2.png) [@Alexandra\_Staicu](https://meta.discourse.org/u/Alexandra_Staicu)
#### Post date: [2020年十一月4日 15:38 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/4 "2020-11-04T15:38:29Z")

</div>

你好！  
我升级后，页面返回了 504 网关超时错误。  
我执行了以下操作，但问题仍未解决：

```plaintext
cd /var/discourse
git pull; ./launcher rebuild app

```

您知道为什么仍然无法工作吗？

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2020年十一月4日 15:44 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/5 "2020-11-04T15:44:09Z")

</div>

不，目前很难确定具体原因。我的最佳猜测是您可能没有等待服务器完全重启，但也可能是其他问题。重建过程是否顺利完成且无错误？磁盘空间是否已满？`docker ps` 是否显示容器正在运行？

---

<div class="post-metadata">

### Author: ![Alexandra\_Staicu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexandra_staicu/32/199175_2.png) [@Alexandra\_Staicu](https://meta.discourse.org/u/Alexandra_Staicu)
#### Post date: [2020年十一月4日 15:49 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/7 "2020-11-04T15:49:40Z")

</div>

Docker ps 显示如下：  
 ![Captura de pantalla 2020-11-04 a las 16.52.52](https://cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/meta/optimized/3X/b/f/bfc799c1b0ddcc84071cd9adb90b8e8590f3a544_2_689x16.png)

如果我输入 ./launcher enter app，它会提示我 **容器未运行** 。我该如何让它运行？

在日志文件中我看到了以下内容：  
_无法在任何源中找到 rake-13.0.1_  
_请运行 `bundle install` 以安装缺失的 gems。_  
这有关系吗？  
谢谢

---

<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: [2020年十一月4日 16:04 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/8 "2020-11-04T16:04:55Z")

</div>

该容器名称表示重建仍在进行中，且仅持续了 4 分钟。

您可以使用以下命令实时查看日志：

```plaintext
docker logs -tf sweet_chatelet

```

日志有在更新吗？

---

<div class="post-metadata">

### Author: ![Alexandra\_Staicu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexandra_staicu/32/199175_2.png) [@Alexandra\_Staicu](https://meta.discourse.org/u/Alexandra_Staicu)
#### Post date: [2020年十一月4日 16:07 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/9 "2020-11-04T16:07:42Z")

</div>

重建已完成，但只显示以下内容：  
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

对于 `./launcher enter app`，我收到以下错误：  
_来自守护进程的响应错误：容器 … 未运行_

---

<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: [2020年十一月4日 16:25 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/10 "2020-11-04T16:25:06Z")

</div>

因此，重建在某一步骤失败了。

请尝试使用 `./launcher rebuild app` 命令重新构建，并观察日志。当它因另一个错误停止时，向上滚动并搜索错误信息，这些信息将显示问题所在。请将它们复制到这里，我们可以提供帮助。

---

<div class="post-metadata">

### Author: ![Alexandra\_Staicu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexandra_staicu/32/199175_2.png) [@Alexandra\_Staicu](https://meta.discourse.org/u/Alexandra_Staicu)
#### Post date: [2020年十一月4日 16:32 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/11 "2020-11-04T16:32:02Z")

</div>

@Falco 如果我输入 ./launcher logs app，会出现以下内容：  
_在所有源中找不到 rake-13.0.1_  
_请运行 `bundle install` 以安装缺失的 gems。_

---

<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: [2020年十一月4日 16:37 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/12 "2020-11-04T16:37:29Z")

</div>

这是全部日志吗？你能分享更大一部分的日志吗？

这台服务器是否位于某些奇怪的防火墙或企业环境之后？还是说它只是互联网上的一台普通 VPS？

---

<div class="post-metadata">

### Author: ![Alexandra\_Staicu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexandra_staicu/32/199175_2.png) [@Alexandra\_Staicu](https://meta.discourse.org/u/Alexandra_Staicu)
#### Post date: [2020年十一月4日 16:41 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/13 "2020-11-04T16:41:51Z")

</div>

在完成 ./launcher rebuild app 后，显示如下信息： **启动失败** ，请向上滚动并查找之前的错误消息，可能不止一条。  
./discourse-doctor 可能有助于诊断问题。

但 ./discourse-doctor 无法解决任何问题。

---

<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: [2020年十一月4日 16:42 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/14 "2020-11-04T16:42:18Z")

</div>

> [@Alexandra\_Staicu](#):
>
> 请向上滚动并查看之前的错误消息，可能不止一条。

你能向上滚动并查看之前的错误消息吗？

---

<div class="post-metadata">

### Author: ![Alexandra\_Staicu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexandra_staicu/32/199175_2.png) [@Alexandra\_Staicu](https://meta.discourse.org/u/Alexandra_Staicu)
#### Post date: [2020年十一月4日 16:53 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/15 "2020-11-04T16:53:08Z")

</div>

我不知道这个是否能帮你看看发生了什么！[Captura de pantalla 2020-11-04 a las 17.49.54|690x388](https://meta.discourse.org/uploads/short-url/yBSnRLbX3gZbS4hhdrbfgszwuFb.jpeg)

 ![Captura de pantalla 2020-11-04 a las 17.50.36](https://global.discourse-cdn.com/meta/original/3X/c/1/c1cca25e680821182f54140808b2191e6d37d7e4.jpeg) ![Captura de pantalla 2020-11-04 a las 17.51.00](https://global.discourse-cdn.com/meta/original/3X/7/8/7811bb127c58ce0bbb9550a479b469c25a652f11.jpeg) ![Captura de pantalla 2020-11-04 a las 17.51.37](https://global.discourse-cdn.com/meta/original/3X/e/9/e9d8b9da6142cdb0253e7f2e189918c0d4e62c85.jpeg)

---

<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: [2020年十一月4日 16:59 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/16 "2020-11-04T16:59:57Z")

</div>

前三个截图来自 `./launcher logs app`，这些没什么用。

最后一个来自 `./launcher rebuild app`，其中包含了关键信息！请检查其中的错误，如果可能的话，请将完整输出作为文本粘贴到这里。

---

<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: [2020年十一月4日 17:13 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/18 "2020-11-04T17:13:55Z")

</div>

谢谢！

```
/pups/lib/pups/config.rb:106:in `block (2 levels) in run_commands': 无效的 run 命令 cd (SyntaxError)
	从 /pups/lib/pups/config.rb:100:in `each'
	从 /pups/lib/pups/config.rb:100:in `block in run_commands'
	从 /pups/lib/pups/config.rb:99:in `each'
	从 /pups/lib/pups/config.rb:99:in `run_commands'
	从 /pups/lib/pups/config.rb:78:in `run'
	从 /pups/lib/pups/cli.rb:31:in `run'
	从 /pups/bin/pups:8:in `<main>'
44bf915bdff740d4441ad5239f79d5b14a6ed375300c52b85c10eefb7af677a2
**启动失败** 请向上滚动并查找更早的错误信息，可能不止一条。
./discourse-doctor 可能有助于诊断问题。

```

看起来您的 `app.yml` 中包含一些无效的命令。

也许您尝试添加插件时输入了一些无效字符？

能否在移除任何密码后将其粘贴在这里？

---

<div class="post-metadata">

### Author: ![Alexandra\_Staicu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexandra_staicu/32/199175_2.png) [@Alexandra\_Staicu](https://meta.discourse.org/u/Alexandra_Staicu)
#### Post date: [2020年十一月4日 17:28 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/19 "2020-11-04T17:28:24Z")

</div>

好的，内容如下：  
[app.txt](https://meta.discourse.org/uploads/short-url/kxGjVd1knRObb2MWAPrwyLaJS4Q.txt) (3.4 KB)

---

<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: [2020年十一月4日 17:51 UTC](https://meta.discourse.org/t/upgrade-failed-could-use-some-help-to-try-and-fix-using-ssh/111869/20 "2020-11-04T17:51:44Z")

</div>

看起来您尝试启用[使用 Docker 支持子文件夹](https://meta.discourse.org/t/subfolder-support-with-docker/30507)，但第一个代码块的缩排出错了。

您只需要在第 82、83、84 和 85 行的开头添加两个额外的空格。

之后保存文件并重新构建即可。
