Ubuntu上的Rails3.2 + Passenger3 + Apache2 + RVM

时间:2012-05-22 09:20:20

标签: ruby-on-rails ubuntu rvm passenger rvm-capistrano

我很难让乘客+ rvm + apache + rails工作。打开页面时,我从Passenger收到以下错误消息:


Ruby (Rack) application could not be started
These are the possible causes:
There may be a syntax error in the application's code. Please check for such errors and fix them.
A required library may not installed. Please install all libraries that this application requires.
The application may not be properly configured. Please check whether all configuration files are written correctly, fix any incorrect configurations, and restart this application.
A service that the application relies on (such as the database server or the Ferret search engine server) may not have been started. Please start that service.
Further information about the error may have been written to the application's log file. Please check it in order to analyse the problem.

Error message:
uninitialized constant Capistrano
Exception class:
NameError
Application root:
/var/www/www.pixtur.org/rails/current
Backtrace:
    File    Line    Location
0   /var/www/www.------------.----/rails/shared/bundle/ruby/1.9.1/gems/rvm-capistrano-1.2.0/lib/rvm/capistrano.rb   3   in `'
1   /home/pixtur/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.1.3/lib/bundler/runtime.rb 74  in `require'
2   /home/pixtur/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.1.3/lib/bundler/runtime.rb 74  in `rescue in block in require'
3   /home/pixtur/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.1.3/lib/bundler/runtime.rb 62  in `block in require'
4   /home/pixtur/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.1.3/lib/bundler/runtime.rb 55  in `each'
5   /home/pixtur/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.1.3/lib/bundler/runtime.rb 55  in `require'
6   /home/pixtur/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.1.3/lib/bundler.rb 119 in `require'

我不明白,这条错误消息试图告诉我什么。令人困惑的是它似乎引用了ruby-1.9.1,其中rvm应映射到1.9.2-p180。

欢迎任何帮助,指示或下一步找到我们的更多信息。

$ GEM_PATH

在远程机器上使用ssh:  $ echo $ GEM_PATH  /home/pixtur/.rvm/gems/ruby-1.9.2-p180@pixtur-org:/home/pixtur/.rvm/gems/ruby-1.9.2-p180@global

当前deploy.rb

require "bundler/capistrano"

set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system

# Load RVM's capistrano plugin:
require "rvm/capistrano"

set :user, 'pixtur'
set :domain, 'www.--------------.com'
set :applicationdir, "/var/www/www.somedomain.com/rails"

set :scm, 'git'
set :repository,  "gitosis@------------------.git"
#set :git_enable_submodules, 1 # if you have vendored rails
set :branch, 'master'
set :git_shallow_clone, 1
set :scm_verbose, true

set :deploy_to, applicationdir
set :use_sudo, false

#set :scm, :git
role :app, domain
role :web, domain
role :db,  domain, :primary => true

# additional settings
default_run_options[:pty] = true  # Forgo errors when deploying from windows

namespace :deploy do
  task :start, :roles => :app do
    run "touch #{current_release}/tmp/restart.txt"
  end

  task :stop, :roles => :app do
  end

  task :restart, :roles => :app do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end

  desc "Install bundler"
  task :bundle_install do
    begin
      run "bundle install"
    rescue
      gem_install_bundler
    end
  end  

end

.bundle /配置

---
BUNDLE_FROZEN: '1'
BUNDLE_PATH: /var/www/www.----------.---/rails/shared/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'
BUNDLE_WITHOUT: development:test

.rvmrc

if [[ -s "/Users/pixtur/.rvm/environments/ruby-1.9.2-p180@pixtur-org" ]] ; then
  . "/Users/pixtur/.rvm/environments/ruby-1.9.2-p180@pixtur-org"
else
  rvm --create use  "ruby-1.9.2-p180@pixtur-org"

1 个答案:

答案 0 :(得分:0)

问题来自你的Gemfile,

1)您需要将gem 'rvm-capistrano'移至开发小组 - 这样它就不会安装到shared/bundle

2)你是否有机会使用gem 'rvm-capistrano', :lib => 'rvm/capistrano',lib部分不是必需的,实际上很可能是破坏了它。

在再次部署之前,您应该清除服务器上的shared/bundle