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 in CURRENT -- notes

Discussion in 'General Discussion' started by Hoza, Sep 17, 2007.

  1. Hoza

    Hoza Member

    Joined:
    Jul 9, 2004
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Hi all,

    Just a couple things I'm discovering as I tinker with RoR usage in the phase 2 goodies in cPanel 11. I'm no Rails expert, but I'm finding my way around this stuff and figured I'd share what I'm seeing in Rails/cPanel implementation as it stands today:

    • I had a Rails app already on an account on my server (haven't tried the "Create Ruby on Rails Application" feature yet) and cPanel's Rails goodies saw it... neat. I'm able to start a Mongrel process running on that app using cPanel, which rocks. However, here are the quirks:
      • Using the "Run" Action on the app's control section apparently just loads a default Mongrel process without any extra switches/settings on port 12001 (in this test case). Because of this, it's running the app in "development" mode, which you (and I) likely won't want for long. For me, this meant that my Rails app hit 500 errors because I don't have a Development database on my server (that's sitting on my dev box) so it couldn't find it. Granted, you might be developing your app on the server, which means you may have a dev db. If you do, you'll have done all the rake-ing and migrate-ing by now and you're not interested in my drivel.
      • For me, I run a command more like this in SSH from the root dir of the Rails app (you should know this if you're making RoR apps, eh?):
        Code:
        mongrel_rails start -d -p 12001 -e production
        ...which starts in "daemon" mode on port 12001, "production" environment. The thing is, I can't figure out a way to (yet??) add in those extra parameters for cPanel's Rails management, so I think I have to start the server manually for now. Maybe I'll dig into how to mod cPanel a bit until it gets addressed, but I'm not going down that road for now. However, if I go ahead and start my Mongrel proc like this, I can still use cPanel to set up URL rewriting goodies that are stuck using port 12001 for the process in my case... I'm sure other apps will start incrementing ports into the 12,000's -- just a guess.
      • Because I can't tag on the extra spiff I need to the command in cPanel -- I'm guessing it's just running "mongrel_rails start" in the app directory -- I'm also unable to use the "App Status" or "Load on Boot" features yet... bugger. I'm sure that all we need to allow this stuff to work great is to add a few options to this cPanel screen, such as a radio button selector for "development", "production" or "test", as defaults (or maybe even scanning the app's "database.yml" file and displaying the names of each section?? Yay?!?).

    Well, that's the main stuff I'm thinking of for now. I'll post more if I uncover other secrets. After all, this is what I'd see as a "work in progress" since this cPanel screen really must include the ability to customize the Mongrel process -- including choosing your port and the environment.

    Oh yeah -- I would love to be able to start up a few Mongrel processes on a single app, say three of them for a small site?? Please?? :)

    (Of course all of this is not discussing the fact that a more serious Rails deployment should really be using Apache 2.2 + Mongrel + mod_proxy + proxy_balancer or such... that's another research topic that's still forthcoming.)

    BTW -- I'm sure my very lacking knowledge of Rails is shielding me from a ton of great solutions to these types of things, but hey... I'm trying to contribute for a change, instead of leeching all the time. :) These issues are likely to be of interest to Rails Noobs, I'd think.

    Anyway, good luck and I hope this helps!
    --Hoza
     
  2. AlexV.

    AlexV. Well-Known Member

    Joined:
    Jun 15, 2006
    Messages:
    212
    Likes Received:
    1
    Trophy Points:
    16
    Hoza:

    Glad to hear you are experimenting with the Ruby on Rails technology, it is quite interesting.

    Basically the syntax of the command that is executed when you click the "RUN" button starts the application, specifies the port and uses the daemonized option.

    Nevertheless the configuration file allows you to tweak the development, test and production options.

    It is a YAML file located in this path:
    /home/user/public_html/appname/config/database.yml

    The Ruby on Rails documentation located within the application directory has vast information in regards customization.
     
  3. Hoza

    Hoza Member

    Joined:
    Jul 9, 2004
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Yeah, RoR is pretty cool. It's actually brought back some of the fun into my work again, which just flat rocks. :)

    I appreciate your comments/tips/points. The database.yml file does define the various environments, but those environments are not loaded (aside from the default "development") unless you specify them when starting the Mongrel process using the -e switch (from what I know, anyway.)

    I haven't yet played with starting up more than one Rails app using cPanel goodness, but I'm assuming there must be some fancy magic that assigns a new port to each different app iteration being started. Thus, somewhere there is a place where the port number is being set -- since there's a port number being assigned per app, there must also be a way to set an environment per app... well, there /could/ be an env set per app if cPanel added that jewel. :D

    So unless there's a way to state which environment to load in the RoR cPanel page, it appears to load "development", which would be the normal default behavior when running Mongrel without extra switches turned on.


    I must say that seeing the new cPanel Rails stuff just made me even more stoked about tinkering with Rails. This is really a great start to integrating common Rails implementations for hosting clients. Again, it's not really what I might need for some of the bigger Rails sites that need their own server anyway, but this really rocks for the hosting community from what I'm seeing.

    Thanks!
     
  4. Hoza

    Hoza Member

    Joined:
    Jul 9, 2004
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Another point I meant to make regarded the path to Rails apps. I actually had created my app outside the public_html dir originally, which is why I was really surprised when cPanel found it. I put my app here:

    /home/user/rails_apps/appname

    ...instead of here:
    /home/user/public_html/appname

    Even then, cPanel saw it and was able to start a Mongrel process for that app without a hitch! Rock! Great work on that, guys -- maybe it's not as magical as I think, but it sure seems freakin' great. :)

    Of course, this brings up the issue of not being able to (apparently) create a new Rails app from cPanel without putting it into the public web directory -- maybe this isn't as much of an issue as I had thought it is for security-type reasons, etc.

    Okay... enough typing for now.
     
  5. JamieD

    JamieD Well-Known Member

    Joined:
    Sep 3, 2003
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    Hoza is correct, you must pass the environment parameter to the mongrel_rails start command. IMO rails in cPanel is not very close to production level. There is not enough controls for a server admin to allocate resources to clients. At the moment there are several things missing that would need addressing before rails support could be considered for use in production with real clients.

    1. With the current system it's possible to create and infinite number of rails applications and therefore use an infinite amount of server resources. We need a way to control the number of mongrel processes a client can create from within WHM, the same way you can control the number of domains, databases and email accounts a client can have.

    2. Mongrel processes MUST be started up in production mode, there are serious memory issues with running rails applications for extended periods in development mode.

    3. As Hoza already mentioned for any serious website apaches mod_proxy_balancer needs to be used to load balance between a cluster of mongrel processes.

    Hopefully these features will be implemented soon, cPanel will then have killer rails support that no other control panel has.

    Jamie
     
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I would HIGHLY recommend you submit these ideas (perhaps even just copy/paste) to a new entry on http://bugzilla.cpanel.net so our staff can review these suggestions and perhaps ask for further input regarding these recommendations.
     
  7. JamieD

    JamieD Well-Known Member

    Joined:
    Sep 3, 2003
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    6
Loading...

Share This Page