使用 New Relic 插件重建 Discourse Docker 镜像时出错

我们已将 Discourse docker 升级到 master 分支,并尝试为最新更新重新构建 Docker 镜像,但现在遇到了常量名称错误的报错。请查看下方的堆栈跟踪:

1:  rails_multisite (2.0.7) from /var/www/discourse/vendor/bundle/ruby/2.6.0/specifications/rails_multisite-2.0.7.gemspec
Bundle complete! 120 Gemfile dependencies, 157 gems now installed.
Gems in the groups test and development were not installed.
Bundled gems are installed into `./vendor/bundle`
I, [2019-09-24T05:09:04.662043 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
NameError: wrong constant name [[:error, ["detected unsupported rails version 6.0.0"], nil]]
/var/www/discourse/plugins/new_relic-discourse/gems/2.6.4/gems/newrelic_rpm-5.4.0.347/lib/new_relic/control/class_methods.rb:52:in `const_get'
/var/www/discourse/plugins/new_relic-discourse/gems/2.6.4/gems/newrelic_rpm-5.4.0.347/lib/new_relic/control/class_methods.rb:52:in `load_framework_class'
/var/www/discourse/plugins/new_relic-discourse/gems/2.6.4/gems/newrelic_rpm-5.4.0.347/lib/new_relic/control/class_methods.rb:32:in `new_instance'
/var/www/discourse/plugins/new_relic-discourse/gems/2.6.4/gems/newrelic_rpm-5.4.0.347/lib/new_relic/control/class_methods.rb:13:in `instance'
/var/www/discourse/plugins/new_relic-discourse/plugin.rb:9:in `activate!'
/var/www/discourse/lib/plugin/instance.rb:494:in `instance_eval'
/var/www/discourse/lib/plugin/instance.rb:494:in `activate!'
lib/discourse.rb:171:in `block in activate_plugins!'
lib/discourse.rb:168:in `each'
lib/discourse.rb:168:in `activate_plugins!'
/var/www/discourse/config/application.rb:261:in `<class:Application>'
/var/www/discourse/config/application.rb:58:in `<module:Discourse>'
/var/www/discourse/config/application.rb:57: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.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)
I, [2019-09-24T05:09:12.600060 #1]  INFO -- : gem install newrelic_rpm -v 5.4.0.347 -i /var/www/discourse/plugins/new_relic-discourse/gems/2.6.4 --no-document --ignore-dependencies --no-user-install
Successfully installed newrelic_rpm-5.4.0.347
1 gem installed
I, [2019-09-24T05:09:12.600340 #1]  INFO -- : Terminating async processes
I, [2019-09-24T05:09:12.600566 #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/10/bin/postmaster -D /etc/postgresql/10/main pid: 50
I, [2019-09-24T05:09:12.600630 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 167
167:signal-handler (1569301752) Received SIGTERM scheduling shutdown...
2019-09-24 05:09:12.600 UTC [50] LOG:  received fast shutdown request
2019-09-24 05:09:12.603 UTC [50] LOG:  aborting any active transactions
2019-09-24 05:09:12.606 UTC [50] LOG:  worker process: logical replication launcher (PID 59) exited with exit code 1
2019-09-24 05:09:12.607 UTC [54] LOG:  shutting down
2019-09-24 05:09:12.626 UTC [50] LOG:  database system is shut down
167:M 24 Sep 2019 05:09:12.656 # User requested shutdown...
167:M 24 Sep 2019 05:09:12.656 * Saving the final RDB snapshot before exiting.
167:M 24 Sep 2019 05:09:13.094 * DB saved on disk
167:M 24 Sep 2019 05:09:13.094 # 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 423 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
772fd9749450a9f60c0342e5a823426fb81efb1ab8a83546cc38fdfddd5d8cc6
** 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.

尝试移除第三方插件,看看这是否导致重建失败。
尝试运行 ./discourse-doctor,看看它是否给出任何建议。

我通过升级 new_relic 插件的版本解决了这个问题。
谢谢!

我遇到了完全相同的错误,但始终无法解决。

我的 app.yml 文件中包含:

  NEW_RELIC_LICENSE_KEY: xxxxxxxx
  NEW_RELIC_APP_NAME: xxxxxxxx

而(仅用于测试实例)只有:

        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/davidcelis/new_relic-discourse.git

您具体是如何操作的?

你可以通过覆盖环境变量来定义要使用的新版本 gem:
NEW_RELIC_AGENT_VERSION=6.6.0.358,这将覆盖 New Relic 版本。

谢谢!完美运行。