Skip to main content

How to use cPanel > Ruby on Rails area with Ruby 2 and Rails 4

Comments

14 comments

  • serverhelp247
    Thanks Tristan. We will give it a try.
    0
  • ylluminate
    I do have a question, but want to preface this that I'm really appreciate that you're giving some attention to this. Rails on cPanel is so very critical. What do you suggest for various applications with different ruby version and gemset needs? I was considering adapting your steps with RVM, but should we define a different ruby gemset environment per app in apache vhost config(s)? Or what method would allow us fine grained control over different ruby version and gemset needs per app in this scenario? Another important thing to note, and this is very good news, is that the Phusion Passenger guys are going to be delivering a surprise next month regarding bringing Passenger speed levels up to par or beyond that of TorqueBox, Puma, et al from what they recently noted in the mailing list.
    0
  • ylluminate
    Well this is extremely exciting to see that Raptor turned to being Passenger 5. I guess we finally know what the cPanel team will be integrating for Ruby, Python and NodeJS / Meteor serving now! Working *extremely* well, but will be thrilled once we see this integrated into cPanel / WHM EasyApache install.
    0
  • steliosd
    Has anybody tried to create a ruby on rails application in a subdomain? Lets say that in the domain
    0
  • cPanelMichael
    ]Ruby works fine in the primary domain but when hosted in the subdomain it does not.Has anybody tried this?

    Do you notice any particular error messages, and could you let us know the specific method you used to create the app? Thank you.
    0
  • steliosd
    I followed this guide to install Rails and Passenger. When I go to myapp.mydomain.com I get the following rails page: "The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved. If you are the application owner check the logs for more information." I don't see any errors in httpd error logs. Here is the relevant part from httpd.conf:
    ServerName myapp.mydomain.gr ServerAlias www.myapp.mydomain.gr DocumentRoot /home/myuser/public_html/myapp/public ServerAdmin webmaster@myapp.masterpro.gr UseCanonicalName Off ## User masterpro # Needed for Cpanel::ApacheConf UserDir disabled UserDir enabled masterpro # Enable backwards compatible Server Side Include expression parser for Apache versions >= 2.4. # To selectively use the newer Apache 2.4 expression parser, disable SSILegacyExprParser in # the user's .htaccess file. For more information, please read: # http://httpd.apache.org/docs/2.4/mod/mod_include.html#ssilegacyexprparser SSILegacyExprParser On

    LoadModule passenger_module /home/myuser/.rvm/gems/ruby-2.0.0-p598/gems/passenger-4.0.56/buildout/apache2/mod_passenger.so PassengerRoot /home/myuser/.rvm/gems/ruby-2.0.0-p598/gems/passenger-4.0.56 PassengerDefaultRuby /home/myuser/.rvm/gems/ruby-2.0.0-p598/wrappers/ruby
    0
  • steliosd
    ] [RoR.pm REVISION] For cPanel's Ruby on Rails area to allow Rails 4 applications to be installed, please follow these instructions:
    cp /usr/local/cpanel/Cpanel/RoR.pm /usr/local/cpanel/Cpanel/RoR.pm.bak sed -i 's/2.3.18/4.1.6/g' /usr/local/cpanel/Cpanel/RoR.pm replace "'--force', '.'" "'new', '.', '--force'" -- /usr/local/cpanel/Cpanel/RoR.pm
    To ensure the /usr/local/cpanel/Cpanel/RoR.pm file remains revised, please add the following script:
    touch /scripts/postupcp chmod +x /scripts/postupcp
    Place these contents into the /scripts/postupcp file:
    #!bin/bash sed -i 's/2.3.18/4.1.6/g' /usr/local/cpanel/Cpanel/RoR.pm replace "'--force', '.'" "'new', '.', '--force'" -- /usr/local/cpanel/Cpanel/RoR.pm
    Save the file. [APP INSTALL] cPanel > Ruby on Rails area, create the application

    I have completed successfully every step but when I go to cpanel and try to install a new app, I get the following error message: "An unknown error was encountered when creating your rails application." Should I restart the server after finishing with RoR.pm REVISION? Any suggestions?
    0
  • kansy
    ]I have completed successfully every step but when I go to cpanel and try to install a new app, I get the following error message: "An unknown error was encountered when creating your rails application." Should I restart the server after finishing with RoR.pm REVISION? Any suggestions?

    Hey, I have the same error. I've restarted httpd & rvm but did not solve the issue. Did you manage to solve it? Thanks
    0
  • bhadazz
    Hi, thanks for posting these instructions, they've been a huge help getting a current version of ruby and rails installed on my system! I'm having the same issue a couple others are having when trying to create a rails app from within the cPanel admin. At first I thought it was a permissions issue, so I tried manually creating the folder via SSH, but that time cPanel just gave a different message saying the app location was already in use. Any idea what I should check next? Thanks in advance.
    0
  • ylluminate
    We've had Passenger and now Passenger 5 (Raptor) running for the last few months like a dream with cPanel. Would sure be nice to integrate it into the EasyApache process so that we can keep it up-to-date and somehow integrate RVM, but for now we've got several apps running great here. If anyone has some specific problems presently, let me know your specific questions and I'll try to help resolve them.
    0
  • DexPex
    Hi, I'm glad that can be regularly used in cpanel. I followed the instructions but at the end I got my cpanel account level message after trying to add Ruby on Rails Application Rails version 2.3.18 is installed. However, version 4.2.0 is required. Please contact your web hosting provider to have Rails updated. here are the versions: root@server [/]# ruby -v ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux] root@server [/]# gem -v 2.4.5 root@server [/]# rails -v Rails 4.2.0 root@server [/]# it seems that old version ROR ghost is still in cpanel. any hint to solve the problem? Thanks.
    0
  • kemal
    This works for me but adding app within Cpanel did not work so after installing everything i have used this workaround in order install latest Redmine; (which is 3.0.2 at the moment)(do not go with passenger you are done after migrate if you follow this workaround)
    0
  • Gur50
    Hi Tristan firstly thank you for this guide. I did exactly what you have wrote above. How do I run application with passenger? should I add vhost config?
    0
  • Gur50
    Edit: Somehow Passenger didn't recognize my application ( on install i was also have choose passenger for node.js ). I had Postgresql connection issue, that was failed to start rails application. (Now I can understand why you wrote install postgresql if you are familiar ; ) ) I have added those lines as extra vhost config for include
    DocumentRoot /home/username/rails_apps/railsapp/public Allow from all Options -MultiViews # Uncomment this if you're on Apache >= 2.4: Require all granted PassengerAppType rack PassengerAppRoot /home/username/rails_apps/railsapp
    Resource 1 : Resource 2 : So far I have started to my application thanks to GOD. You should symbolic links static assets in "public" directory to "public_html" root, if you are going to different setup please look to passenger apache guide, it shows how to deploy on a "3.3. Deploying to a sub URI". About cPanel integration, if devs inspect passenger 5 apache guide, probably they can add Rails 4+ and Ruby 2+ support without much problem.
    0

Please sign in to leave a comment.