使用rvm升级Ruby和Rails后,Phusion Passenger会抛出错误

时间:2011-12-05 19:18:02

标签: ruby-on-rails ruby ruby-on-rails-3.1 rvm passenger

我最近将我的Rails设置升级到3.1.3,并且我遇到了Phusion Passenger在此服务器上加载旧应用程序的问题。我在测试应用程序上运行了一切,但我仍然遇到这个应用程序的问题。当我在端口3000上运行Webrick服务器时,我的应用程序运行完美,但在尝试通过虚拟主机访问它时,我继续遇到乘客错误。这是信息:

乘客抛出错误

Ruby (Rack) application could not be started

错误消息:

Could not find activesupport-3.0.7 in any of the sources (Bundler::GemNotFound)

异常类:

PhusionPassenger::UnknownError

应用程序根目录:

/home/admin/rails/bnkpics

回溯:

    #   File    Line    Location
    0   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/spec_set.rb  88  in `materialize'
    1   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/spec_set.rb  82  in `map!'
    2   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/spec_set.rb  82  in `materialize'
    3   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/definition.rb    90  in `specs'
    4   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/definition.rb    135 in `specs_for'
    5   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/definition.rb    124 in `requested_specs'
    6   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/environment.rb   23  in `requested_specs'
    7   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb   11  in `setup'
    8   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler.rb   110 in `setup'
    9   /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb 326 in `prepare_app_process'
    10  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb  156 in `initialize_server'
    11  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb 572 in `report_app_init_status'
    12  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb  154 in `initialize_server'
    13  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb   204 in `start_synchronously'
    14  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb   180 in `start'
    15  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb  129 in `start'
    16  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb 253 in `spawn_rack_application'
    17  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb    132 in `lookup_or_add'
    18  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb 246 in `spawn_rack_application'
    19  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb    82  in `synchronize'
    20  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb    79  in `synchronize'
    21  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb 244 in `spawn_rack_application'
    22  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb 137 in `spawn_application'
    23  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb 275 in `handle_spawn_application'
    24  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb   357 in `__send__'
    25  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb   357 in `server_main_loop'
    26  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb   206 in `start_synchronously'
    27  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server  99  

服务器信息(Rackspace Cloud Server)

  • 经销商ID:Ubuntu
  • 描述:Ubuntu 10.04.3 LTS
  • 发布:10.04
  • 代号:清醒

Ruby和Rails版本

  • ruby -v = ruby​​ 1.9.3p0(2011-10-30修订版33570)[x86_64-linux]
  • rails -v = Rails 3.1.3
  • rvm -v = rvm 1.9.2 by Wayne E. Seguin(wayneeseguin@gmail.com)[https://rvm.beginrescueend.com/]

Ruby和Rails位置

  • which ruby = /home/admin/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
  • which rails = /home/admin/.rvm/gems/ruby-1.9.3-p0@rails313/bin/rails
  • which rvm = /home/admin/.rvm/bin/rvm
  • which passenger = /usr/bin/passenger

宝石清单

的结果
    *** LOCAL GEMS ***

    abstract (1.0.0)
    actionmailer (3.1.3, 3.0.7)
    actionpack (3.1.3, 3.0.7)
    activemodel (3.1.3, 3.0.7)
    activerecord (3.1.3, 3.0.7)
    activeresource (3.1.3, 3.0.7)
    activesupport (3.1.3, 3.0.7)
    arel (2.2.1, 2.0.10)
    builder (3.0.0, 2.1.2)
    bundler (1.0.21)
    carrierwave (0.5.8)
    erubis (2.7.0, 2.6.6)
    hike (1.2.1)
    i18n (0.6.0, 0.5.0)
    jquery-rails (1.0.19)
    json (1.6.3)
    mail (2.3.0, 2.2.19)
    mime-types (1.17.2)
    mini_magick (3.3)
    multi_json (1.0.4)
    polyglot (0.3.3)
    rack (1.3.5, 1.2.4)
    rack-cache (1.1)
    rack-mount (0.8.3, 0.6.14)
    rack-ssl (1.3.2)
    rack-test (0.6.1, 0.5.7)
    rails (3.1.3, 3.0.7)
    railties (3.1.3, 3.0.7)
    rake (0.9.2.2)
    rdoc (3.11)
    rubygems-update (1.8.12, 1.8.11)
    sprockets (2.1.2, 2.0.3)
    sqlite3 (1.3.5)
    subexec (0.2.0, 0.1.0)
    thor (0.14.6)
    tilt (1.3.3)
    treetop (1.4.10)
    tzinfo (0.3.31)

捆绑列表的结果

Gems included by the bundle:
  * abstract (1.0.0)
  * actionmailer (3.0.7)
  * actionpack (3.0.7)
  * activemodel (3.0.7)
  * activerecord (3.0.7)
  * activeresource (3.0.7)
  * activesupport (3.0.7)
  * arel (2.0.10)
  * builder (2.1.2)
  * bundler (1.0.21)
  * carrierwave (0.5.8)
  * erubis (2.6.6)
  * i18n (0.5.0)
  * jquery-rails (1.0.19)
  * mail (2.2.19)
  * mime-types (1.17.2)
  * mini_magick (3.3)
  * polyglot (0.3.3)
  * rack (1.2.4)
  * rack-mount (0.6.14)
  * rack-test (0.5.7)
  * rails (3.0.7)
  * railties (3.0.7)
  * rake (0.9.2.2)
  * sqlite3 (1.3.5)
  * subexec (0.1.0)
  * thor (0.14.6)
  * treetop (1.4.10)
  * tzinfo (0.3.31)

rvm info的结果

    ruby-1.9.3-p0@rails313:

      system:
        uname:       "Linux ror-stack 2.6.35.4-rscloud #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 GNU/Linux"
        bash:        "/bin/bash => GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)"
        zsh:         " => not installed"

      rvm:
        version:      "rvm 1.9.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"

      ruby:
        interpreter:  "ruby"
        version:      "1.9.3p0"
        date:         "2011-10-30"
        platform:     "x86_64-linux"
        patchlevel:   "2011-10-30 revision 33570"
        full_version: "ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]"

      homes:
        gem:          "/home/admin/.rvm/gems/ruby-1.9.3-p0@rails313"
        ruby:         "/home/admin/.rvm/rubies/ruby-1.9.3-p0"

      binaries:
        ruby:         "/home/admin/.rvm/rubies/ruby-1.9.3-p0/bin/ruby"
        irb:          "/home/admin/.rvm/rubies/ruby-1.9.3-p0/bin/irb"
        gem:          "/home/admin/.rvm/rubies/ruby-1.9.3-p0/bin/gem"
        rake:         "/home/admin/.rvm/gems/ruby-1.9.3-p0@rails313/bin/rake"

      environment:
        PATH:         "/home/admin/.rvm/gems/ruby-1.9.3-p0@rails313/bin:/home/admin/.rvm/gems/ruby-1.9.3-p0@global/bin:/home/admin/.rvm/rubies/ruby-1.9.3-p0/bin:/home/admin/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
        GEM_HOME:     "/home/admin/.rvm/gems/ruby-1.9.3-p0@rails313"
        GEM_PATH:     "/home/admin/.rvm/gems/ruby-1.9.3-p0@rails313:/home/admin/.rvm/gems/ruby-1.9.3-p0@global"
        MY_RUBY_HOME: "/home/admin/.rvm/rubies/ruby-1.9.3-p0"
        IRBRC:        "/home/admin/.rvm/rubies/ruby-1.9.3-p0/.irbrc"
        RUBYOPT:      ""
        gemset:       "rails313"

Gemfile内容

    source 'http://rubygems.org'

    gem 'rails'

    # Bundle edge Rails instead:
    # gem 'rails', :git => 'git://github.com/rails/rails.git'

    gem 'sqlite3'

    gem 'jquery-rails', '>= 1.0.3'

    gem 'carrierwave'

    gem 'mini_magick'

    gem 'rake'

    gem 'activesupport'

apache.conf中的Passenger设置

    LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
    PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11
    PassengerRuby /usr/bin/ruby1.8

/ etc / apache2 / sites-enabled

中的App Config
    <VirtualHost 174.143.141.247:81>

      RailsEnv      development
      DocumentRoot /home/admin/rails/bnkpics/public
      <Directory /home/admin/rails/bnkpics/public>
          AllowOverride all
          Options -MultiViews
       </Directory>
      ServerName  174.143.141.247
      NameVirtualHost 174.143.141.247:81

    </VirtualHost>

/etc/apache2/ports.conf

的内容
    NameVirtualHost *:80
    Listen 80
    Listen 81
    # Listen 82
    # Listen 83

    <IfModule mod_ssl.c>
        # If you add NameVirtualHost *:443 here, you will also have to change
        # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
        # to <VirtualHost *:443>
        # Server Name Indication for SSL named virtual hosts is currently not
        # supported by MSIE on Windows XP.
        Listen 443
    </IfModule>

    <IfModule mod_gnutls.c>
        Listen 443
    </IfModule>

捆绑列表的结果

    Using rake (0.9.2.2) 
    Using abstract (1.0.0) 
    Using activesupport (3.0.7) 
    Using builder (2.1.2) 
    Using i18n (0.5.0) 
    Using activemodel (3.0.7) 
    Using erubis (2.6.6) 
    Using rack (1.2.4) 
    Using rack-mount (0.6.14) 
    Using rack-test (0.5.7) 
    Using tzinfo (0.3.31) 
    Using actionpack (3.0.7) 
    Using mime-types (1.17.2) 
    Using polyglot (0.3.3) 
    Using treetop (1.4.10) 
    Using mail (2.2.19) 
    Using actionmailer (3.0.7) 
    Using arel (2.0.10) 
    Using activerecord (3.0.7) 
    Using activeresource (3.0.7) 
    Using bundler (1.0.21) 
    Using carrierwave (0.5.8) 
    Using thor (0.14.6) 
    Using railties (3.0.7) 
    Using jquery-rails (1.0.19) 
    Using subexec (0.1.0) 
    Using mini_magick (3.3) 
    Using rails (3.0.7) 
    Using sqlite3 (1.3.5) 
    Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

我尽可能地包括在内,因为在这一点上,我不知道去哪里打猎。任何人都能看到我错过的东西吗?我仍然是使用rvm和Rails 3.1.3的新手,所以我确信这很简单。我可以提供任何其他信息来帮助解决此问题吗?我需要一个答案,因为这是一个客户端的应用程序,它已经运行了一段时间但当然没有使用,直到我打破它的那一天。任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:12)

您没有在Apache配置中使用RVM ruby​​,在您的apache中指向旧系统版本

 LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
 PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11
 PassengerRuby /usr/bin/ruby1.8

你需要使用RVM已安装的1.9.3,最简单的方法是再次安装乘客宝石并查看输出,当它编译时它会给你正确的conf,我看起来像:

LoadModule passenger_module /Users/admin/.rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /Users/admin/.rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.9
PassengerRuby /Users/admin/.rvm/wrappers/ruby-1.9.3-p0/ruby