Setting up shared hosting on dedicated server

I have read Ezra’s book and the O’Reilly shortcuts and various other
resources on the Net and most assume you have one app which you deploy
to shared host, VPS or dedicated host.

Our situation is that we have an ASP app which will be by paid up
subscription and so the same app will be used by multiple customers
with their own private db. In addition within the rails tree there is
a folder for customer uploads and assets.

My client seems to be set on using a dedicated server with shared host
architecture rather than recommended (Ezra’s) VPS slices. I’d like to
use nginx, mognrel_cluster. The reason why my client is set on shared
hosting configuration over VPS is that the other contractor on the
project is convinced that long term maintenance of various open
source libraries (we need a dozen or more such as wv, enscript,
antiword, pdf2html etc) on each slice negates the benefit of VPS.

I am looking at nginx cookbook section on the wiki and I see that they
have for shared hosting:

http {
server {
listen 80;
server_name www.domain1.com;
access_log logs/domain1.access.log main;

    location / {
        index index.html;
        root  /var/www/domain1.com/htdocs;
    }
}

server {
    listen          80;
    server_name     www.domain2.com;
    access_log      logs/domain2.access.log main;

    location / {
        index index.html;
        root  /var/www/domain2.com/htdocs;
    }
}

}

However when I see the config file for nginx/mongrel I see that the
directive:

upstream mongrel {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
}

goes in the http section and not the server section. So the question I
have is, how do I setup mutliple customers on the same box with
private mySQL databases?

This is NOT a very high volume site. There may be 1-2 dozen customers
on the box each with 1-40 users. I would very much appreciate any
suggestions, pointers and arguments for/against shared host/VPS
configurations which I can present to my client. THe main argument
against VPS seems to be the overhead of creating the VPSs and
installation/maintenance of libraries. BTW we will be deploying on
Debian Etch.

Thank you very much for your time.

-bakki

Hi Bakki,

More than 90% of the Rails applications we host consume less than 60MB
of RAM per Mongrel instance.

We offer fully managed dedicated servers… and fully managed means we
setup the server, setup the Rails applications and even customize your
Capistrano recipes. Just contact us (support -at- speedyrails -dot-
com) and we will be glad to send you our current dedicated server
quotes.

Thanks,
Maykel


Maykel Rodriguez

Easy to use Rails hosting

Hello Maykel,

Thanks for that insight. Our plan is to keep adding customers to the
first box and get a second box when we start running out of resources.
I was actually thinking that each mongrel would be more like 70-120MB
based on Ezra’s talk at RailsConf2007. I will have a better handle on
this after some test deployments and testing. BTW, I was looking at
speedyrails.com and was wondering what your dedicated server fees are.

-bakki

On Sep 16, 7:36 pm, “[email protected][email protected]

On Sep 16, 2007, at 11:33 AM, bakki wrote:

My client seems to be set on using a dedicated server with shared host
http {

}
have is, how do I setup mutliple customers on the same box with
private mySQL databases?

Private databases or database servers? In our shared environment,
we’ve given the ability to our customers to run their own instance of
PostgreSQL or MySQL on their own ports. (everybody is provided a port
range for mongrels, postgresql, nginx… etc)

This is NOT a very high volume site. There may be 1-2 dozen customers
on the box each with 1-40 users. I would very much appreciate any
suggestions, pointers and arguments for/against shared host/VPS
configurations which I can present to my client. THe main argument
against VPS seems to be the overhead of creating the VPSs and
installation/maintenance of libraries. BTW we will be deploying on
Debian Etch.

Interesting “argument” reasons. We’ve been doing Rails hosting in a
shared environment for over two and a half years… and we’re phasing
it out in favor of our new VPS-solution, Rails Boxcar[1], because
it’s been too much of an overhead to make sure everyones applications
were playing nice in the same CPU/memory space. If you restrict the
memory space too much, stuff starts to get quirky… if you open it
up… one persons application bug or hit on DIGG can bring all the
customers sites to a halt. Granted, one could argue that those users
are “getting what they pay for”… but the support calls still come
in and this isn’t an appropriate response to them.

Setting up a VPS isn’t terribly difficult and when done right…
shouldn’t take more work than setting up a new shared user account.

[1] http://railsboxcar.com/

My two cents,

Robby


Robby R.
Founder and Executive Director

PLANET ARGON, LLC
Design, Development, and Hosting with Ruby on Rails

http://www.robbyonrails.com/

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]

Hi Robby,

Love your blog. Thanks for the reply.

On 9/16/07, Robby R. [email protected] wrote:

Private databases or database servers? In our shared environment,

These will be private databases all running under mySQL. So it will be
something like:
client1_production
client2_production…

etc.

up… one persons application bug or hit on DIGG can bring all the
customers sites to a halt. Granted, one could argue that those users
are “getting what they pay for”… but the support calls still come
in and this isn’t an appropriate response to them.

In our case all clients will be running the an instance of the same
app. We can allocate resources to the clients based on their needs and
requests.
I do prefer the VPS route and need more ammunition to convince my
client.
I can see the problems of a shared environment where each client runs
a different app and the bugs are not the same for all as in our case.
Still a bug one client hits can have the same result.

Can you give a bit of info on how you setup your shared environments
particularly with NGINX? I’ve got it running and am playing around
with the config file but am not clear on how to setup the server
section. Again my confusion comes from the fact that the upstream
mongrel section is NOT in the server section for each shared host. So
how can I allocate a mongrel_cluster to each domain?


Robby R.
Founder and Executive Director

Thanks again for your input.

-bakki

Hi Bakki,

Thanks for the update! Feel free to contact us in the future if you’re
looking for reliable RoR hosting.


Maykel Rodriguez

Easy to use Rails hosting

I’d like to thank you all for your responses. On how to setup shared
hosts which was one of my original questions, I found the answer here.
http://brainspl.at/articles/2006/09/12/new-nginx-conf-with-rails-caching
The nginx.conf file Ezra has posted on his blog explains every thing I
wanted to know. Thank you Ezra.

Maykel, in our situation the other contractor on the project has
convinced our client that going with a ‘rails specialized’ hosting
company is not necessary as long as you have your own box you can do
whatever you want with it. So the decision was based entirely on cost
and this other contractor’s endorsement of the hosting company because
they have several non-rails apps being hosted successfully there. I
would have preferred a ‘rails specialized’ host but then their
argument is ‘that’s why we have you’ (meaning me) to take care of ALL
Rails issues…though I am primarily a Rails developer. But if I push
the point too much I’ll be cutting my own legs :slight_smile:
-bakki

On Sep 16, 9:43 pm, “[email protected][email protected]

For what it’s wroth, from our experience with our virtual and
dedicated customers, we recommend 96-128 Megs per Mongrel instance.

Jesse P., Blue Box Group, LLC

On Sep 16, 2007, at 6:43 PM, [email protected] wrote:

More than 90% of the Rails applications we host consume less than 60MB
of RAM per Mongrel instance.

Jesse P.
Blue Box Group, LLC

p. +1.800.613.4305 x801
e. [email protected]

Hi Bakki,

This is NOT a very high volume site. There may be 1-2 dozen customers
on the box each with 1-40 users. I would very much appreciate any

In our case all clients will be running the an instance of the same
app. We can allocate resources to the clients based on their needs and
requests.

Having 1-2 dozen customers, each one running a Rails application, each
Rails app with let’s say two Mongrel instances will result in
something like 24-48 Mongrel instances running in a server. We
(www.speedyrails.com) guarantee 60MB of RAM for every single Mongrel
instance on our shared servers, so considering this amount of memory
you would need 2GB-4GB of RAM on your VPS/Server.

I would recommend you estimating at least the amount of memory you
will need to select the proper Shared/VPS/Dedicated solution.

Regards,


Maykel Rodriguez

Easy to use Rails hosting