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

Discussion in 'cPanel Developers' started by jlimited, May 25, 2005.

  1. jlimited

    jlimited Well-Known Member

    Joined:
    Jun 4, 2004
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    I am trying to install Ruby on Rail with FastCGI. Has anyone done this for a share virtual hosting environment that is running cPanel? Where can I find information about this?

    Thanks
    Jlimited
     
  2. jmesam

    jmesam Registered

    Joined:
    Jun 25, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    This would be a great addon for cpanel, to install ruby, rails, fastcgi and the gems needed like with perl. And that the application could install the updates.
     
  3. icecube

    icecube Registered

    Joined:
    Jun 10, 2005
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
  4. jmesam

    jmesam Registered

    Joined:
    Jun 25, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Thank you. Great tutorial! :)
     
  5. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    I followed this tutorial on a non-production server and it works. Is this more geared to those clients that have their own server? We have a client that has requested this in the past and he is currently on a shared hosting plan. This seems to me to be more for a dedicated server, so it might be best if this client was moved to a dedicated server or VPS. Am I correct in my thinking?

    I also don't know anything about Ruby. Other than it is a programming language. I have never programmed in it and don't know how to write applications for it, but I did follow the tutorial and was able to get the congratulation's page.
     
  6. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    It is not hard to get your head around. Infact, some say installation is harder than actually using it. Last I checked, there are five books on rails in the works - two from the Pragmatic Programmers, two from O'Reilly and one from a German publisher ("Web-Entwicklung mit Ruby on Rails")

    Once books are available, I expect adoption of rails to take off in a large way. I think the first book to be published will be this one, due out this summer.

    "Agile Web Development With Rails" by the Pragmatic Programmers.
    http://pragmaticprogrammer.com/titles/rails/index.html
     
  7. icecube

    icecube Registered

    Joined:
    Jun 10, 2005
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    You can change a user's DocumentRoot in your Apache conf to point to their Project's 'public' directory.
    For example your client puts their Rails project in their home directory (probably the best place) i'd put 'DocumentRoot /home/USER/RAILSAPP/public' under their VirtualHost in httpd.conf

    This should work and its what I've done for some test projects. Though I'm wondering if its the best way to host a Ruby on Rails project...

    The beta of the Pragmatic Rails book looks great too! :) http://www.pragmaticprogrammer.com/titles/rails/index.html


     
    #7 icecube, Jun 15, 2005
    Last edited: Jun 15, 2005
  8. billyrobot

    billyrobot Active Member

    Joined:
    Feb 18, 2004
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    I followed the tutorial as well -- although it seems less than ideal to have an executable dir in /tmp, don't you agree?

    BR
     
  9. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    My 2 cents...

    I used the tutorial and setup the fcgi-whatever directory not in /tmp but it's own directory. This seemed to work fine. It still is a security risk, but it's a little harder to find now.

    I did a bit of reading about Rails and Fcgi and it appears that all the Rails modules must be loaded to run an app. Therefore without fcgi it runs real slow (unuseable). The problem using it with fcgi is that fcgi runs apps as a persistent process - this means it's going to use lots of resources.

    I was setting this up for a hosting client on a $10 / month account. In light of the large amount of resources needed, I have decided to decline hosting this client and not make Rails available on the server (I don't like giving command line access anyway). I think Rails would work well on a VPS where the developer could setup a few clients on each VPS, but not on a shared Server where I need to fit in as many accounts as possible.
     
  10. Secret Agent

    Secret Agent Guest

    I use regular PHP 4.4.x and Apache 1.33 on a shared hosting server.

    Would ROR / FastCGI interfere with this? Is there any drawbacks to installing it on a shared server?

    Thank you
     
  11. timdorr

    timdorr Well-Known Member
    PartnerNOC

    Joined:
    Jul 9, 2002
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Atlanta, GA
    You can set the minimum and maximum number of processes to leave resident at a time. But Rails/Ruby is pretty lightweight. It's not as much of a resource hog as you make it out to be. Right now I've got one active server with a bunch of processes and they're using 30MB of memory in total (including shared memory). With 2GB available on the system, that's peanuts for the additional functionality.

    Also, /tmp itself is chmod 777, so the security issue is mute. Just use /scripts/securetmp to set up a separate /tmp partition with noexec and it's no more insecure than /tmp itself.
     
    #11 timdorr, Aug 4, 2005
    Last edited: Aug 4, 2005
  12. timdorr

    timdorr Well-Known Member
    PartnerNOC

    Joined:
    Jul 9, 2002
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Atlanta, GA
    BTW, here are some cut-and-paste directions for installing:

    Code:
    cd /usr/local/src/
    wget ftp.ruby-lang.org/pub/ruby/ruby-1.8.2.tar.gz rubyforge.org/frs/download.php/3700/rubygems-0.8.11.tgz fastcgi.com/dist/fcgi-2.4.0.tar.gz fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz
    tar zxf ruby-1.8.2.tar.gz
    tar zxf rubygems-0.8.11.tgz
    tar zxf fcgi-2.4.0.tar.gz
    tar zxf mod_fastcgi-2.4.2.tar.gz
    cd ruby-1.8.2
    ./configure && make && make install
    cd ..
    cd rubygems-0.8.10
    ruby setup.rb
    cd ..           
    gem install rails
    
    cd fcgi-2.4.0        
    ./configure && make && make install
    cd ..
    cd mod_fastcgi-2.4.2  
    /usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
    /usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so
    cd ..
    mkdir /tmp/fcgi_ipc/
    mkdir /tmp/fcgi_ipc/dynamic/       
    chmod -R 777 /tmp/fcgi_ipc/
    
    cat <<EOT >> ~/httpd.conf        
    
    <IfModule mod_fastcgi.c>  
    FastCgiIpcDir /tmp/fcgi_ipc/
    AddHandler fastcgi-script .fcgi
    FastCgiWrapper On     
    </IfModule>             
    
    EOT
    
    gem install fcgi         
    
    httpd restart
     
  13. ffeingol

    ffeingol Well-Known Member
    PartnerNOC

    Joined:
    Nov 9, 2001
    Messages:
    215
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    DataCenter Provider
    We've had serveral requests for ruby/rails etc. Is it actually "safe" to run ruby on a shared server? Since it's running under fastcgi and not "pure" cgi, we're unsure if it gets suexec'ed. We don't want to open a new hole that let's people poke into other shared accours, system files etc.

    Thanks,

    Frank
     
  14. Olate

    Olate Active Member

    Joined:
    Aug 1, 2003
    Messages:
    42
    Likes Received:
    0
    Trophy Points:
    6
  15. hostmoon

    hostmoon Well-Known Member

    Joined:
    Aug 4, 2004
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    Well I couldn't get it successfully working. I must be stoopid. I hope it becomes a part of cpanel soon. I have clients asking for it and all I can do is give dumb looks.

    dale
     
  16. avio

    avio Well-Known Member

    Joined:
    Oct 6, 2003
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
  17. Olate

    Olate Active Member

    Joined:
    Aug 1, 2003
    Messages:
    42
    Likes Received:
    0
    Trophy Points:
    6
    I believe you must be logged in. When you are, you will see:

    Bug 2970 depends on: Show dependency tree
    Show dependency graph
    Bug 2970 blocks:
    Votes: 11 Show votes for this bug Vote for this bug

    Just before the "additional comments" box. Click the "Vote for this bug" option.
     
  18. avio

    avio Well-Known Member

    Joined:
    Oct 6, 2003
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
    Having issues, its not working on one of my servers:

    When I run the following command "gem install rails", I get the following error:

    and I cannot find these files


    Please help, where is the public folder???
     
  19. jackie46

    jackie46 BANNED

    Joined:
    Jul 25, 2005
    Messages:
    537
    Likes Received:
    0
    Trophy Points:
    0
    If its a resource hog, and i image it would be, why on earth would there be a request for it? Isnt your box already packed full of junk that just kills it?
     
  20. haze

    haze Well-Known Member

    Joined:
    Dec 21, 2001
    Messages:
    1,550
    Likes Received:
    3
    Trophy Points:
    38
    I've not had any resources issues caused by RoR apps as yet and we've got over a hundered boxes provisioned with it. That said, its probably not for everyone. If you installed every available option on your server, you'd most certainly end up with a huge bloat headache. If you need it, if you have demand and if it fits into your business model then go for it I say.
     

Share This Page