# 按照插件安装的标准指示操作后，重建容器一直失败

**URL:** <https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406>\
**Category:** Self-hosting\
**Created:** [2024年四月18日 04:53 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406 "2024-04-18T04:53:26Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Denis\_Didkovsky](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@Denis\_Didkovsky](https://meta.discourse.org/u/Denis_Didkovsky)\
**Post date:** [2024年四月18日 04:53 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406/1 "2024-04-18T04:53:26Z")

</div>

我们正在 DO 上运行 Discourse 的标准安装。一切都很好。然后我们决定按照此链接添加一个插件：

> [@Install plugins on a self-hosted site](https://meta.discourse.org/t/install-plugins-in-discourse/19157):
>
> warning This guide assumes that you have a self-hosted standard installation. We only support the standard method of install here, so these instructions assume you have a [standard install](https://meta.discourse.org/t/142537?silent=true). warning This guide only applies to self-hosted Discourse instances. If you are using a managed hosting service, the available plugins are controlled by your hosting provider. For example, on our hosting [these specific plugins](https://www.discourse.org/plugins) are available by hosting tier. In this tutorial, we’ll install the [Discours…](https://github.com/discourse/discourse-solved)

通过添加以下行：

```plaintext
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - sudo -E -u discourse git clone https://github.com/discourse/docker_manager.git && sudo -E -u discourse git clone https://github.com/discourse/discourse-templates.git

```

容器重建失败。

```FAILED
--------------------
Pups::ExecError: echo "End of custom commands failed with return #<Process::Status: pid 5121 exit 2>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params "echo \"End of custom commands"
bootstrap failed with exit code 2

```

所有命令都以 root 身份运行。我认为问题出在这里：

```plaintext
I, [2024-04-18T04:28:49.985355 #1] INFO -- : > cd /var/www/discourse/plugins && sudo -E -u discourse git clone https://github.com/discourse/docker_manager.git && sudo -E -u discourse git clone https://github.com/discourse/discourse-templates.git
Cloning into 'docker_manager'...
warning: unable to access '/root/.config/git/attributes': Permission denied
Cloning into 'discourse-templates'...
warning: unable to access '/root/.config/git/attributes': Permission denied

```

请在此处提供建议。

---

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [2024年四月18日 07:06 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406/2 "2024-04-18T07:06:26Z")

</div>

> [@Denis\_Didkovsky](#):
>
> `sudo -E -u discourse `

试着去掉它。

我只有 `- git clone ...`

……而且这已经运行了很多年了！

---

<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:** [2024年四月18日 10:33 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406/3 "2024-04-18T10:33:26Z")

</div>

它显示访问被拒绝。您确定您是以 root 用户身份运行的吗？

---

<div class="post-metadata">

**Author:** ![Denis\_Didkovsky](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@Denis\_Didkovsky](https://meta.discourse.org/u/Denis_Didkovsky)\
**Post date:** [2024年四月18日 14:51 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406/4 "2024-04-18T14:51:26Z")

</div>

> [@merefield](#):
>
> 试试去掉这个。
> 
> 我只有 `- git clone ...`
> 
> ……这已经用了好几年了！

我正在遵循此处发布的作为官方 Discourse 插件安装指南的安装指南。所有插件都链接到此指南。在我的案例中，它破坏了我们的安装，我们甚至无法恢复它，即使在初始 yml 设置下也进行了重建。

---

<div class="post-metadata">

**Author:** ![Denis\_Didkovsky](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@Denis\_Didkovsky](https://meta.discourse.org/u/Denis_Didkovsky)\
**Post date:** [2024年四月18日 14:53 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406/5 "2024-04-18T14:53:49Z")

</div>

我非常确定我们是在root权限下运行的。按照说明操作后，我们的安装被终止了，即使在初始的yml设置下也无法重新构建。

---

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [2024年四月18日 14:55 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406/6 "2024-04-18T14:55:46Z")

</div>

> [@Denis\_Didkovsky](#):
>
> 在我的情况下，它摧毁了我们的安装，我们甚至无法恢复它

构建失败不应该摧毁任何东西，它只会让你离线一段时间。  
数据库仍然会完好无损。

---

<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:** [2024年四月18日 15:36 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406/7 "2024-04-18T15:36:15Z")

</div>

运行 `./launcher start app` 能让论坛运行起来吗？

我最好的猜测是，您插入了一个制表符或其他导致 yml 无效的内容。

错误是关于 yml 文件末尾的“echo”，这表明之前某个地方存在格式问题。

> [@Denis\_Didkovsky](#):
>
> 即使在初始 yml 设置下，我们也无法重建它。

您在编辑文件之前保存了副本吗？或者您是否尝试编辑它以恢复到您认为编辑之前的状态？

您可以尝试重命名您的 `app.yml`，记下其中的值（尤其是 SMTP 相关内容），然后再次运行 `./discourse-setup`。这将为您提供一个可用的 `app.yml`。

---

<div class="post-metadata">

**Author:** ![Denis\_Didkovsky](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@Denis\_Didkovsky](https://meta.discourse.org/u/Denis_Didkovsky)\
**Post date:** [2024年四月18日 15:45 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406/8 "2024-04-18T15:45:16Z")

</div>

> [@pfaffman](#):
>
> `./launcher start app`

这会启动论坛。  
运行 `./discourse-setup` 会保留现有的论坛数据，还是我应该先备份然后恢复？非常感谢您的支持。

---

<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:** [2024年四月18日 16:14 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406/9 "2024-04-18T16:14:43Z")

</div>

是的。现有的数据库等将保留。这只是创建新 `app.yml` 的一种方式。

---

<div class="post-metadata">

**Author:** ![Denis\_Didkovsky](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@Denis\_Didkovsky](https://meta.discourse.org/u/Denis_Didkovsky)\
**Post date:** [2024年四月18日 16:17 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406/10 "2024-04-18T16:17:11Z")

</div>

尊敬的 @pfaffman 和 @merefield，感谢您的支持。  
存在 2 个问题：

1. 关键问题 - YML 语法错误，已由 YML 验证器修复
2. 次要问题 - 将 sudo -E -u discourse 替换为仅 git clone（以 root 用户身份）

这有助于我们重建和安装插件。  
非常感谢您！

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2024年五月18日 16:17 UTC](https://meta.discourse.org/t/rebuilding-the-container-is-constantly-failing-after-following-the-standard-instructions-on-plugin-install/304406/11 "2024-05-18T16:17:53Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
