Ruby On Rails Documentation

Requirements

There are a few major requirements for installing Ruby on Rails on a cPanel server. First, cPanel11 must be running on the server. This can be verified by checking at the version number in the upper right-hand corner of WHM. Installing Ruby on Rails in cPanel does require some command line interaction, so you will need to make sure that you can login to your server via SSH as root. Furthermore, cPanel requires that your server contains a working yum configuration. You can check this before trying to install Ruby by running "yum list ruby" from SSH, if it works without error, you should be fine.

Installation

The installation of Ruby on Rails in cPanel has two parts, first is installing Ruby itself, which can be accomplished by running /scripts/installruby.  This script will install Ruby, RubyGems, Mongrel and the software that Ruby relies upon and activates the Ruby interface in your end user's cPanel. The second step in the installation is running /usr/local/cpanel/bin/ror_setup. This script will setup Ruby on Rails so that it will be activated when your system starts.

Deploying An RoR Environment

Now that you have installed Ruby on Rails, you will want to deploy your first application environment. Ruby on Rails works in a different manner from most of the web application languages used on cPanel servers. Ruby runs a separate server other than Apache for serving Ruby on Rails web applications, so setup for this requires a little more work. First you will need to login to your cPanel and click on the Ruby on Rails icon, to bring up the Ruby on Rails management interface that allows you to setup your Ruby environments. At this point you will need to give your application a name and setup it's path.

NOTE: You set this path inside of your public_html directory your application's source code and configuration files can be viewable by anyone on the web.

Once you have deployed your first environment, we will of course want to turn it on by clicking on the run icon next to the "Application's Name" in the "Manage Ruby on Rail's" interface. If this worked successfully you should seeing "running" under "status" and you should be able to click the URL icon under the Rails Server column and see a page that looks similar to this:

This page means that the environment is up and running, and for the rest of your Ruby on Rail's application installation you will need to consult the application's installation guide.

If you pay close attention to the URL used for the application, you will see that it has a number like :12001 at the end of it, this is because Ruby on Rails does not use the standard Apache web server, but rather uses it's own called Mongrel. We can change these to be user-friendly. You will need to create a new subdomain or addon domain in cpanel, then click on the create rewrite button next to the rails application name in cPanel, select the desired domain name from the drop down box, and now, whenever you go to this domain it will display the RoR application.

Basic Rails Troubleshooting

Since Ruby on Rails uses it's own web server, it has to run this web server on an alternate port and this causes an issue if you are running a firewall on your system. You will need to ensure that port 12001 and up are open (we recommend making the max number of the open ports 12001+ whatever the number of Ruby applications you expect to be running will be).

Sometimes the gems repos will go down, if this happens during the installation you will need to re-run /scripts/installruby