I recently started using Passenger and Ruby Enterprise Edition to run my Rails apps.
“It was just another day at the office, until suddenly…” I wanted to run Warehouse. It turns out that things get (just) slightly hairy when you need to use the native bindings for a library, in this case Subversion/SWIG.
I ran rake warehouse:bootstrap without incident, but as soon as I submitted the ‘install’ form, it died. This is what I found in the log:
ActionView::TemplateError (/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:478:in `const_missing': uninitialized constant Repository::Svn) on line #23 of repositories/index.html.erb: 20:
Naturally I had installed the bindings using sudo apt-get install libsvn-ruby1.8 so they were available to the default Ruby (located in /usr/lib/ruby), but not Ruby Enterprise Edition (located in /opt/ruby-enterprise), which the application runs on.
My solution was to simply symlink the Subversion bindings into Ruby Enterprise Edition. A quick look in the libsvn-ruby package (sudo dpkg -L libsvn-ruby1.8) shows us what we’re dealing with:
... /usr/lib/ruby/1.8/i486-linux /usr/lib/ruby/1.8/i486-linux/svn /usr/lib/ruby/1.8/i486-linux/svn/ext /usr/lib/ruby/1.8/i486-linux/svn/ext/core.so /usr/lib/ruby/1.8/i486-linux/svn/ext/client.so /usr/lib/ruby/1.8/i486-linux/svn/ext/delta.so /usr/lib/ruby/1.8/i486-linux/svn/ext/fs.so /usr/lib/ruby/1.8/i486-linux/svn/ext/ra.so /usr/lib/ruby/1.8/i486-linux/svn/ext/repos.so /usr/lib/ruby/1.8/i486-linux/svn/ext/wc.so /usr/lib/ruby/1.8/svn /usr/lib/ruby/1.8/svn/client.rb /usr/lib/ruby/1.8/svn/core.rb /usr/lib/ruby/1.8/svn/delta.rb /usr/lib/ruby/1.8/svn/error.rb /usr/lib/ruby/1.8/svn/fs.rb /usr/lib/ruby/1.8/svn/info.rb /usr/lib/ruby/1.8/svn/ra.rb /usr/lib/ruby/1.8/svn/repos.rb /usr/lib/ruby/1.8/svn/util.rb /usr/lib/ruby/1.8/svn/wc.rb ...
The key directories are: /usr/lib/ruby/1.8/i486-linux/svn and /usr/lib/ruby/1.8/svn. So we’ll make them available to /opt/ruby-enterprise like so:
cd /opt/ruby-enterprise/lib/ruby/1.8 sudo ln -s /usr/lib/ruby/1.8/svn cd /opt/ruby-enterprise/lib/ruby/site_ruby/1.8/i686-linux sudo ln -s /usr/lib/ruby/1.8/i486-linux/svn
After that, just restart Apache (apache2ctl restart), and it should be working. Note, a simple touch tmp/restart.txt won’t work, because that doesn’t reload the libraries. You actually need the /opt/ruby-enterprise/ruby process to restart.
Theoretically this same approach should work for any native bindings you need to be available to Ruby Enterprise Edition.
Posted in Linux, Rails, Ruby, Subversion, Tips and Tricks, Ubuntu.
– October 13, 2008
Thank you, this post helped me out!
I had the exact same problem and this helped me out a lot. Thanks!