Problem switch ruby versions

1 view
Skip to first unread message

MarkMT

unread,
Nov 27, 2009, 10:51:24 AM11/27/09
to merb
After moving to merb edge recently I've been attempting to redeploy my
app to a ubuntu 8.04LTS platform and in the process discovered that
the latest version of merb on github makes use of a feature of ruby
1.8.7 that isn't supported in 1.8.6, namely the String method
'start_with?' which is used in merb-assets for dealing with css file
paths.

In Ubuntu 8.04 the standard packaged version of ruby is 1.8.6. My
development machine runs Ubuntu 8.10, which comes with Ruby 1.8.7. I'm
not too eager to upgrade my server OS so I figured I would just
upgrade ruby. I found some guidance here -
http://blog.michaelgreenly.com/2009/04/multiple-versions-of-ruby-on-ubuntu-3.html
that suggested installing the new version alongside the old rather
than just getting rid of 1.8.6. Since leaving the original version in
place seemed like a more conservative approach I elected to try this.

I managed to get 1.8.7 installed ok into /opt/ruby/bin and tweaked the
path on the first line of bin/merb to point there instead of the
regular /usr/bin/ruby1.8. I have nginx running on my server in front
of mongrel. However when I start the app with 'bin/merb -c 2 -p 8000 -
e production' and point my browser at the server, I get a 404 from
nginx. 'ps' confirms that the merb processes are running.

I have also installed the latest ruby 1.8.7 build (p160) on my
development machine alongside the packaged build (p72) in the same way
I did on the server. In this case when I tweak the ruby path in bin/
merb and then start the app in either development or production mode
it runs fine and I can see it in my browser at localhost.

So I'm trying to figure out why this strategy isn't working on the
server. Does anyone have any guesses or suggestions of how I might
diagnose the problem?

I guess my next option is to install 1.8.7 on the server over the top
of 1.8.6 rather than trying to have them cohabit.

MarkMT

unread,
Nov 27, 2009, 4:04:55 PM11/27/09
to merb
Ok, I seem to have solved my problem... I removed the standard Ubuntu
ruby 1.8.6 package and installed ruby 1.8.7-p160 from source and also
reinstalled rubygems. It turned out that by default this installed
ruby into /usr/local/bin and /usr/local/lib, rather than /usr/bin and /
usr/lib where the packaged version had been installed.

I then installed the mongrel and bundler gems on the system and
initially just tried to start bin/merb in my app, but it turned out
that the bundled gems that have native extentions were looking for a
ruby .so file in the location it was when compiled previously using
the packaged 1.8.6 version of ruby. So I just redeployed the whole
app, which resulted in the bundled gems being reinstalled, presumably
using the library files generated by the new ruby installation. And
now it works!

I suspect that the incorrect library file was also the reason it
didn't work previously (when the original ruby package was still in
the system). In that case also I just started bin/merb on the server
without reinstalling the bundled gems. It was only after I removed the
original ruby that I realized the native extensions were looking for a
ruby .so file. I guess the fact that the old one was still there
before I removed ruby 1.8.6 meant that it failed silently.

Dylan Clendenin

unread,
Nov 27, 2009, 5:11:33 PM11/27/09
to me...@googlegroups.com
Hey Mark,

You probably already know about this but a lot of people have been
using rvm for managing multiple ruby versions side by side on a single
machine.

http://rvm.beginrescueend.com/

Each version of ruby will have its own gem environment, which is really nice.
> --
>
> You received this message because you are subscribed to the Google Groups "merb" group.
> To post to this group, send email to me...@googlegroups.com.
> To unsubscribe from this group, send email to merb+uns...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/merb?hl=en.
>
>
>



--
Dylan Clendenin
831.331.1484

Pavel Kunc

unread,
Nov 27, 2009, 5:22:26 PM11/27/09
to merb
Damn. Another start_with? There are some patches which made it to the
master but was not fully tested on the 1.8.6. I've fixed one of the
patches and removed the start_with. But I had to miss this one. Or are
you using 1.1.0.pre gems?

This should not be in the master. Sorry for that.

Pavel

On Nov 27, 3:51 pm, MarkMT <mark.thom...@ieee.org> wrote:
> After moving to merb edge recently I've been attempting to redeploy my
> app to a ubuntu 8.04LTS platform and in the process discovered that
> the latest version of merb on github makes use of a feature of ruby
> 1.8.7 that isn't supported in 1.8.6, namely the String method
> 'start_with?' which is used in merb-assets for dealing with css file
> paths.
>
> In Ubuntu 8.04 the standard packaged version of ruby is 1.8.6. My
> development machine runs Ubuntu 8.10, which comes with Ruby 1.8.7. I'm
> not too eager to upgrade my server OS so I figured I would just
> upgrade ruby. I found some guidance here -http://blog.michaelgreenly.com/2009/04/multiple-versions-of-ruby-on-u...

MarkMT

unread,
Nov 27, 2009, 5:29:27 PM11/27/09
to merb
> You probably already know about this but a lot of people have been
> using rvm for managing multiple ruby versions side by side on a single
> machine.
>
> http://rvm.beginrescueend.com/

Hey thanks - I did not know about that.

MarkMT

unread,
Nov 27, 2009, 5:31:37 PM11/27/09
to merb
That's ok - this was on 1.1.0.pre.
Reply all
Reply to author
Forward
0 new messages