# 重建升级失败，并出现 DB Migrate (Postgres 问题？)

**URL:** https://meta.discourse.org/t/rebuild-upgrade-failing-with-db-migrate-postgres-issue/247190
**Category:** Self-hosting
**Created:** [2022年十一月30日 11:22 UTC](https://meta.discourse.org/t/rebuild-upgrade-failing-with-db-migrate-postgres-issue/247190 "2022-11-30T11:22:10Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![JamesNorth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesnorth/32/283740_2.png) [@JamesNorth](https://meta.discourse.org/u/JamesNorth)
#### Post date: [2022年十一月30日 11:22 UTC](https://meta.discourse.org/t/rebuild-upgrade-failing-with-db-migrate-postgres-issue/247190/1 "2022-11-30T11:22:10Z")

</div>

嘿，各位，

我的一个重建因数据库迁移问题而失败——我多年来一直在对这个安装进行持续的重建，所以想知道是不是有什么东西太旧了？

我想知道是否可以从构建日志的末尾提取一些信息，或者我需要往上追溯？

非常感谢任何帮助！

```plaintext
I, [2022-11-30T10:15:55.248687 #1] INFO -- : cd /var/www/discourse & su discourse -c 'bundle exec rake db:migrate'
rake aborted!
[discourse-signatures] Handlebars templates can no longer be included via `register_asset`.
Any hbs files under `assets/javascripts` will be automatically compiled and included."
/var/www/discourse/lib/plugin/instance.rb:590:in `register_asset'
/var/www/discourse/plugins/discourse-signatures/plugin.rb:48:in `activate!'
/var/www/discourse/lib/plugin/instance.rb:677:in `instance_eval'
/var/www/discourse/lib/plugin/instance.rb:677:in `activate!'
/var/www/discourse/lib/discourse.rb:314:in `block in activate_plugins!'
/var/www/discourse/lib/discourse.rb:311:in `each'
/var/www/discourse/lib/discourse.rb:311:in `activate_plugins!'
/var/www/discourse/config/application.rb:212:in `block in <class:Application>'
/var/www/discourse/lib/plugin.rb:6:in `initialization_guard'
/var/www/discourse/config/application.rb:211:in `<class:Application>'
/var/www/discourse/config/application.rb:82:in `<module:Discourse>'
/var/www/discourse/config/application.rb:81:in `<top (required)>'
/var/www/discourse/Rakefile:7:in `require'
/var/www/discourse/Rakefile:7:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
(See full trace by running task with --trace)
I, [2022-11-30T10:15:56.291184 #1] INFO -- : 
I, [2022-11-30T10:15:56.292222 #1] INFO -- : Terminating async processes
I, [2022-11-30T10:15:56.292556 #1] INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 41
I, [2022-11-30T10:15:56.292812 #1] INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 102
2022-11-30 10:15:56.293 UTC [41] LOG: received fast shutdown request
102:signal-handler (1669803356) Received SIGTERM scheduling shutdown...
2022-11-30 10:15:56.300 UTC [41] LOG: aborting any active transactions
2022-11-30 10:15:56.306 UTC [41] LOG: background worker "logical replication launcher" (PID 50) exited with exit code 1
2022-11-30 10:15:56.308 UTC [45] LOG: shutting down
2022-11-30 10:15:56.340 UTC [41] LOG: database system is shut down
102:M 30 Nov 2022 10:15:56.383 # User requested shutdown...
102:M 30 Nov 2022 10:15:56.384 * Saving the final RDB snapshot before exiting.
102:M 30 Nov 2022 10:15:56.481 * DB saved on disk
102:M 30 Nov 2022 10:15:56.482 # Redis is now ready to exit, bye bye...

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse & su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 1433 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1

```

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2022年十一月30日 11:47 UTC](https://meta.discourse.org/t/rebuild-upgrade-failing-with-db-migrate-postgres-issue/247190/2 "2022-11-30T11:47:36Z")

</div>

~~我倾向于认为这可能是 `discourse-signatures` 插件的问题，因为顶部的代码行。您能否尝试在不使用该插件的情况下重建，看看是否有效？~~

实际上，这让我想起了前几天发生的事情：

> [@Error updating](https://meta.discourse.org/t/error-updating/246652/22?u=jammydodger):
>
> Signatures fix is now merged. I found a couple more non-official plugins that have the same issue - PRs opened on [discourse-nationalflags](https://github.com/Ebsy/discourse-nationalflags/pull/25) (cc @ebs) and [browser\_history](https://github.com/SamSaffron/browser_history/pull/2) (cc @sam). I’ve also added a [more useful error message](https://github.com/discourse/discourse/pull/19185) in core so that it’s easier to identify the problem if there are any more plugins with the issue.

您能否再尝试重建一次，看看是否只是一个小故障？

---

<div class="post-metadata">

### Author: ![JamesNorth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesnorth/32/283740_2.png) [@JamesNorth](https://meta.discourse.org/u/JamesNorth)
#### Post date: [2022年十一月30日 12:24 UTC](https://meta.discourse.org/t/rebuild-upgrade-failing-with-db-migrate-postgres-issue/247190/3 "2022-11-30T12:24:47Z")

</div>

我之前确实试了三次……我可以试试注释掉签名插件再试一次。

我会回来报告的。

---

<div class="post-metadata">

### Author: ![JamesNorth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesnorth/32/283740_2.png) [@JamesNorth](https://meta.discourse.org/u/JamesNorth)
#### Post date: [2022年十一月30日 12:36 UTC](https://meta.discourse.org/t/rebuild-upgrade-failing-with-db-migrate-postgres-issue/247190/4 "2022-11-30T12:36:12Z")

</div>

非常感谢 @JammyDodger！

我注释掉了该插件，它成功完成了重建。

在另一个帖子中，他们似乎已经提交了一个修复程序……如果我在 aml 文件中重新启用它并再次尝试，它可能会起作用吗？

否则，目前我可以没有它。

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2022年十一月30日 12:40 UTC](https://meta.discourse.org/t/rebuild-upgrade-failing-with-db-migrate-postgres-issue/247190/5 "2022-11-30T12:40:53Z")

</div>

discourse-signatures 的最新版本应该已经修复了该问题。您是否在使用该插件的其他分支/fork？🤔 您能否分享一下 `app.yml` 中的 signatures 行？

---

<div class="post-metadata">

### Author: ![JamesNorth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesnorth/32/283740_2.png) [@JamesNorth](https://meta.discourse.org/u/JamesNorth)
#### Post date: [2022年十一月30日 13:36 UTC](https://meta.discourse.org/t/rebuild-upgrade-failing-with-db-migrate-postgres-issue/247190/6 "2022-11-30T13:36:18Z")

</div>

我不知道是什么时候添加的，所以我不确定它有多旧/是哪个分支，但它是这样的：

`#- git clone https://github.com/xfalcox/discourse-signatures.git`

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2022年十一月30日 13:39 UTC](https://meta.discourse.org/t/rebuild-upgrade-failing-with-db-migrate-postgres-issue/247190/7 "2022-11-30T13:39:10Z")

</div>

我明白了。如果你将其更新到官方的 `https://github.com/discourse/discourse-signatures`，它应该会运行得更好。

@Falco 我想我们应该做些什么来帮助人们迁移到官方仓库。也许我们可以让 GitHub 重定向你原来的仓库副本？如果不行，也许我们可以做类似这样的事情：

> <https://github.com/discourse/discourse-slack-official/blob/3d2a0210cd/plugin.rb#L14-L16>

---

<div class="post-metadata">

### Author: ![JamesNorth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesnorth/32/283740_2.png) [@JamesNorth](https://meta.discourse.org/u/JamesNorth)
#### Post date: [2022年十一月30日 13:43 UTC](https://meta.discourse.org/t/rebuild-upgrade-failing-with-db-migrate-postgres-issue/247190/8 "2022-11-30T13:43:37Z")

</div>

那将太棒了。

很有可能我当时在论坛上添加了一些非常前沿的功能，这些功能后来已经稳定下来并包含在主版本中，可能会在以后做同样的事情。

感谢您迅速的努力！

---

<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: [2022年十二月30日 13:43 UTC](https://meta.discourse.org/t/rebuild-upgrade-failing-with-db-migrate-postgres-issue/247190/9 "2022-12-30T13:43:52Z")

</div>

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