Welcome Guest | Login

Deploying 2 mod_rails sites on the same hosting account

I have a client that I would like to be able to show my latest work before I make it live.

Here's the process that I want to happen:

In my apps folder, I have different versions of the app, v1.0, v1.1, v1.2 etc etc.

Let's assume that my main site, "mysite.com" is configured in apache to point directly to the directory ~/www. So far this is the standard configuration I think.

Now let's say I make it so that ~/www is simply a symlink to a folder called ~/apps/v1.0/public

This the chain is as follows

Apache config => /home/mysite/www
www => /home/mysite/apps/current/v1.0/public

Ok, so far so good.
Essentially a configuration like this should make it so that all I have to do to change where "mysite.com" points to is to change the symlink for "www" to point to another app. (e.g. /home/mysite/apps/v1.5)

The BEST part of this is that I don't have to bother anyone else to do this. Support at hostingrails is free to do other things and help other people.



--- SETTING UP ANOTHER "TEST" site ---------

NOW, what I would like to do is do the exact same thing only with a subdomain. Let's call this subdomain "newest".

Let's assume that I have enough resources in my account to support this kind of configuration.

First I go to the control panel and create the "newest" subdomain. Control panel dutifully puts the subdomain in directory called "newest" in my www directory. Ok, fine I can live with that. Because symlinks are awesome. I delete the "newest" directory and make it a symlink to the app of my choice.

So I would now like to have mod_rails or whatever running in apache so that apache points to my app in this manner:

Apache config => /home/mysite/www/newest
newest => /home/mysite/apps/v2.0/public

Thus the client can view the newest version of her site at newest.mysite.com  and see her current site at mysite.com.


Again, if we do this I won't have to bother Hostingrails with needless apache configuration requests. Everyone wins.



---------- MY QUESTION -----------------

Can we not do this?
I've been with hostingrails a while now. I've asked this question several times in support 1-on-1 and never got a clear answer. Maybe my questioning was always vague. Now I'm asking it here. If anyone sees a flaw in this line of questioning or in this solution please let me know.

Thanks all!

2008-05-31 04:47 PM

Hi there,

Mod rails will only work if the Document root of the domain is pointing directly to the public of the rails app.

eg:-
DocumentRoot /home/user/app/public

The following Mod-rails tutorial will guide you to understand more about this.

http://modrails.com/documentation/Users%20guide.html

2008-05-31 07:36 PM

"Mod rails will only work if the Document root of the domain is pointing directly to the public of the rails app."


I don't think there was anything I said in my post that contradicted that statement.

I believe what you say to be true.


But my post was about "Deploying 2 mod_rails sites on the same hosting account"

You gave a very good answer to the question "What must the document root be in my apache virtual host in for my rails app to work properly/"

Unfortunately that was not my question.


If you notice in my question above : The symbolic links DO go to the "public of the rails app. So we are not in contention about that. Not at all.

Looking back, my question was laden with specifics and  verbosity as I tried my very hardest to provide as much detail as I could. Maybe this is the wrong route. Maybe a dialectic is more what's needed. So I'll start with a very short question and we'll go back and forth from there.


MY "NEW" QUESTION:
----------------------------------------------
Is it legal/possible on HostingRails to Deploy 2 mod_rails sites on the same hosting account?
----------------------------------------------

Thanks!


eric

2008-06-02 10:56 PM

Eric - yes it's possible to setup as many mod_rails sites as you wish, as long as you have enough dedicated memory in your account to handle the Passenger processes that consume a fair amount of memory.  

To turn on passenger for an apache vhost it is simply an addition of one line.  Each vhost, as you know, points to one DocumentRoot and can have several ServerAlias(es) (i.e. parked domains)

If you have two vhosts (which is your scenario above, and I would give them DocumentRoots in seperate folders in your ~/ - e.g. ~/app1 ~/app2 - which will save you some pain with Capistrano later) then support just needs to add the mod_rails magic line into each vhost and you'll be all set.  

Cheers,
~William

2008-06-03 12:19 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.