由于 ruby gem 不兼容,重建失败

注意:我将我的容器命名为 containers/polyf.yml
discourse-doctor 完全无法处理这种情况…

$ ./launcher rebuild polyf
...
I, [2023-04-06T09:50:45.464717 #1]  INFO -- : cd /var/www/discourse & su discourse -c 'bundle install --deployment --retry 3 --jobs 4 --verbose --without test development'
[DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local deployment 'true'`, and stop using this flag
[DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local without 'test development'`, and stop using this flag
Bundler::PathError: The path `/var/www/discourse/vendor/bundle/ruby/2.7.0/bundler/gems/sprockets-f4d3dae71ef2` does not exist.
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/source/path.rb:209:in `load_spec_files'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/source/git.rb:205:in `load_spec_files'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/source/path.rb:107:in `local_specs'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/source/git.rb:172:in `specs'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/lazy_specification.rb:82:in `materialize_for_installation'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/spec_set.rb:195:in `map!'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/spec_set.rb:195:in `specs_for_dependency'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/spec_set.rb:33:in `block in for'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/spec_set.rb:22:in `loop'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/spec_set.rb:22:in `for'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/spec_set.rb:79:in `materialize'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/definition.rb:209:in `missing_specs'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/definition.rb:213:in `missing_specs?'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/installer.rb:255:in `resolve_if_needed'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/installer.rb:82:in `block in run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/process_lock.rb:12:in `block in lock'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/process_lock.rb:9:in `open'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/process_lock.rb:9:in `lock'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/installer.rb:71:in `run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/installer.rb:23:in `install'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/cli/install.rb:62:in `run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/cli.rb:260:in `block in install'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/settings.rb:131:in `temporary'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/cli.rb:259:in `install'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/cli.rb:34:in `dispatch'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/cli.rb:28:in `start'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/exe/bundle:45:in `block in <top (required)>'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/exe/bundle:33:in `<top (required)>'
  /usr/local/bin/bundle:25:in `load'
  /usr/local/bin/bundle:25:in `<main>'
Bundler::InstallError: sass-embedded-1.60.0-x86_64-linux requires rubygems version >= 3.3.22, which is incompatible with the current version, 3.3.20
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/installer.rb:237:in `block in ensure_specs_are_compatible!'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/spec_set.rb:155:in `each'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/spec_set.rb:155:in `each'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/installer.rb:231:in `ensure_specs_are_compatible!'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/installer.rb:83:in `block in run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/process_lock.rb:12:in `block in lock'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/process_lock.rb:9:in `open'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/process_lock.rb:9:in `lock'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/installer.rb:71:in `run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/installer.rb:23:in `install'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/cli/install.rb:62:in `run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/cli.rb:260:in `block in install'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/settings.rb:131:in `temporary'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/cli.rb:259:in `install'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/cli.rb:34:in `dispatch'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/cli.rb:28:in `start'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/exe/bundle:45:in `block in <top (required)>'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
  /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.4.4/exe/bundle:33:in `<top (required)>'
  /usr/local/bin/bundle:25:in `load'
  /usr/local/bin/bundle:25:in `<main>'
I, [2023-04-06T09:50:56.916061 #1]  INFO -- : Running `bundle install --deployment --jobs 4 --retry 3 --verbose --without "test" "development"` with bundler 2.4.4
Frozen, using resolution from the lockfile
The definition is missing dependencies, failed to resolve & materialize locally (https://github.com/rails/sprockets (at 3.x@f4d3dae) is not yet checked out. Run `bundle install` first.)
Frozen, using resolution from the lockfile
...
2023-04-06 09:50:56.935 UTC [47] LOG:  shutting down
2023-04-06 09:50:56.970 UTC [43] LOG:  database system is shut down
104:M 06 Apr 2023 09:50:57.012 # User requested shutdown...
104:M 06 Apr 2023 09:50:57.012 * Saving the final RDB snapshot before exiting.
104:M 06 Apr 2023 09:50:57.036 * DB saved on disk
104:M 06 Apr 2023 09:50:57.036 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse & su discourse -c 'bundle install --deployment --retry 3 --jobs 4 --verbose --without test development' failed with return #<Process::Status: pid 367 exit 5>
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"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --retry 3 --jobs 4 --verbose --without test development'"]}
bootstrap failed with exit code 5
** 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.
82f1cada0a0c138a0834f1682f3475590d0e28f179b243c4f0d54ae7043515bb

不知何故,你的 Ruby 版本是 2.7.0,而我的版本是 3.2.0。也许你应该展示你完整的日志——有些东西没有更新成功。通常的顺序是

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

(虽然在你的情况下,不是 app,而是 polyf)

在附近的一个帖子里:

4 个赞

我运行的是 Debian [stable](目前是 11 版,代号 bullseye),其标准的 Ruby 包是 2.7.0 版本:Debian -- Details of package ruby in bullseye

考虑到 ./launcher 在重建时已经执行了 git pull

我有点惊讶 git pull 竟然是必需的。不过,我现在尝试进行一次之前的 git pull,它确实获取了一些修改,所以我不太确定为什么启动器会获取那些……嗯,我会看看情况如何,然后再向你反馈。

1 个赞

我认为重要的是 Docker 容器内的 Ruby 版本,如果镜像已按预期更新,那么该版本应该没问题。如果您运行的版本与 tests-passed 不同,那么您的镜像可能已过时,在这种情况下,问题可能是与过新的插件不兼容。在这种情况下,注释掉您的插件可以缩小范围,找出哪个插件与您故意使用的旧 Discourse 不兼容。

3 个赞

也许你处于一个不干净的 git 状态或旧的 master 分支上?

2 个赞

使用“git pull”,重建工作得心应手。

@Falco,我确实还在旧的主分支上。现在我在新的主分支上……我不太确定那是什么时候发生的,很有可能是一个 launcher 的重复运行在后台完成了这个操作(我确实看到里面有一些代码会在你处于主分支时进行切换)。

算了,我将这次升级称为“魔法”,不再深究,因为现在我的 discourse 实例运行得很顺利。

谢谢大家(即使只是精神上的)支持!

2 个赞

另外,我从版本 2.9.0.beta9 升级了。也许这会有所不同……

1 个赞

我认为这告诉我们 git pull 是关于什么的——它会在你运行启动器之前更新启动器本身。我以前不知道这一点。

1 个赞

@JammyDodger,谢谢。我还没发现“解决方案”按钮。

[记录]

1 个赞

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