1

I'm struggling to get passenger+rvm+apache+rails working. When opening the page, I get the following error-message from 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'

I don't understand, what this error-message is trying to tell me. It's confusing that it seems to refer to ruby-1.9.1 where as rvm should map to 1.9.2-p180.

Any help, pointers or next steps to find our more are welcome.

$GEM_PATH

with ssh on remote machine: $echo $GEM_PATH /home/pixtur/.rvm/gems/ruby-1.9.2-p180@pixtur-org:/home/pixtur/.rvm/gems/ruby-1.9.2-p180@global

Current 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,  "[email protected]"
#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/config

---
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"
8
  • Is your $GEM_PATH correctly set? Are you specifying a specific Capistrano path in your Gemfile? May 22, 2012 at 9:44
  • Is there any more info int the log filer? how does your deploy.rb look? maybe you get mixed up bundle directories somehow May 22, 2012 at 9:45
  • Also do you have a .bundle directory in your app root? if so how does .bundle/config look like? May 22, 2012 at 9:47
  • @Samy: I check the local path and edited the original question. Interestingly, I get an error when accepting the local .rvmrc trying "cap shell": /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem capistrano (>= 0) (Gem::LoadError)
    – pixtur
    May 22, 2012 at 10:08
  • @Matthias: Yes, .bundle exists. I added the content of the two files above.
    – pixtur
    May 22, 2012 at 10:09

1 Answer 1

0

the problem comes from your Gemfile,

1) you need to move gem 'rvm-capistrano' to the development group - this way it will be not installed to shared/bundle.

2) are you by any chance using gem 'rvm-capistrano', :lib => 'rvm/capistrano', the lib part is not required, actually most likely it is breaking things.

Before deploying again you should clear the shared/bundle on server.

1
  • Thanks a lot. That fixed my problem. I didn't do rails for some year and still don't really get why installing rvm-capistrano as a shared gem is causing harm, but actually, I don't really want to know :-)
    – pixtur
    May 26, 2012 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.