BuycPanel Blog

BuycPanel Blog

Latest news and updates

3/25/2015 – Ruby on Rails not Working?

Posted by Jamison on 25 03 2015.

cPanel, one of the most popular and widely-used interfaces for web hosting has a lot of additional functions that can accommodate different services and plugins. Essentially, end users can have simpler interfaces with their website through cPanel. Along with cPanel, website hosting providers can use WHM to manage accounts and security settings for all their users and accounts through a simplified user interface.

 

What is My Ruby on Rails?

 

Ruby on Rails is a web development framework that has seen a lot of adoption in the past few years after it was hailed on of the best frameworks in the market.

 

So what do I do when My Ruby on Rails Installation is not Working?

 

Here are some troubleshooting tips to help you out:

 

  1. Check your versions.

 

cPanel says that you have to first check the ruby version, rails version, ruby gem version and mongrel version. These are the current versions that cPanel allows for installation:

 

  • # ruby -v
  • ruby 1.8.7 (2009-06-08 patchlevel 173) [i686-linux]
  • # rails -v
  • Rails 2.3.8
  • # gem -v
  • 3.7
  • # gem list mongrel
  • *** LOCAL GEMS ***
  • mongrel (1.1.5)

 

According to the cPanel team, if you have newer versions than the above and installed them manually rather than using the provided script installer, the issue is likely being caused by a conflict with the version installed and our interface. cPanel does not currently support Rails 3.0.0 due to the differences in how it generates applications and how mongrel does not work with that version of Rails.

 

Newer versions of Ruby do not work with the gem installer, so if Ruby was manually updated by removing the yum exclusion line in /etc/yum.conf, then that version of Ruby would need to be uninstalled and the compatible versions installed using our script.

 

  1. Reinstall Ruby.

 

Any time you are going to reinstall Ruby (to obtain the current version we use for Ruby, Rails, Ruby Gem and Mongrel), do the following steps:

 

  • # mv /usr/lib/ruby /usr/lib/ruby.bak
  • # mv /usr/local/lib/ruby /usr/local/lib/ruby.bak
  • # mv /usr/bin/ruby /usr/bin/ruby.bak
  • # mv /usr/local/bin/ruby /usr/local/bin/ruby.bak
  • # mv /usr/bin/rails /usr/bin/rails.bak
  • # mv /usr/local/bin/rails /usr/local/bin/rails.bak
  • # mv /usr/bin/gem /usr/bin/gem.bak
  • # mv /usr/local/bin/gem /usr/local/bin/gem.bak

 

By moving the folders, you can a) revert to your prior installation if needed, and b) wipe all existing traces of your Ruby, Rails, Ruby Gem and Mongrel installation. At that point, issuing this command will then install a fresh copy of those components:

 

  • # /scripts/installruby

 

If both of these don’t work, you may have more specific problems with your Ruby on Rails installation. These may be determined by:

 

  • Checking if the Rails version is 2.3.8 or lower
  • Mongrel is not running
  • Checking the logs
  • Application is getting killed or stopping.
  • Port is not working.

 

The official cPanel documentation also offers the following help:

 

cPanel & WHM uses the standard set of tools that Ruby on Rails provides. These tools makes it easy to troubleshoot your Ruby on Rails installation:

 

  • The error_log file often shows what is wrong with the Rails installation.
  • If it is an application-specific issue, mongrel maintains its own error log file in the {appbase}/log/mongrel.log file.
  • If an application starts and fails without anything in the error_log file, the {appbase}/log/mongrel.log will probably also have an indication of the problem.

 

You may need to install some gems. You can check which gems are installed via a “gem query”:

 

  • mongrel
  • rails
  • rake

 

If you verify all of this and the application still does not start correctly, then start the mongrel server manually with the following command:

 

mongrel_rails start -p -d -e production -P log/mongrel.pid