# 错误：您运行的是旧版本的 Discourse 镜像

**URL:** <https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860>\
**Category:** Self-hosting\
**Created:** [2021年五月2日 04:15 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860 "2021-05-02T04:15:35Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![nelly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nelly/32/204450_2.png) [@nelly](https://meta.discourse.org/u/nelly)\
**Post date:** [2021年五月2日 04:15 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/1 "2021-05-02T04:15:35Z")

</div>

大家好，这是我的第一个主题帖！我是 Nelly Eggsy，正在使用 Ghost 和 Discourse 搭建网站。

我通常只是潜水浏览论坛，在幕后阅读各个主题。如果遇到问题，我会先在论坛里搜索答案，通常都能解决。但这次我卡住了，需要帮助。

通过管理界面升级 Discourse 后，我收到了以下提示：

> 您正在运行旧版本的 Discourse 镜像。  
> 在运行最新镜像之前，通过 Web 界面进行的升级将被禁用。

为此，请通过 SSH 登录您的服务器并运行以下命令：

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

```

我按照[指南](https://meta.discourse.org/t/how-do-i-manually-update-discourse-and-docker-image-to-latest/23325)中介绍的方法，使用控制台命令将 Discourse 和 Docker 镜像升级到最新版本。然而，由于出现错误，升级未能成功。

以下是我运行 **./launcher rebuild app** 命令时收到的错误信息：

```plaintext
> FAILED
> --------------------
> Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 671 exit 1>
> Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
> exec failed with the params {"cd"=>"$home", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'bundle exec rake themes:update assets:precompile'"]}
> 9c3a1b4a72818216aaafa5de742f7d1a325aa61497ea49f5b4f1660c6e503fd0
> **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.

```

我的 Digital Ocean 实例配置为 2 GB 内存 / 50 GB 磁盘 + 50 GB，位于 SFO2 区域，运行的是 Ubuntu 20.04 上的 Discourse。

感谢您抽出时间阅读我的帖子！期待收到您的回复。

---

<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:** [2021年五月2日 14:01 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/2 "2021-05-02T14:01:25Z")

</div>

欢迎，@nelly！很抱歉您遇到了问题！ ~~这是一个巨大的意外。~~ 编辑：这有点意外。

您是否使用了任何自定义插件或主题？

---

<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年五月2日 16:09 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/3 "2021-05-02T16:09:43Z")

</div>

> [@nelly](#):
>
> 请向上滚动并查看之前的错误信息

能否请您向上滚动并将实际的错误信息粘贴到这里？

---

<div class="post-metadata">

**Author:** ![nelly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nelly/32/204450_2.png) [@nelly](https://meta.discourse.org/u/nelly)\
**Post date:** [2021年五月2日 20:24 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/4 "2021-05-02T20:24:58Z")

</div>

> [@nelly](#):
>
> ```plaintext
> git pull
> ./launcher rebuild app
> 
> ```

谢谢，@pfaffman！感谢你的回复。是的，我有几个自定义主题和插件。

以下是我安装的插件：

> ```
> - git clone https://github.com/discourse/docker_manager.git
> - git clone https://github.com/paviliondev/discourse-custom-wizard.git
> - git clone https://github.com/discourse/discourse-spoiler-alert.git
> - git clone https://github.com/paviliondev/discourse-landing-pages.git
> - git clone https://github.com/discourse/discourse-patreon.git
> - git clone https://github.com/discourse/discourse-reactions.git
> 
> ```

我不确定如何访问或删除自定义主题。

---

<div class="post-metadata">

**Author:** ![nelly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nelly/32/204450_2.png) [@nelly](https://meta.discourse.org/u/nelly)\
**Post date:** [2021年五月2日 20:27 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/5 "2021-05-02T20:27:24Z")

</div>

Rafael,

这是我看到的“失败”错误上方的内容：

```
rake aborted!
NameError: undefined local variable or method `name' for main:Object
/var/www/discourse/lib/tasks/assets.rake:251:in `rescue in block (2 levels) in <main>'
/var/www/discourse/lib/tasks/assets.rake:240:in `block (2 levels) in <main>'

由以下原因引起：
OpenURI::HTTPError: 401 Error: Invalid license key
/var/www/discourse/lib/file_helper.rb:63:in `block in download'
/var/www/discourse/lib/final_destination.rb:422:in `block (3 levels) in safe_get'
/var/www/discourse/lib/final_destination.rb:421:in `catch'
/var/www/discourse/lib/final_destination.rb:421:in `block (2 levels) in safe_get'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-2.3.2/lib/patches/net_patches.rb:19:in `block in request_with_mini_profiler'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-2.3.2/lib/mini_profiler/profiling_methods.rb:46:in `step'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-2.3.2/lib/patches/net_patches.rb:18:in `request_with_mini_profiler'
/var/www/discourse/lib/final_destination.rb:393:in `block in safe_get'
/var/www/discourse/lib/final_destination.rb:437:in `block in safe_session'
/var/www/discourse/lib/final_destination.rb:434:in `safe_session'
/var/www/discourse/lib/final_destination.rb:385:in `safe_get'
/var/www/discourse/lib/final_destination.rb:134:in `get'
/var/www/discourse/lib/file_helper.rb:55:in `download'
/var/www/discourse/lib/discourse_ip_info.rb:39:in `mmdb_download'
/var/www/discourse/lib/tasks/assets.rake:242:in `block (3 levels) in <main>'
/var/www/discourse/lib/tasks/assets.rake:241:in `each'
/var/www/discourse/lib/tasks/assets.rake:241:in `block (2 levels) in <main>'
Tasks: TOP => assets:precompile
(通过运行任务并添加 --trace 参数可查看完整堆栈跟踪)
I, [2021-05-02T20:17:42.823237 #1] INFO -- : 正在下载 MaxMindDB...
正在压缩 JavaScript 并生成源映射

```

希望这能帮到你。提前感谢！

---

<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:** [2021年五月2日 23:25 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/6 "2021-05-02T23:25:04Z")

</div>

我想你需要再往上滚动一点。那个许可证密钥消息是针对 MaxMind 的，我不认为那是问题所在。

---

<div class="post-metadata">

**Author:** ![nelly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nelly/32/204450_2.png) [@nelly](https://meta.discourse.org/u/nelly)\
**Post date:** [2021年五月3日 01:10 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/7 "2021-05-03T01:10:39Z")

</div>

Jay,

这是输出结果。我对其进行了大量精简，以便论坛允许我发布。

```
2021-05-03 00:32:20.635 UTC [63] postgres@postgres ERROR: 数据库 "discourse" 已存在
2021-05-03 00:32:20.635 UTC [63] postgres@postgres STATEMENT: CREATE DATABASE discourse;
createdb: 错误：数据库创建失败：ERROR: 数据库 "discourse" 已存在
I, [2021-05-03T00:32:20.639714 #1] INFO -- : 
I, [2021-05-03T00:32:20.640335 #1] INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2021-05-03 00:32:20.760 UTC [74] postgres@discourse ERROR: 角色 "discourse" 已存在
2021-05-03 00:32:20.760 UTC [74] postgres@discourse STATEMENT: create user discourse;
ERROR: 角色 "discourse" 已存在

I, [2021-05-03T00:32:21.634456 #1] INFO -- : 文件 > /etc/service/redis/run chmod: +x chown: 
I, [2021-05-03T00:32:21.640838 #1] INFO -- : 文件 > /etc/service/redis/log/run chmod: +x chown: 
I, [2021-05-03T00:32:21.646998 #1] INFO -- : 文件 > /etc/runit/3.d/10-redis chmod: +x chown: 
I, [2021-05-03T00:32:21.648588 #1] INFO -- : 在 /etc/redis/redis.conf 中将 daemonize yes 替换为 
I, [2021-05-03T00:32:21.650175 #1] INFO -- : 在 /etc/redis/redis.conf 中将 (?-mix:^pidfile.*$) 替换为 
I, [2021-05-03T00:32:21.651303 #1] INFO -- : > install -d -m 0755 -o redis -g redis /shared/redis_data
I, [2021-05-03T00:32:21.656597 #1] INFO -- : 
I, [2021-05-03T00:32:21.657900 #1] INFO -- : 在 /etc/redis/redis.conf 中将 (?-mix:^logfile.*$) 替换为 logfile ""
I, [2021-05-03T00:32:21.659157 #1] INFO -- : 在 /etc/redis/redis.conf 中将 (?-mix:^bind .*$) 替换为 
I, [2021-05-03T00:32:21.660353 #1] INFO -- : 在 /etc/redis/redis.conf 中将 (?-mix:^dir .*$) 替换为 dir /shared/redis_data
I, [2021-05-03T00:32:21.661652 #1] INFO -- : 在 /etc/redis/redis.conf 中将 (?-mix:^protected-mode yes) 替换为 protected-mode no
I, [2021-05-03T00:32:21.662825 #1] INFO -- : 在 /etc/redis/redis.conf 中将 # io-threads 4 替换为 io-threads $redis_io_threads
I, [2021-05-03T00:32:21.663908 #1] INFO -- : > echo redis installed
I, [2021-05-03T00:32:21.668192 #1] INFO -- : redis installed
I, [2021-05-03T00:32:21.669144 #1] INFO -- : > cat /etc/redis/redis.conf | grep logfile
I, [2021-05-03T00:32:21.679111 #1] INFO -- : logfile ""
I, [2021-05-03T00:32:21.680077 #1] INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2021-05-03T00:32:21.683045 #1] INFO -- : > sleep 10
167:C 03 May 2021 00:32:21.698 # oO0OoO0OoO0Oo Redis 正在启动 oO0OoO0OoO0Oo
167:C 03 May 2021 00:32:21.698 # Redis 版本=6.2.1, bits=64, commit=00000000, modified=0, pid=167, 刚刚启动
167:C 03 May 2021 00:32:21.699 # 配置已加载
167:M 03 May 2021 00:32:21.700 * 单调时钟：POSIX clock_gettime
167:M 03 May 2021 00:32:21.702 * 运行模式=独立，端口=6379。
167:M 03 May 2021 00:32:21.702 # 服务器已初始化
167:M 03 May 2021 00:32:21.703 # 警告：overcommit_memory 设置为 0！在低内存条件下，后台保存可能会失败。要修复此问题，请在 /etc/sysctl.conf 中添加 'vm.overcommit_memory = 1'，然后重启或运行命令 'sysctl vm.overcommit_memory=1' 使其生效。
I, [2021-05-03T00:32:41.096190 #1] INFO -- : > cd /var/www/discourse && bash -c "touch -a /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log"
terser '/var/www/discourse/public/assets/_vendor-892d5a1f7dfb58e3f80950989c67133fd6062344153d17e67db8ba3d126c7a1a.js' -m -c -o '/var/www/discourse/public/assets/vendor-892d5a1f7dfb58e3f80950989c67133fd6062344153d17e67db8ba3d126c7a1a.js' --source-map "base='/var/www/discourse/public/assets',root='/assets',url='/assets/vendor-892d5a1f7dfb58e3f80950989c67133fd6062344153d17e67db8ba3d126c7a1a.js.map'"
****************************************************************************************************
#<Thread:0x000055a7feb17780 /var/www/discourse/lib/tasks/assets.rake:239 run> 因异常终止（report_on_exception 为 true）：
/var/www/discourse/lib/tasks/assets.rake:251:in `rescue in block (2 levels) in <main>': 未定义的局部变量或方法 `name' for main:Object (NameError)
	from /var/www/discourse/lib/tasks/assets.rake:240:in `block (2 levels) in <main>'
/var/www/discourse/lib/file_helper.rb:63:in `block in download': 401 错误：无效的许可证密钥 (OpenURI::HTTPError)

```

希望这能帮到你！

---

<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年五月3日 01:32 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/8 "2021-05-03T01:32:08Z")

</div>

> [@nelly](#):
>
> 错误：无效的许可证密钥

你的 app.yml 中是否有 MaxMind 许可证密钥的行？尝试删除该行并重新构建。

---

<div class="post-metadata">

**Author:** ![nelly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nelly/32/204450_2.png) [@nelly](https://meta.discourse.org/u/nelly)\
**Post date:** [2021年五月3日 02:52 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/9 "2021-05-03T02:52:13Z")

</div>

谢谢！这似乎有点效果。当我访问论坛主页时，它把我带到了“恭喜，您已安装 Discourse！”页面。我有以下问题：

我需要重新安装论坛吗？ **我现有的内容会保留，还是全部被删除了？**

---

<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:** [2021年五月3日 15:00 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/10 "2021-05-03T15:00:11Z")

</div>

听起来好像所有内容都被删除了，但它们很可能还在。这是您很久以来的第一次更新吗？您的 PostgreSQL 是否已更新？我最大的猜测是 PostgreSQL 更新过程中出现了问题，您需要将 `postgres_old` 重命名并重新开始。有关详细信息，请参阅 [PostgreSQL 13 更新](https://meta.discourse.org/t/postgresql-13-update/172563)。

---

<div class="post-metadata">

**Author:** ![nelly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nelly/32/204450_2.png) [@nelly](https://meta.discourse.org/u/nelly)\
**Post date:** [2021年五月3日 17:31 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/11 "2021-05-03T17:31:52Z")

</div>

Jay，我（刚刚）想起来，我曾尝试将上传文件和备份迁移到 DigitalOcean 块存储。刚才我再次尝试操作时，访问主页收到了“哎呀”错误提示：

> 哎呀  
> 驱动此讨论论坛的软件遇到了意外问题。对此给您带来的不便，我们深表歉意。
> 
> 有关该错误的详细信息已记录在案，并生成了自动通知。我们将对此进行检查。
> 
> 无需采取进一步操作。但如果该错误持续存在，您可以通过在站点的反馈类别中发布讨论主题，提供额外细节，包括复现错误的步骤。

以下是我所执行的命令：

```
mv /var/discourse/shared/standalone/postgres_data /var/postgres_data_discourse
mv /var/discourse/shared /mnt/discourse-sfo2-01

```

在 app.yml 中，我添加了以下内容：

```
## Docker 容器是无状态的；所有数据都存储在 /shared 中
volumes:
  - volume:
      host: /mnt/discourse-sfo2-01/shared/standalone
      guest: /shared
  - volume:
      host: /mnt/discourse-sfo2-01/shared/standalone/log/var-log
      guest: /var/log
  - volume:
      host: /var/postgres_data_discourse
      guest: /shared/postgres_data

```

所有命令在执行 ./launcher rebuild app 时均顺利运行，未出现异常。

非常抱歉，大家。我忘记自己曾做过这些操作。我确信这很可能就是导致问题的原因。

---

<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:** [2021年五月4日 08:50 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/12 "2021-05-04T08:50:02Z")

</div>

> [@Falco](#):
>
> 你的 app.yml 中是否有 MaxMind 许可证密钥的行？尝试删除它并重新构建。

这也为我解决了问题，之前构建失败了——这里是什么问题？谢谢！

---

<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:** [2021年六月3日 08:50 UTC](https://meta.discourse.org/t/error-you-are-running-an-old-version-of-the-discourse-image/188860/13 "2021-06-03T08:50:26Z")

</div>

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