最近在我的Ubuntu服务器上更新了从4.x到5.0.7的Passenger。遗憾的是,这打破了我的旧版应用程序之一仍在运行Rails 2.3.15,尽管Passenger声称在其新的5.x版本中支持> = Rails 2.3.x.
根据新的Passenger 5.0文档,我必须创建一个config.ru文件,之后会出现以下错误:
exit (SystemExit)
/var/www/myrailsapp/config/boot.rb:70:in `exit'
/var/www/myrailsapp/config/boot.rb:70:in `rescue in load_rails_gem'
/var/www/myrailsapp/config/boot.rb:63:in `load_rails_gem'
/var/www/myrailsapp/config/boot.rb:58:in `load_initializer'
/var/www/myrailsapp/config/boot.rb:43:in `run'
/var/www/myrailsapp/config/boot.rb:16:in `boot!'
/var/www/myrailsapp/config/boot.rb:114:in `<top (required)>'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/var/www/myrailsapp/config/environment.rb:12:in `<top (required)>'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
config.ru:1:in `block in <main>'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:107:in `eval'
/usr/share/passenger/helper-scripts/rack-preloader.rb:107:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:153:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'
崩溃(或退出)是由boot.rb中的救援引起的:
def load_rails_gem
if version = self.class.gem_version
gem 'rails', version
else
gem 'rails'
end
rescue Gem::LoadError => load_error
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or co$
exit 1
end
显然,Rails 2.3.15 gem在(仍然)安装并且在Passenger更新过程之间保持不变。由于某种原因,它不会加载Rails,我似乎无法弄清楚为什么。 'gem list'正确显示所有gems(包括rails 2.3.15),似乎Passenger通过RVM使用正确的实例。
其余的环境变量似乎也是有序的
APACHE_PID_FILE = /var/run/apache2/apache2.pid
rvm_bin_path = /usr/local/rvm/bin
GEM_HOME = /usr/local/rvm/gems/ruby-1.9.3-p551
APACHE_RUN_USER = www-data
SHELL = /bin/bash
IRBRC = /usr/local/rvm/rubies/ruby-1.9.3-p551/.irbrc
PYTHONUNBUFFERED = 1
PASSENGER_DEBUG_DIR = /tmp/passenger.spawn-debug.XXXXDL9Zb9
MY_RUBY_HOME = /usr/local/rvm/rubies/ruby-1.9.3-p551
USER = chris
_system_type = Linux
rvm_path = /usr/local/rvm
IN_PASSENGER = 1
RACK_ENV = production
PASSENGER_USE_FEEDBACK_FD = true
rvm_prefix = /usr/local
PATH = /usr/local/rvm/gems/ruby-1.9.3-p551/bin:/usr/local/rvm/gems/ruby-1.9.3-p551@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p551/bin:/usr/local/rvm/gems/ruby-1.9.3-p551/bin:/usr/local/rvm/gems/ruby-1.9.3-p551@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p551/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/rvm/bin
APACHE_LOG_DIR = /var/log/apache2
WSGI_ENV = production
PWD = /var/www/myrailsapp
LANG = C
APACHE_RUN_GROUP = www-data
NODE_PATH = /usr/share/passenger/node
_system_arch = i386
NODE_ENV = production
_system_version = 14.04
rvm_version = 1.26.10 (latest)
HOME = /home/chris
SHLVL = 0
RAILS_ENV = production
SERVER_SOFTWARE = Apache/2.4.7 (Ubuntu) SVN/1.8.8 Phusion_Passenger/5.0.7
LOGNAME = chris
GEM_PATH = /usr/local/rvm/gems/ruby-1.9.3-p551:/usr/local/rvm/gems/ruby-1.9.3-p551@global
PASSENGER_APP_ENV = production
APACHE_RUN_DIR = /var/run/apache2
APACHE_LOCK_DIR = /var/lock/apache2
RUBY_VERSION = ruby-1.9.3-p551
_system_name = Ubuntu
在config / boot.rb中注释掉救援块后,Passenger现在抛出一个新错误,阻止Rails 2.3.15正确加载:
Unable to activate actionpack-2.3.15, because rack-1.4.5 conflicts with rack (~> 1.1.3) (Gem::LoadError)
有关如何解决此问题的任何想法?如果可能的话,我宁愿在我的本地安装中修改它,而不是在RVM中创建完全独立的gemsets。
答案 0 :(得分:0)
解决此依赖性冲突的最佳方法是在RVM中为我的旧Rails 2.3站点创建一个单独的GemSet。
虽然我需要从Gemfile之前的项目中重新安装所有必需的宝石,但我确信这是未来的最佳解决方案。