从 Beta 3.1.x 升级到最新版本时出错

大约每 2 到 3 天进行一次升级,上次更新成功了。

今天通过 /admin/upgrade URL 进行的更新首先失败了。

然后我执行了常规操作:

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

这也导致了错误:

/var/www/discourse/vendor/bundle/ruby/3.1.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>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2023-01-20T15:27:00.834259 #1]  INFO -- : == 20230118020114 AddPublicTopicCountToTags: migrating ========
-- add_column(:tags, :public_topic_count, :integer, {:default=>0, :null=>false})
   => 0.0138s
-- execute("UPDATE tags t\nSET public_topic_count = x.topic_count\nFROM (\n  SELECT\n    COUNT(topics.id) AS topic_count,\n    tags.id AS tag_id\n  FROM tags\n  INNER JOIN topic_tags ON tags.id = topic_tags.tag_id\n  INNER JOIN topics ON topics.id = topic_tags.topic_id AND topics.deleted_at IS NULL AND topics.archetype != 'private_message'\n  INNER JOIN categories ON categories.id = topics.category_id AND NOT categories.read_restricted\n  GROUP BY tags.id\n) x\nWHERE x.tag_id = t.id\nAND x.topic_count <> t.public_topic_count;\n")

I, [2023-01-20T15:27:00.834823 #1]  INFO -- : Terminating async processes
I, [2023-01-20T15:27:00.834868 #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: 42
I, [2023-01-20T15:27:00.835173 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 103
2023-01-20 15:27:00.835 UTC [42] LOG:  received fast shutdown request
103:signal-handler (1674228420) Received SIGTERM scheduling shutdown...
2023-01-20 15:27:00.849 UTC [42] LOG:  aborting any active transactions
2023-01-20 15:27:00.851 UTC [42] LOG:  background worker "logical replication launcher" (PID 51) exited with exit code 1
2023-01-20 15:27:00.855 UTC [46] LOG:  shutting down
2023-01-20 15:27:00.901 UTC [42] LOG:  database system is shut down
103:M 20 Jan 2023 15:27:00.905 # User requested shutdown...
103:M 20 Jan 2023 15:27:00.905 * Saving the final RDB snapshot before exiting.
103:M 20 Jan 2023 15:27:00.950 * DB saved on disk
103:M 20 Jan 2023 15:27:00.950 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse &amp;&amp; su discourse -c 'bundle exec rake db:migrate' failed with return #&lt;Process::Status: pid 390 exit 1&gt;
Location of failure: /usr/local/lib/ruby/gems/3.1.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
** 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.
37cbe5dc5c82e0a41e9e1deea5b99f5e643bfe6bcd53d52c38e3e855a85ed81e

向上滚动更多,我看到一条记录:

PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_tags_on_name"
DETAIL:  Key (name)=(net) already exists.

我真的不知道如何修复/解决。

我的论坛 现在已离线。我再次运行了 sudo ./launcher rebuild app。它也失败了。

有人能给我一些关于如何解决的建议吗?

请运行 ./launcher start app 来重启旧镜像。这可能会使您的论坛恢复联机。

1 个赞

非常感谢。

容器现在又在运行了,但错误仍然存在。

很可能我遇到了和这里一样的问题:

我不会尝试用那里描述的相同方法来解决它。

更新 1 - 解决方案

好的,看起来我通过以下步骤解决了问题:

  1. 编辑了 app.yaml 并执行了以下操作:
  2. 重新构建了镜像。
  3. 激活并启动了 Data Explorer 插件,并使用 此查询 来识别重复的标签。
  4. 使用常规的管理员 GUI 来识别标签。然后重命名一个标签以使其再次唯一。
  5. 再次删除了固定的版本。
  6. 重新构建 Discourse sudo ./launcher rebuild app。现在成功了。
  7. 启动 Discourse 后,我进入了标签管理区域,并继续处理重复的标签(在将另一个标签分配给其中一个之前删除其中一个重复的标签)。
1 个赞

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