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.

Installing mod_rails and Rails 3.0.9 on a cPanel machine

Discussion in 'General Discussion' started by cPanelTristan, Jul 26, 2011.

  1. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Since we've had some customers who are willing to forgo using the cPanel environment and would like mod_rails and Rails 3 prior to our official support planned for cPanel 11.34, I did take the time to create a guide on how to accomplish installing both onto a cPanel machine:

    Installing mod_rails and Rails 3.0.9 on a cPanel machine - cPanel & WHM Admin Blog

    Please use this at your own risk with the understanding that cPanel cannot support using this guide in any manner, including tickets being sent into technical support with questions on the instructions.
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I had a customer ask a question elsewhere about whether users can create applications without the root user being required to do so. This is possible to accomplish if the user has jailed shell access with these steps:

    1. SSH into machine as jailed shell user

    Code:
    ssh username@domain.com
    In all instances, usermame will be the cPanel username for the jailed shell user. domain.com would be the domain name for the account.

    2. Create application

    Code:
    rails new /home/username/hello
    cd /home/username/hello
    rails generate scaffold person name:string password:string email:string age:integer
    rake db:create:all
    rake db:migrate
    3. Copy database to production

    Code:
    cd /home/username/hello/db
    cp development.sqlite3 production.sqlite3 
    4. Symlink public directory

    Code:
    ln -s /home/username/hello/public /home/username/public_html/hello
    5. Add rewrite to directory to .htaccess

    Code:
    echo "RailsBaseURI /hello" >> /home/username/hello/public/.htaccess
    6. Create restart file since user cannot restart Apache

    Code:
    cd /home/username/hello/tmp
    touch restart.txt
    Enjoy!
     
  3. Andylam

    Andylam Registered

    Joined:
    Aug 1, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Thanks Tristan,

    Another question is how do you start and stop multiple instances of the ruby apps on different ports on the same user account?


     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    The apps will not run on different ports under mod_rails, since mod_rails runs on port 80 due to being an Apache module. Are you asking how you basically start and stop apps on the account period under this setup?

    If you want to see an example of how the processes look under mod_rails (passenger) for an account, here are what you'd see:

    This is an example of the tristanwallace.com/hello/people application at /home/tristan/hello location on my machine.

    Here's a process tree of the processes running forked from httpd:

    Code:
    root@host [/]# pstree -npu
    init(1)-+-ruby(11760,tristan)
            |-ruby(14180,danielle)
            |-httpd(20078)-+-leechprotect(20088)
            |              |-httpd(20094)
            |              |-PassengerWatchd(20095)-+-{PassengerWatchd}(20097)
            |              |                        |-PassengerHelper(20098)-+-ruby(20100)
            |              |                        |                        |-{PassengerHelper}(20101)
            |              |                        |                        |-{PassengerHelper}(20102)
            |              |                        |                        `-{PassengerHelper}(20106)
            |              |                        |-PassengerLoggin(20104,nobody)---{PassengerLoggin}(20107)
            |              |                        |-{PassengerWatchd}(20108)
            |              |                        `-{PassengerWatchd}(20109)
    I did want to mention that I've found you cannot run EasyApache with this module added without it failing to build. The preferred option at this point would be to use .htaccess files to add the RailsBaseURI rather than includes, then to temporarily comment out the 3 lines added to httpd.conf prior to running EasyApache, then uncommenting those lines after it builds. I'll add that information to the guide after I confirm the best way to do it within the next couple of days.
     
  5. Andylam

    Andylam Registered

    Joined:
    Aug 1, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Is it possible to run multiple apps under one account ?
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    It is possible to run a million apps under any account. There aren't restrictions on the number of applications per account.

    I did end up revising where the RailsBaseURI is placed to allow multiple applications. So long as it is in .htaccess on /home/username/appname/public/.htaccess (the new how-to above details how to do that), then you can have however many applications you'd like per account.
     
Loading...

Share This Page