Results 1 to 8 of 8

Thread: Rails 3.x /w Phusion Passenger in cPanel

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    4

    Default Rails 3.x /w Phusion Passenger in cPanel

    Thanks to Tristan Wallace @ cPanel for the instructions on getting Phusion Passenger to work properly!

    Installing mod_rails and Rails 3.0.9 on a cPanel machine | cPanel Blog

    NOTE: Rails functionality in cPanel will be BROKEN if you update Rails to 3.x. Rails 3.x is not officially supported in cPanel/WHM 11.34/11.36. This means you have to create rails apps manually and make direct edits to the Apache configuration using the distiller to save them. This will break clients' ability to add rails apps easily from their cPanel accounts. Only do this if a rails app absolutely requires Rails 3.x (e.g redmine 2.x). This will also break any existing Rails apps as cPanel uses a different framework (Mongrel) for Rails 2.x

    NOTE: git is required for this install. cPanel's official stance on git is to install it from source, as installing it from repositories requires that perl modules be installed from repositories as well, which is not supported in cPanel/WHM 11.34. See this link for instructions on installing git from source: Git - Installing Git

    First, install ruby and Ruby on Rails normally if they have not been already with:

    Code:
    /scripts/installruby
    Once installed, force an install of the latest rails version with:

    Code:
    gem install rails
    You will need to install the latest version of the passenger gem in order for it to work. Do the following:

    Code:
    cd /usr/local/src
    git clone https://github.com/FooBarWidget/passenger.git 
    cd passenger
    gem build passenger.gemspec
    gem install passenger-*.gem
    cd
    rm -rf /usr/local/src/passenger
    Make sure you note the version number, as that will be needed when configuring passenger in Apache.

    Now that passenger is properly installed, you can use it to compile the mod_passenger module for apache. Note that this action requires temporarily setting /tmp as executable

    Code:
    mount -o remount,rw,exec,nosuid,loop=/dev/loop0 /usr/tmpDSK
    mount -o remount,rw,exec,nosuid /tmp
    mount -o remount,rw,exec,nosuid /var/tmp
    passenger-install-apache2-module
    mount -o remount,rw,noexec,nosuid,loop=/dev/loop0 /usr/tmpDSK
    mount -o remount,rw,noexec,nosuid /tmp
    mount -o remount,rw,noexec,nosuid /var/tmp
    Now that the module is compiled into Apache, you can load it. Edit the Pre Main Global Include. You can do this in WHM under Service Configuration > Apache Configuration > Include Editor > Select Pre Main Global, or directly in SSH in the file /usr/local/apache/conf/includes/pre_main_global.conf. Append the following to the include:

    Code:
    LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-4.0.0.rc4/libout/apache2/mod_passenger.so
    PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.0.rc4
    PassengerRuby /usr/bin/ruby
    Ensure that you are using the correct directory when loading the actual passenger module and the root for the gem

    Now, backup your main Apache config file and distill the changes using cPanel's Apache Distiller

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak-modrails
    /usr/local/cpanel/bin/apache_conf_distiller --update
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    If you get any errors, this is likely because your paths are incorrect for the LoadModule and PassengerRoot directives

    Rails 3.x /w mod_passenger is now installed. You can use the following to create a test rails application (replace username with a cPanel test account in your system)

    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
    ln -s /home/username/hello/public /home/username/public_html/hello
    cd /home/username/hello/db
    cp development.sqlite3 production.sqlite3
    chown -R username:username /home/username/hello
    echo "RailsBaseURI /hello" >> /home/username/hello/public/.htaccess
    /etc/init.d/httpd graceful
    The following will create the rails app, define the parameters, create a sqlite database, populate the database, setup the Rails URI, clone the development database to production, set permissions, and finally create the rails app in .htaccess.

  2. #2
    Registered User
    Join Date
    Dec 2005
    Posts
    4

    Default Re: Rails 3.x /w Phusion Passenger in cPanel

    I have also written a thread on setting up Redmine 2.x, a common rails application that requires Rails 3.x.

    http://forums.cpanel.net/f402/redmin...ls-329011.html

  3. #3
    Registered Member
    Join Date
    Feb 2008
    Location
    Atlanta, GA
    Posts
    100
    cPanel/WHM Access Level

    DataCenter Provider

    Default Re: Rails 3.x /w Phusion Passenger in cPanel

    FYI, since 11.36 git is already installed in WHM. You just have to use the full path to use it

    Code:
    /usr/local/cpanel/3rdparty/bin/git

  4. #4
    cPanel Staff
    Join Date
    Jan 2011
    Location
    Houston, TX
    Posts
    26

    Default Re: Rails 3.x /w Phusion Passenger in cPanel

    Howdy,

    Please see the following post for full instructions for setting up a cPanel server with passenger rails:

    cPanel + Ruby on Rails + Phusion Passenger | blog.barrioearth.com

    Note that these instructions describe how to use custom directives inside a site's VirtualHost to override the DocumentRoot, so root access is required.

    Cheers!

  5. #5
    Registered Member
    Join Date
    Oct 2013
    Posts
    7
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Rails 3.x /w Phusion Passenger in cPanel

    Sorry to drag up this old thread, but the blog post to which cPBrianW refers is currently offline - does anyone have a copy of it?

  6. #6
    cPanel Staff cPanelMichael's Avatar
    Join Date
    Apr 2011
    Posts
    13,948
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Rails 3.x /w Phusion Passenger in cPanel

    Quote Originally Posted by Irksome73 View Post
    Sorry to drag up this old thread, but the blog post to which cPBrianW refers is currently offline - does anyone have a copy of it?
    It was a third-party URL that appears to be down. However, you should be able to search for "cPanel + Ruby on Rails + Phusion Passenger" on Google to see other sites that host the same tutorial. Note that these are third-party instructions not supported or maintained by cPanel.

    Thanks.
    cPResources: Support Options - Submit a ticket here - Additional Support Options - Forums Search - Mailing Lists - Documentation - Migration Services - Change Logs
    -- cPanelMichael - Migration Specialist, Technical Analyst, cPanel Technical Support

  7. #7
    Registered Member
    Join Date
    Mar 2013
    Posts
    8
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Rails 3.x /w Phusion Passenger in cPanel

    What is the current plan for getting Rails 3 to work with cPanel? It was in progress quite a few years ago.. http://forums.cpanel.net/f145/mod_ra...-a-152577.html

  8. #8
    cPanel Staff cPanelMichael's Avatar
    Join Date
    Apr 2011
    Posts
    13,948
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Rails 3.x /w Phusion Passenger in cPanel

    Quote Originally Posted by JacobHansen View Post
    What is the current plan for getting Rails 3 to work with cPanel?
    You can follow the progress of this feature request at:

    Rails 3.x | cPanel Feature Requests

    Thank you.
    cPResources: Support Options - Submit a ticket here - Additional Support Options - Forums Search - Mailing Lists - Documentation - Migration Services - Change Logs
    -- cPanelMichael - Migration Specialist, Technical Analyst, cPanel Technical Support

Similar Threads

  1. Enterprise Ruby + Phusion Passanger
    By naquad in forum General Discussion
    Replies: 0
    Last Post: 11-28-2010, 11:47 AM
  2. Ruby or Rails binding for cPanel? (Manage e-mail addresses through rails)
    By dunnil in forum Bind / DNS / Nameserver Issues
    Replies: 0
    Last Post: 05-12-2006, 04:00 PM
bargain