How RoR handles multiple sub-websites under one host?

Hi there.

I am trying out Rails and would like to get some advice on this topic.

In my workplace, we are using IIS as web server.
And we usually create folders under root as sub-websites.

For example:
http://my.web.site/sub_web_1/index.html
http://my.web.site/sub_web_2/index.html
(and so on...)

When I follow through the tutorial on setup Ruby and Rails, I notice
that the "scaffold" is creating app folder, config folders, etc. for
single website only.

To simulate my current directory structure, I suppost to create
folers:
/my_rails_root/sub_web_1/
/my_rails_root/sub_web_2/
(and so on...)

and "scaffold" to each of them.

However, doing so means I have to start "ruby server" for each of them
and config each of them.

My question is, how can I start one "ruby server" and use one config
for multiple sub-websites?

Thanks a lot!

crab wrote:
[...]

My question is, how can I start one "ruby server" and use one config
for multiple sub-websites?

You normally wouldn't want to, if they're completely separate Rails
apps. If they don't share data or anything, they should be independent
Rails applications running on separate interpreter instances.

Server modules like Passenger make this sort of thing very easy to set
up...but you're using IIS (why?!?), and Passenger doesn't run on IIS.

Thanks a lot!

Best,

Hi Marnen,

> My question is, how can I start one "ruby server" and use one config
> for multiple sub-websites?

You normally wouldn't want to, if they're completely separate Rails
apps. If they don't share data or anything, they should be independent
Rails applications running on separate interpreter instances.

I am working for university and there are nearly a hundred of sub-
websites under my host.
Running ruby server instances and maintaining config files of that
amount may not be feasible for me.

Actually, we are currently using ColdFusion which has a admin console
to handle the application server settings.
I want to keep the practice as similar as possible.

Server modules like Passenger make this sort of thing very easy to set
up...but you're using IIS (why?!?), and Passenger doesn't run on IIS.

Oh, yeah! Phusion Passenger is useful. I've heard of it.

But (very) unfortunately, our server config is Windows-base, using IIS
as web server, and database is MS-SQL...
It seems to be quite a tough job to introduce RoR to my workplace
under this environment.
I have to make it!

Cheers,

When I follow through the tutorial on setup Ruby and Rails, I notice

that the “scaffold” is creating app folder, config folders, etc. for

single website only.

To simulate my current directory structure, I suppost to create

folers:

/my_rails_root/sub_web_1/

/my_rails_root/sub_web_2/

(and so on…)

and “scaffold” to each of them.

@crab

You are confusing what a rails app is , is not the same as an app in iis, in iis the concept of apps exist to separate the webconfig file, so that each application’s configuration wont interfere with the other. Rails app’s folder is part of an standardization and there is not an equivalent, you would be closer if you think of your rails all as the entire project folder.

Hi Marnen,

My question is, how can I start one “ruby server” and use one config

for multiple sub-websites?

Rails uses standardization so configuration is not what you are thinking it is you are applying again iis concepts.

I am working for university and there are nearly a hundred of sub-

websites under my host.

Running ruby server instances and maintaining config files of that

amount may not be feasible for me.

Actually, we are currently using ColdFusion which has a admin console

to handle the application server settings.

I want to keep the practice as similar as possible.

apparently what you want is a GUI for administration?

Oh, yeah! Phusion Passenger is useful. I’ve heard of it.

You say useful :), let me put it this way, it can take you days to set up an IIS server with rails just because passenger does not run
on windows( or IIS), but it will take you not more than 10 minutes to set it up on an apache/ubuntu box.

But (very) unfortunately, our server config is Windows-base, using IIS

as web server, and database is MS-SQL…

No one serius about web hosting is running on windows / IIS , maybe only microsoft, but i wouldnt be 100% sure they are.
I use to host sites on iis and its a nigthamare compared to hosting on apache/ubuntu/passenger

It seems to be quite a tough job to introduce RoR to my workplace

under this environment.

I have to make it!

The thing is your original question is a web server issue not a rails issue, so the main problem is that 1 you are using windows and 2 you are using IIS.

Making rails run on iis is complex and requires that you buy a special of software(a dll). Last time i checked you needed to set IIs as a proxy with an apache server behind running a mongrel cluster that uses a load balancing middleware an a reverse proxy rewriting dll.

About indroducing rails in your work, start by stating the open source nature of rails, setting up IIS and paying for support like MS wants you to every now and then can cost around US$1,000 on the initial setup, calling and expert is expensive, installing any additional module is expensive, also IIS(MS technology in general) is always late to the party and they are always behind in technology/security, also most vulnerabilities are found there faster than in other platforms and lastly, viruses, having to pay hundreds for an antivirus that at the end will never give you 100% protection. Sum it all up and you will see that hosting on windows/iis can cost around US$2,000 per server and lots more if you are using .NET and bought visual studio (cost estimations are taken from where i live :slight_smile: ) on the other side, ubuntu/apache/passenger/RoR cost $US 0.00 .

Why don't you install Mongrel and run your RoR apps through it instead
of IIS? I've never used IIS but the stories told about it don't paint
a pretty picture. Mongrel is very easy to install and you can run it
as a Windows service with Automatic start.

@pepe

last time i checked , mongrel is single threaded so you need to run like 5 mongrel instances each with the rails app loaded, and running on a different port, if you dont do that user response will be queued and the app will look super slow, also, since each mongrel will run on a different port you are going to need a load balancer that switches from one mongrel to another and maps all of them to port 80.

god bless passenger!

step 1)

run command and wait 30 secs

step 2)

copy paste

step 3)

edit server name and app path

step 4)

restart webserver (apache/nginx)

step 5)

fall in love