Yesterday I was trying to fix the readline console issue (slow copy/paste in irb), which I wasn't able to fix - but also must have messed something up bad with my rvm setup.
Ubuntu 11.10.
First my problem: Can't load the website through virtual host, only script/server. When loading through virtualhost, I get this:
Missing the Rails 2.1.0 gem. Please `gem install -v=2.1.0 rails`,
update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails
version you do have installed, or comment out RAILS_GEM_VERSION to use
the latest version installed.
Gem list shows (edited for clarity - note that both mysql, rails 2.1, and passenger show in the list - it is grabbing from both global and myapp21 gemsets):
tom@DEVPC2:/var/www/myapp$ gem list
*** LOCAL GEMS ***
....
actionmailer (2.1.0)
actionpack (2.1.0)
activerecord (2.1.0)
activeresource (2.1.0)
activesupport (2.1.0)
bundler (1.0.21)
capistrano (2.9.0)
mysql (2.8.1)
passenger (3.0.11)
rack (1.3.5)
rails (2.1.0)
rake (0.9.2.2)
...
So, here are the things I have tried so far:
I have completely removed all gemsets, rubys (only have one, 1.8.7), and then rvm itself. Reinstalled from the guide. Added passenger, bundler (not using for this project), and capistrano to gemset global. Installed passenger module for apache2 (passenger-install-apache2-module), followed instructions to add the load passenger stuff to /etc/apache2/apache2.conf:
LoadModule passenger_module /home/tom/.rvm/gems/ruby-1.8.7-p352@global/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /home/tom/.rvm/gems/ruby-1.8.7-p352@global/gems/passenger-3.0.11
PassengerRuby /home/tom/.rvm/wrappers/ruby-1.8.7-p352@global/ruby
Then: rvm gemset create myapp21 - proceeded to install rails 2.1.0, mysql, other gems to the gemset.
Set up myapp/.rvmrc:
rvm use ruby-1.8.7-p352@myapp21
And config/setup_load_paths.rb:
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."
end
end
I have my virtualhost:
tom@DEVPC2:/var/www/myapp$ cat /etc/apache2/sites-enabled/myapp.local
<VirtualHost *:80>
ServerName myapp.local
RailsEnv development
DocumentRoot /var/www/myapp/public
<Directory /var/www/myapp/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
Now some info:
tom@DEVPC2:/var/www/myapp$ rvm info
ruby-1.8.7-p352@myapp21:
system:
uname: "Linux DEVPC2 3.0.0-13-generic-pae #22-Ubuntu SMP Wed Nov 2 15:17:35 UTC 2011 i686 i686 i386 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.2.10(1)-release (i686-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.10.0-pre by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.8.7"
date: "2011-06-30"
platform: "i686-linux"
patchlevel: "2011-06-30 patchlevel 352"
full_version: "ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]"
homes:
gem: "/home/tom/.rvm/gems/ruby-1.8.7-p352@myapp21"
ruby: "/home/tom/.rvm/rubies/ruby-1.8.7-p352"
binaries:
ruby: "/home/tom/.rvm/rubies/ruby-1.8.7-p352/bin/ruby"
irb: "/home/tom/.rvm/rubies/ruby-1.8.7-p352/bin/irb"
gem: "/home/tom/.rvm/rubies/ruby-1.8.7-p352/bin/gem"
rake: "/home/tom/.rvm/gems/ruby-1.8.7-p352@global/bin/rake"
environment:
PATH: "/home/tom/.rvm/gems/ruby-1.8.7-p352@myapp21/bin:/home/tom/.rvm/gems/ruby-1.8.7-p352@global/bin:/home/tom/.rvm/rubies/ruby-1.8.7-p352/bin:/home/tom/.rvm/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
GEM_HOME: "/home/tom/.rvm/gems/ruby-1.8.7-p352@myapp21"
GEM_PATH: "/home/tom/.rvm/gems/ruby-1.8.7-p352@myapp21:/home/tom/.rvm/gems/ruby-1.8.7-p352@global"
MY_RUBY_HOME: "/home/tom/.rvm/rubies/ruby-1.8.7-p352"
IRBRC: "/home/tom/.rvm/rubies/ruby-1.8.7-p352/.irbrc"
RUBYOPT: ""
gemset: "myapp21"
Using script/server allows me to load to localhost:3000 (or whatever port specified). But I can't load myapp.local, which just yesterday I was able to do - it tells me rails is missing.
What I believe is happening: Passenger is loading ruby, the virtual host stuff is still working, but for some reason it's not grabbing the directives from setup_load_paths to load my gemsets based on the rvmrc (I am not entirely sure if this is what happens, but if it is, it's not doing it).
My next step is a clean install. JUST got this machine all set up, don't want to waste my weekend on that.
I went back at it and removed the passenger gem, installed it to global, etc. No luck.
Went back to the guide and copied the setup_load_paths and .rvmrc exactly (well, and changed to suit my paths), which now works. I guess I had something wrong there.