My basic stack set-up is Ubuntu 10.04 Lucid, with Apache2 and Rails 3.x (see below). It also uses a MySQL database running on a dedicated server, so I only need MySQL client on the Rails server, and I'm using the mysql2 gem.
I'm upgrading a Rails app to from Rails 3.0 to Rails 3.2, all going reasonably well (a few code changes and some re-org of assets), except I need to upgrade from Ruby 1.8.7 to a later version for the mail gem.
I thought I'd skip over Ruby 1.9.3, and jump straight to Ruby 2.0.0.
I'm also biting the bullet, and adopting rvm to manage the ruby environment, and am also updating to Passenger 4 as it says this plays better with rvm, and also because I have another Rails app that I'd like to leave on Ruby 1.8.7 for the time being.
All has been going reasonably well too - everything seems to installed without error during the installation process.
I have added a .ruby-version file (specifying 2.0.0) at the top of the app directory hierarchy, and this seems to be effective.
I also have .ruby-gemset in the same directory, specifying an application name, and I've installed the necessary gems using bundle install.
However, when I restart Apache, and try to access the Rails app, I get an error reported by Passenger on the returned web page,
Web application could not be started
/home/username/.rvm/gems/ruby-2.0.0-p481@myapp/gems/mysql2-0.3.16/lib/mysql2/mysql2.so: [BUG] Segmentation fault ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
It appears that the Rails app (or Passenger) is picking up the rvm environment correctly, but then using an incompatible version of mysql2 that has a Ruby 1.8.7 dependency.
I've tried many things to fix this,
Ideally, I'd like to have have mysql2 supported with with both Ruby 1.8.7 and 2.0.0 apps simultaneously, but I'd also settle for just getting mysql2 to work with a later version of Ruby.
Suggestions appreciated.
You should set PassengerRuby in app's virtual host as it is written in rvm doc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With