与 DiscourseJsProcessor 有关的迁移问题?

@david,在使用 Bootstrap 时遇到问题:

I, [2023-08-24T16:50:36.568059 #1]  INFO -- : \u003e cd /var/www/discourse \u0026\u0026 su discourse -c 'bundle exec rake db:migrate'                                          
rake aborted!                                                                                                                                                                                 
Errno::ENOENT: No such file or directory @ rb_sysopen - tmp/js-processor.js                                                                                                                   
/var/www/discourse/lib/discourse_js_processor.rb:140:in `read'                                                                                                                                
/var/www/discourse/lib/discourse_js_processor.rb:140:in `create_new_context'                                                                                                                  
/var/www/discourse/lib/discourse_js_processor.rb:156:in `block in v8'                                                                                                                         
/var/www/discourse/lib/discourse_js_processor.rb:154:in `synchronize'                                                                                                                         
/var/www/discourse/lib/discourse_js_processor.rb:154:in `v8'                                                                                                                                  
/var/www/discourse/lib/discourse_js_processor.rb:169:in `block in v8_call'                                                                                                                    
/var/www/discourse/lib/discourse_js_processor.rb:168:in `synchronize'                                                                                                                         
/var/www/discourse/lib/discourse_js_processor.rb:168:in `v8_call'                                                                                                                             
/var/www/discourse/lib/discourse_js_processor.rb:193:in `perform'                                  

这与 DEV: Use esbuild to make DiscourseJsProcessor by CvX · Pull Request #23223 · discourse/discourse · GitHub 有关吗?

1 个赞

还有更多可用的堆栈跟踪吗?或者您能看到是哪个迁移触发了它吗?

2 个赞

不用担心,我和 @cvx 已经找到了问题——我们很快就会修复。

1 个赞

它奏效了!

我以为它会在几分钟前通过新的基础镜像修复,但之后又失败了一次。。。

总之,现在看起来不错。

1 个赞

好的,很高兴听到它正在工作!我们有一个鸡生蛋还是蛋生鸡的问题需要解决。在运行您链接的提交后,assets:precompile 需要在运行 db:migrate 之前至少运行一次。但反之亦然——assets:precompile 需要一个最新的数据库模式。

顺便问一下,您这里的流程是什么?您是通过 UI 进行基于 docker_manager 的升级吗?还是 ./launcher rebuild app?(或者其他什么?)

1 个赞

我话说得太早了。

它又失败了,但是……哦。但是上次数据库已经迁移过了吗?

当它成功时,我从命令行运行了 ./launcher bootstrap x

然后我用 Ansible 运行它,它执行了

      git pull && git checkout main && ./launcher bootstrap  {{ discourse_yml }} {{ launcher_args | default("")}}

(我想我需要删除 git checkout main——不确定它为什么在那里)

啊哈。但是 Ansible 会先删除数据库(这是我用于迁移的站点,所以重新开始是常有的事)。所以这与你的“鸡蛋”一致。唉。但是然后我关闭了 drop_database 并从 Ansible 运行了两次,它失败了,然后从命令行再次引导,它仍然失败。迁移中没有线索:

Installing mysql2 0.5.5 with native extensions
Bundle complete! 137 Gemfile dependencies, 173 gems now installed.
Gems in the groups 'test' and 'development' were not installed.
Bundled gems are installed into `./vendor/bundle`

I, [2023-08-24T17:24:31.403199 #1]  INFO -- : Replacing types { with set_real_ip_from 192.168.1.0/24;
set_real_ip_from 172.19.0.0/24;
set_real_ip_from 172.18.0.0/24;
set_real_ip_from 172.17.0.0/24;
set_real_ip_from 38.242.7.193/28;
real_ip_recursive on;
real_ip_header X-Forwarded-For;
types {
 in /etc/nginx/conf.d/discourse.conf
I, [2023-08-24T17:24:31.403687 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'LOAD_PLUGINS=0 bundle exec rake plugin:pull_compatible_all'
I, [2023-08-24T17:24:33.084210 #1]  INFO -- : discourse-microsoft-auth is already at latest compatible version

I, [2023-08-24T17:24:33.084593 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - tmp/js-processor.js
/var/www/discourse/lib/discourse_js_processor.rb:140:in `read'
/var/www/discourse/lib/discourse_js_processor.rb:140:in `create_new_context'
/var/www/discourse/lib/discourse_js_processor.rb:156:in `block in v8'
/var/www/discourse/lib/discourse_js_processor.rb:154:in `synchronize'
/var/www/discourse/lib/discourse_js_processor.rb:154:in `v8'
/var/www/discourse/lib/discourse_js_processor.rb:169:in `block in v8_call'
/var/www/discourse/lib/discourse_js_processor.rb:168:in `synchronize'
/var/www/discourse/lib/discourse_js_processor.rb:168:in `v8_call'
/var/www/discourse/lib/discourse_js_processor.rb:193:in `perform'
/var/www/discourse/lib/pretty_text.rb:54:in `apply_es6_file'

但是 'templates/enable-ruby-yjit.yml' 也会有问题吗?编辑:那不是问题。然后我删除了 mysql 和 import 模板。仍然没有成功。

这个问题存在了很长时间了吗?我最近升级了另一个站点,它在 ECS 上,似乎迁移时有些奇怪的事情发生,然后资产就坏了。不过,这是一个巨大的数据库,所以我以为我可能只是没有耐心,而且我手工完成了一部分过程,所以我以为我只是粗心大意了。

1 个赞

@cvx 刚刚合并了此内容,这应该可以解决相互依赖问题(一旦通过了测试):

这说得通 :+1:

我们认为,如果任何数据库迁移包含对 markdown 引擎(PrettyText)的调用,就会触发此错误。在绝大多数现有站点中,这种情况很少见。但在全新的站点上,我们会将新主题填充到数据库中,这涉及到一些 markdown 的处理。

不,只是最近几个小时(自 https://github.com/discourse/discourse/pull/23223)以来。

1 个赞

嗯,我在我的开发环境中执行 git pull 时看到了那个提交,但它仍然失败,无论是通过 ansible 运行还是本地运行(而且我没有删除数据库)。

它还没有完全通过测试,所以我预计标准安装仍然会失败。

这是一个本地的“生产”集群吗?还是开发环境?

1 个赞

这是生产环境。它使用了 Traefik 作为反向代理,但除此之外,它基本上是一个标准的安装(还有一个基于标准 postgres13 镜像构建的数据库,但它确实包含 pgvector)。

我提到我的开发环境是因为我在那里执行了 git pull,试图查看提交是否已通过测试;我在那里的 git log 中看到了 FIX: Compile js-processor before db:migrate (#23229)

我将回到之前正在测试的内容,稍后再次尝试。

我猜你们的开发环境运行在 main 分支上,所以提交才会显示出来。我们的内部 CI 在测试通过时遇到了一个障碍,但希望在 30 分钟左右就能解决 :crossed_fingers:

1 个赞

好的,现在应该可以了。请您再试一次,并告知我们结果 @pfaffman

1 个赞

我运行了一个不删除数据库的 bootstrap/deploy:成功了!

我又运行了一个 删除 了数据库的 bootstrap/deploy:也成功了!

1 个赞

更新时只有我一个人遇到黑屏吗?

您可能需要执行命令行重新构建

此主题已在 10 小时后自动关闭。不再允许回复。