# 如何检查插件是否已下载？

**URL:** https://meta.discourse.org/t/how-to-check-the-plugin-was-downloaded/155589
**Category:** Self-hosting
**Tags:** server-resources
**Created:** [2020年六月22日 17:16 UTC](https://meta.discourse.org/t/how-to-check-the-plugin-was-downloaded/155589 "2020-06-22T17:16:49Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Wall-E](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wall-e/32/184438_2.png) [@Wall-E](https://meta.discourse.org/u/Wall-E)
#### Post date: [2020年六月22日 17:16 UTC](https://meta.discourse.org/t/how-to-check-the-plugin-was-downloaded/155589/1 "2020-06-22T17:16:49Z")

</div>

我试图安装 [Discourse Math 插件](https://meta.discourse.org/t/discourse-math-plugin/65770)。这是我安装的第一个插件。Discourse 运行在 GCP 上一台配置非常有限的虚拟机上。

我按如下方式编辑了 `app.yml` 文件：

```
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-math.git

```

运行 `./launcher rebuild app` 后，我的虚拟机返回了以下消息，抱怨内存不足，而我的插件仍未出现在 Discourse 设置中，看来并未成功安装。以下消息是否意味着由于内存不足，实际上没有任何操作发生？我很惊讶 5 GB 的空间竟然不够下载插件。有什么方法可以检查下载是否发生？还是说只是我的 `app.yml` 编辑得不正确？

```
root@discourse-gcp1:/var/discourse# ./launcher rebuild app
WARNING: We are about to start downloading the Discourse base image
This process may take anywhere between a few minutes to an hour, depending on your network speed
Please be patient
2.0.20200512-1735: Pulling from discourse/base
Digest: sha256:7f6c5be23a8e4237cecafaca9d041de5964f8237345b7b183cebdee1f73ed024
Status: Downloaded newer image for discourse/base:2.0.20200512-1735
docker.io/discourse/base:2.0.20200512-1735
You have less than 5GB of free space on the disk where /var/lib/docker is located. You will need more space to continue
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.6G 5.3G 4.4G 55% /
Would you like to attempt to recover space by cleaning docker images and containers in the system?(y/N)y
If the cleanup was successful, you may try again now
root@discourse-gcp1:/var/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: [2020年六月22日 17:20 UTC](https://meta.discourse.org/t/how-to-check-the-plugin-was-downloaded/155589/2 "2020-06-22T17:20:58Z")

</div>

那不是内存，而是磁盘空间。

我们的启动脚本会检查磁盘空间，如果服务器可用磁盘空间少于 5GB，则会阻止重建。托管 Discourse 的机器建议至少配备 20GB 的磁盘。

关于标题所述情况，由于重建被阻止，应用未被重建，插件也未安装。

---

<div class="post-metadata">

### Author: ![Wall-E](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wall-e/32/184438_2.png) [@Wall-E](https://meta.discourse.org/u/Wall-E)
#### Post date: [2020年六月22日 17:25 UTC](https://meta.discourse.org/t/how-to-check-the-plugin-was-downloaded/155589/3 "2020-06-22T17:25:47Z")

</div>

好的，那确实是我疏忽了。我在 [安装页面](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) 上没有看到任何具体的磁盘空间要求，所以在设置虚拟机时没有特别注意。

另外，在 app.yml 中，我看到命令 `cd: $home/plugins`，但该目录并不存在。这个命令块会自动创建该目录，还是我需要预先创建它？

---

<div class="post-metadata">

### Author: ![Wall-E](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wall-e/32/184438_2.png) [@Wall-E](https://meta.discourse.org/u/Wall-E)
#### Post date: [2020年六月22日 17:28 UTC](https://meta.discourse.org/t/how-to-check-the-plugin-was-downloaded/155589/4 "2020-06-22T17:28:58Z")

</div>

顺便提一下，我的 GCP 仪表板中，GCP 也发出了关于内存（RAM）的警告。该虚拟机最初配置为 3.75 GB，已超过 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: [2020年六月22日 17:31 UTC](https://meta.discourse.org/t/how-to-check-the-plugin-was-downloaded/155589/5 "2020-06-22T17:31:28Z")

</div>

> [@Wall-E](#):
>
> 另外，在 app.yml 中，我看到命令 `cd: $home/plugins`，但该目录并不存在。该命令块会自动创建它，还是我需要事先创建该目录？

该目录确实存在：[discourse/plugins at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/tree/master/plugins)

该命令是在容器内运行的，因此 $home 指的是镜像中的 $home。

> [@Wall-E](#):
>
> 好的，那确实是我疏忽了。我在 [安装页面](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) 上没有看到任何具体的磁盘空间要求，所以在设置虚拟机时没有注意。

哦，这可能是因为即使是最便宜的 Digital Ocean VPS 也有 25GB 的存储空间。

要不要提交一个 PR 到文档中，添加服务器推荐的最低磁盘空间要求？

---

<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: [2020年七月22日 17:31 UTC](https://meta.discourse.org/t/how-to-check-the-plugin-was-downloaded/155589/6 "2020-07-22T17:31:34Z")

</div>

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