The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Ruby on Rails basic deployment

Discussion in 'General Discussion' started by ddeo, Nov 18, 2009.

  1. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Hi, I am starting to learn some of the basics of Ruby on Rails and was hoping to use my Cpanel server for the development environment to learn. I was able to follow this guide and it works:
    Getting Started with Rails

    In this guide I create the app and a MySQL database and then start the server with 'script/server' and then when going to mywebsite.com:3000 it works perfectly.

    My question is why doesn't the cpanel interface recognize the app running (or not running for that matter)? If I go to cpanel/software/services/ruby on rails there are no apps listed.

    I tried creating an app via the cpanel and it is created ok and then I can create a rewrite, but when I browse to it says 'We're sorry, but something went wrong.'

    The cpanel interface assumes that you want to use sqlite3 and I don't believe I have this installed. So I tried converting it to mysql by creating a new config/database.yml file and then running rake db:create and rake db:migrate. These ran with out error but the app running in the browser is still not functioning..

    Can anyone point me in the right direction? Thanks, Ddeo
     
  2. mickbeng

    mickbeng Well-Known Member

    Joined:
    Oct 3, 2006
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Penang, Malaysia
    Ddeo,

    You may try to checkout the ruby log from the apps folder.
     
  3. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Hi, I checked the production.log and here are the last entries:

    Code:
    Processing ProductsController#index (for xxx.xxx.xxx.xxx at 2009-11-20 07:21:48) [GET]
      Parameters: {"action"=>"index", "controller"=>"products"}
    
    ActiveRecord::StatementInvalid (Mysql::Error: Table 'mystore.taxonomies' doesn't exist: SELECT * FROM `taxonomies` ):
      spree (0.9.2) app/controllers/application.rb:92:in `instantiate_controller_and_action_names'
      compass (0.8.17) lib/compass/app_integration/rails/action_controller.rb:7:in `process'
      /usr/lib/ruby/gems/1.8/gems/haml-edge-2.3.86/lib/sass/plugin/rack.rb:44:in `call'
    
    Rendering /home/xxx/rails_apps/mystore/public/500.html (500 Internal Server Error)
    
    It looks like the database is not set up? I used these commands:

    Code:
    rake db:migrate
    rake db:admin:create 
    
    Also note, I can get the development app to run with no problem on port 3000. I am only not able to get cpanel to run on the other port: 12002

    Does anyone know how to install a rails app by command line and then have cpanel work with it correctly? Any help is appreciated. Thanks, Ddeo
     
  4. mickbeng

    mickbeng Well-Known Member

    Joined:
    Oct 3, 2006
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Penang, Malaysia
    ddeo,

    It appears that there is ActiveRecord::StatementInvalid error (MySQL table error) fro your apps.

    Perhaps, you may use command below to check any missing gems.
    Code:
    rake gems:install
    Secondly, check for the environment.rb file from config folder if any setting goes wrong.
     
  5. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Installing Ruby, Ruby Gems, and Ruby on Rails for a cPanel/WHM server

    To install Ruby, Ruby Gems, and Ruby on Rails for a cPanel/WHM server please refer to our official documentation as noted below:
    Ruby on Rails and cPanel/WHM
    Installing Ruby
    Deploying a Ruby on Rails Environment
    Ruby Gem Installer via WHM

    Related menu paths in cPanel/WHM:
    cPanel: Software / Services >> Ruby Gems (Ruby Gem Installer)
    cPanel: Software / Services >> Ruby on Rails (Manage Ruby on Rails Applications)
    WHM: Main >> Software >> Module Installers >> Ruby Gem [Manage] (Ruby Gem Installer)
     
    #5 cPanelDon, Nov 20, 2009
    Last edited: Nov 20, 2009
  6. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Hi Don, thanks for your reply. I have checked out the links you sent. I am have trouble particular to the deployment of a ROR app.
    Deploying a Ruby on Rails Environment
    I follow these instructions but for some reason the rewrite does not work. It will work only with the port number. The error says:

    Code:
    The page you were looking for doesn't exist.
    
    You may have mistyped the address or the page may have moved.
    
    Also, I set the app to run on reboot but this also does not start automatically on reboot.

    Please let me know if there is anything I can do to debug these problems. Thanks, Dan
     
  7. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    The redirect issue is fixed in cPanel version 11.25 as detailed in the following thread and post:
    Ruby on Rails: Not Found. - cPanel Forums

    Please do not cross-post about the same issue.

    Did you run the "installruby" script?

    When installing Ruby and Ruby on Rails via our "installruby" script this will automatically create an init script:
    Code:
    # /scripts/installruby
    Please provide the output from the following two commands:
    Code:
    # stat /etc/init.d/ror
    # chkconfig --list ror
    If the init script does not exist yet, the following script will install it:
    Code:
    # /usr/local/cpanel/bin/ror_setup
     
    #7 cPanelDon, Nov 23, 2009
    Last edited: Nov 23, 2009
  8. ddeo

    ddeo Active Member

    Joined:
    Sep 4, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Hi Don, first off, sorry for posting twice with this issue.

    I already had run:
    Code:
    # /scripts/installruby
    I just now did the ror_setup:
    Code:
    # /usr/local/cpanel/bin/ror_setup
    Here are the results from 2 commands you suggested I run:

    Code:
    # stat /etc/init.d/ror
      File: `/etc/init.d/ror'
      Size: 344             Blocks: 8          IO Block: 4096   regular file
    Device: 49h/73d Inode: 21342176    Links: 1
    Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2009-11-24 07:26:00.000000000 -0700
    Modify: 2009-11-24 07:26:00.000000000 -0700
    Change: 2009-11-24 07:26:00.000000000 -0700
    
    Code:
    # chkconfig --list ror
    ror             0:off   1:off   2:on    3:on    4:on    5:on    6:off
    
    Thanks for your help going forward. Regards, Ddeo
     
  9. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    With the "ror" init script installed and set to "on" in chkconfig as it is now, this should automatically start applicable Ruby on Rails applications upon the next system reboot.
     
Loading...

Share This Page