I have found this very good thread from 2006 about multi-tenant
I’m making my app available to multiple customers and right now my
- svn export code
each customer has their own
- rake setup:initialize client_name
which creates the databases and the database.yml file
- rake db:migrate
which creates all tables
- 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
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?