Deploying a Ruby on Rails Environment

Using your cPanel interface, you can create and deploy a Ruby on Rails application. It may be useful to reference the Ruby on Rails documentation during this process.

note Note: Ruby on Rails may not be available to you depending on your hosting provider's server configuration. Speak with your hosting provider for more information about using Ruby on Rails.

Creating a Ruby on Rails Application

After you are sure your website's server has a working version of Ruby that is accessible to you, you can create and deploy a Ruby on Rails environment. Ruby on Rails runs on its own server so the setup requires a little extra work.

  1. Log into cPanel.
  2. Navigate to the Software/Services section of your cPanel interface.
  3. Click the Ruby on Rails icon.
    • This step will open the Ruby on Rails management interface.
  4. Specify your application's name in the App Name field.
    • PICK Remember: To set your application to load when the server is booted, click the Load on Boot? checkbox.
  5. Assign the application path in the Application Path field.
    • note Note: If you set an application path in your public_html/ directory, your source code and configuration files can be viewed by anyone on the web.
  6. Use the Environment drop-down menu to select the type of Ruby on Rails environment you wish to run.
  7. Click Create.

Available Ruby on Rails Applications table actions:

  • To be directed to an application's Rails server, click URL to the right of the appropriate application name.
  • To run/stop an application, click Run or Stop to the right of the appropriate application name.
  • To load an application on boot, click the Load on Boot? box to the right of the appropriate application name.
  • To toggle an application between a production or development environment, click the Production or Development box to the right of the appropriate application name.
  • To delete an application, click X to the right of the appropriate application name.

Creating a Rewrite

Because Ruby on Rails uses its own server, users visiting your website (and subsequently your Ruby on Rails application) will need to be redirected to the appropriate port.

Ruby does not respond on the standard HTTP port number, 80. Thus, visitors would need to specify the port number with the domain — for example,example.com:12001.

PICK Remember: Ruby application port numbers increment automatically with every new application. This means that, if you are on a shared server, you will simply be assigned the next available port number. Your first application will not necessarily run on port 12001.

To configure Ruby to respond without visitors having to specify a port number, you will need to configure a rewrite.

To configure a rewrite:

  1. Log into cPanel.
  2. Navigate to the Software/Services section of your cPanel interface.
  3. Click the Ruby on Rails icon.
    • This step will open the Ruby on Rails management interface.
  4. Click the Create Rewrite button corresponding to the appropriate application in the Create A Rewrite table.
  5. From the drop-down menu, select the domain, subdomain, or addon domain on which you wish to run your Ruby application.
    • If you wish to run the application from a new page within your domain, type the page name you wish to use into the available text field.
  6. Click the Save button.

Current Rewrites table actions:

  • To change an application path name, type in the box to the right of the appropriate application name.
  • To save an application rewrite, click Save to the right of the appropriate application name.
  • To delete an application rewrite, click Delete to the right of the appropriate application name. Then, click Yes to confirm.

Additional Applications and Rewrites

If you intend to run multiple Ruby applications, you will need to configure additional ports to respond using Ruby on Rails and, if necessary, additional rewrites to disguise the port change. To do so, simply add an application as described in the Creating a Ruby on Rails Application section. By default, the new application will respond on the next available port number — for example, if your first application runs on port 12001, the second may run on port 12002 or higher.

PICK Remember: Ruby application port numbers increment automatically with every new application. This means that if you are on a shared server you will simply be assigned the next available port number. Your first application will not necessarily run on port 12001. This also means that your application port numbers maynot be consecutive.

To configure an additional rewrite, simply follow the steps outlined in the Creating a Rewrite section above. You will need to use a new domain, addon domain, subdomain, or page (for example: example.com/RubyApplication) for the rewrite. You will not be able to configure 2 Ruby applications to respond on the same domain, subdomain, addon domain, or page.

  • 84 Users Found This Useful
Was this answer helpful?

Related Articles

Simple CGI Wrapper

CGI scripts are pieces of software that can do many useful things for your website; for example,...

Counter (Add a Counter, Clock, or Date)

You can add a "hit counter" to your website, which tells you how many times your site has been...

Simple GuestBook

cPanel can generate a simple guestbook for your website. Guestbooks allow visitors to leave...

Clock

Using this feature, you can create a clock for your...

Countdown

You can create a countdown clock for your website. This is useful if, for example, you want to...