Skip to content

Instantly share code, notes, and snippets.

@jaredbeck
Created September 6, 2012 01:23
Show Gist options
  • Save jaredbeck/3649592 to your computer and use it in GitHub Desktop.
Save jaredbeck/3649592 to your computer and use it in GitHub Desktop.
Upgrading ruby on ggchapters.org

Trying to update ruby on ggchapters.org from 1.8.6 to 1.8.7

Jared Beck, 2012-09-05

  1. Couldn't deploy because bundler says: gem says: sass "requires ruby >= 1.8.7"

  2. Confirmed that production host was running 1.8.6

     $ dpkg --get-selections | grep ruby
     ruby1.8						install
     $ dpkg -L ruby1.8
     /usr/bin/ruby1.8
     $ /usr/bin/ruby1.8 --version
     ruby 1.8.6 (2007-09-24 patchlevel 111) [x86_64-linux]
    
  3. Unable to sudo .. need a sudoer

    1. Using the slicehost control panel, reset the root password
    2. Create a singlebrook user, grant sudo, grant ssh access
  4. Try to get 1.8.7 through APT

    1. sudo apt-get update whines because it's ancient
    2. Ruby 1.8.7 is not available via apt-get
    3. sudo apt-get install ruby1.8 acts like it's upgrading, but doesn't
    4. /usr/bin/ruby1.8 --version is unchanged
  5. Install from source

  6. Success

     $ ruby --version
     ruby 1.8.7 (2012-06-29 patchlevel 370) [x86_64-linux]
    
  7. However, /bin/ruby1.8 is still in place (that's 1.8.6, from APT)

    1. sudo apt-get remove ruby1.8
  8. Also, gem is outdated (1.3.7)

    1. Installed gem from source
    2. sudo gem install bundler
  9. Almost done, things are looking good

     $ ruby --version
     ruby 1.8.7 (2012-06-29 patchlevel 370) [x86_64-linux]
     $ gem --version
     1.8.24
     $ bundle --version
     Bundler version 1.2.0
    
  10. Move defunct binaries to the lost+found

     $ /usr/bin/gem --version
     -bash: /usr/bin/gem: /usr/bin/ruby1.8: bad interpreter: No such file or directory
     $ /usr/bin/bundle --version
     -bash: /usr/bin/bundle: /usr/bin/ruby1.8: bad interpreter: No such file or directory
    
     $ sudo mkdir -p /lost+found/20120905/usr/bin
     $ sudo mv /usr/bin/gem /lost+found/20120905/usr/bin
     $ sudo mv /usr/bin/bundle /lost+found/20120905/usr/bin
    
  11. The deploy gets past the bundle part now, yay! But:

     *** [err :: ggchapters.org:7722] /usr/bin/env:
     *** [err :: ggchapters.org:7722] ruby1.8
     *** [err :: ggchapters.org:7722] : No such file or directory
    
  12. So, sudo ln -s /usr/local/bin/ruby /usr/bin/ruby1.8

  13. Now the deploy gets past deploy:update_code, but:

     *** [err :: ggchapters.org:7722] /home/joe/www/staging/shared/bundle/ruby/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
    
  14. The above error is well known, see here and here

    1. Basically we must either downgrade gem below 1.6, or upgrade rails to 2.3.11 or higher.
    2. The rails upgrade was ready to go in branch rails-2-3-14
    3. Therefore, I decided to merge branch rails-2-3-14
  15. cap staging deploy is now successful

  16. However, passenger stopped working. And that's when it all fell apart.

    1. I "un-merged" the rails-2-3-14 branch,
    2. removed sass,
    3. downgraded gem to 1.4.2,
    4. and reinstalled 1.8.6 from APT
    5. I haven't removed the 1.8.7 installed from source
    6. That got passenger stared again ..

Conclusion

I don't know how to configure passenger to run on the ruby 1.8.7 that I installed from source. Passenger is definitely looking for ruby source files in the old places; the 1.8.6 places. So, we can either:

  1. learn how to configure passenger to use the ruby 1.8.7 that I installed from source, or
  2. learn how to get 1.8.7 through APT

Either way, without 1.8.7, we can't install sass, so for now we'll have to commit the compiled stylesheets into source control.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment