简体   繁体   English

乘客配置未从 rvm 默认设置 ruby 版本

[英]passenger-config not set ruby version from rvm default

I have upgraded ruby version from 2.3.1 to 3.0.2 and also done related changes.我已将 ruby 版本从 2.3.1 升级到 3.0.2 并进行了相关更改。 On server, after deployment, nginx server cant start and giving error for old version.在服务器上,部署后,nginx 服务器无法启动,老版本报错。

I have checked ruby version with login user in ubuntu and rvm list, new 3.0.2 version is set as default version.我在 ubuntu 和 rvm 列表中检查了 ruby 版本和登录用户,新的 3.0.2 版本设置为默认版本。

Error log: 
App 7441 stdout:
App 7441 stdout:
[ E 2021-10-19 03:59:51.9761 5027/T49 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/apprunner/application/current: An error occurred while starting up the preloader.
  Error ID: c6399257
  Error details saved to: /tmp/passenger-error-J6lyAl.html
  Message from application: You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/lockfile_parser.rb:72:in `warn_for_outdated_bundler_version'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/lockfile_parser.rb:59:in `initialize'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/definition.rb:61:in `new'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/definition.rb:61:in `initialize'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/dsl.rb:173:in `new'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/dsl.rb:173:in `to_definition'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/dsl.rb:11:in `evaluate'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/definition.rb:24:in `build'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler.rb:120:in `definition'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler.rb:88:in `setup'
  /usr/local/rvm/gems/ruby-2.3.0@application/gems/bundler-1.11.2/lib/bundler/setup.rb:18:in `<top (required)>'
  /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:456:in `activate_gem'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:323:in `block in run_load_path_setup_code'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:461:in `running_bundler'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:322:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
[ E 2021-10-19 03:59:51.9814 5027/T7 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 1-25] Cannot checkout session because a spawning error occurred. The identifier of the error is c6399257. Please see earlier logs for details about the error.

Don't know why error is show version 2.3.0?不知道为什么错误是显示版本 2.3.0?

How to set ruby version to passenger from rvm?如何从rvm将ruby版本设置为乘客?

passenger check ruby command gives two different output: Command: passenger-config about ruby-command乘客检查 ruby 命令给出两个不同的 output: 命令:passenger-config about ruby-command

  1. With Sudo user (rvm command not detected):使用 Sudo 用户(未检测到 rvm 命令):

 root@ip-:/usr/bin# passenger-config about ruby-command passenger-config was invoked through the following Ruby interpreter: Command: /usr/bin/ruby2.3 Version: ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu] To use in Apache: PassengerRuby /usr/bin/ruby2.3 To use in Nginx: passenger_ruby /usr/bin/ruby2.3 To use with Standalone: /usr/bin/ruby2.3 /usr/bin/passenger start The following Ruby interpreter was found first in $PATH: Command: /usr/bin/ruby Version: ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu] To use in Apache: PassengerRuby /usr/bin/ruby To use in Nginx: passenger_ruby /usr/bin/ruby To use with Standalone: /usr/bin/ruby /usr/bin/passenger start

  1. System user(login user where rvm command detected):系统用户(检测到 rvm 命令的登录用户):

 current$ passenger-config about ruby-command Your RVM wrapper scripts are too old, or some wrapper scripts are missing. Please update/regenerate them first by running: rvmsudo rvm get stable && rvm reload && rvmsudo rvm repair all If that doesn't seem to work, please run: rvmsudo rvm wrapper ruby-3.0.2 --no-prefix --all

Please provide any clue, how to set passenger ruby default version or how to solve this error.请提供任何线索,如何设置乘客 ruby 默认版本或如何解决此错误。

As passenger is designed to server multiple (Rails) applications on one webserver, there are config options per virtual host (actually per dirctory) to set the environment for each application.由于乘客被设计为在一个网络服务器上为多个(Rails)应用程序提供服务,因此每个虚拟主机(实际上是每个目录)都有配置选项来设置每个应用程序的环境。

see https://www.phusionpassenger.com/docs/references/config_reference/apache/ and https://www.phusionpassenger.com/docs/references/config_reference/nginx/请参阅https://www.phusionpassenger.com/docs/references/config_reference/apache/https://www.phusionpassenger.com/docs/references/config_reference/nginx/

RVM installs wrappers for each installed ruby in ie ~/.rvm/wrappers/ruby-3.0.2/ruby and you can tell passenger to use this ruby for your application. RVM 为每个已安装的 ruby 安装包装器,即 ~/.rvm/wrappers/ruby-3.0.2/ruby,您可以告诉乘客将此 ruby 用于您的应用程序。

in an apache config, you can write:在 apache 配置中,您可以编写:

<Directory "/path/to/you/rails/app">
  PassengerRuby "/home/your-user/.rvm/wrappers/3.0.2/ruby"
  RailsEnv production
</Directory>

passenger-config tells you what wrapper to use, but you must set the ruby environment first.乘客配置告诉你使用什么包装器,但你必须首先设置 ruby 环境。 My passenger-config outputs this comment:我的乘客配置输出此评论:

Notes for RVM users RVM 用户注意事项

Do you want to know which command to use for a different Ruby interpreter?您想知道哪个命令用于不同的 Ruby 解释器吗? 'rvm use' that Ruby interpreter, then re-run 'passenger-config about ruby-command'. 'rvm use' Ruby 解释器,然后重新运行'passenger-config about ruby-command'。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM