Forum: Ruby on Rails Multiple customers/tenants - keeping the data separate - how?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
13de37c0466c10344a11a7e1f7a64c63?d=identicon&s=25 Constantin Gavrilescu (Guest)
on 2009-04-22 21:17
(Received via mailing list)
I have found this very good thread from 2006 about multi-tenant
applications:
http://groups.google.com/group/rubyonrails-talk/br...

I'm making my app available to multiple customers and right now my
strategy is:
1. svn export code
  each customer has their own
2. rake setup:initialize client_name
   which creates the databases and the database.yml file
3. rake db:migrate
  which creates all tables
4. rake setup:blank_slate  customer_name
 which adds some necessary predefined data from a couple of YML files.

The problems with this setup are:
 * the memory usage
   each tenant uses their own process and that takes a lot of memory
which is ridiculous considering that they run the same code
 * management and provisioning issues
   Updates are cumbersome and creating another app for a tenant is
time consuming and not that automated. The whole process takes about 1
minute. I I ddn't check out the code it would take less than 20
seconds.


I used before a hijack_db metod as a before_filter in
ApplicationController that switched the database depending on the
domain. I'm not sure about the performance or security of that hack.
How do you guys manage multiiple tenants and multiple databases?
5772c599ccab3081e0fffb1d54f3b6de?d=identicon&s=25 Andrew Timberlake (andrewtimberlake)
on 2009-04-23 05:22
(Received via mailing list)
On Wed, Apr 22, 2009 at 9:16 PM, Constantin Gavrilescu
<comisarulmoldovan@gmail.com> wrote:
>   which creates the databases and the database.yml file
>   Updates are cumbersome and creating another app for a tenant is
> time consuming and not that automated. The whole process takes about 1
> minute. I I ddn't check out the code it would take less than 20
> seconds.
>
>
> I used before a hijack_db metod as a before_filter in
> ApplicationController that switched the database depending on the
> domain. I'm not sure about the performance or security of that hack.
> How do you guys manage multiiple tenants and multiple databases?

This is a great talk/video on multi-tenant application development
from Acts As Conference 2009
http://aac2009.confreaks.com/06-feb-2009-14-30-wri...

Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain
This topic is locked and can not be replied to.