Rails3.2+Passenger3+Apache2+RVM on Ubuntu

513 views Asked by At

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"
1

There are 1 answers

1
mpapis On BEST ANSWER

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.