deltaoo wrote:hi
did you get anywhere on this
Can we use Seperate DB for tenancy. eg:
http://tenant1.someSite.Com
http://tenant2.someSite.Com
then somewhere convenient maybe a action filter we do a
read from config for the connection string named by tenant ?
hmmm - so to programatiically add new tenant we have to 1- create new db + tables + add config entry with the tenant name..
seems messy but I think that would work.
Hi Deltaoo,
Thanks for posting! I am still in the brainstorming stage. :-)
From the articles that Keem posted, it looks like the best idea it to have separate databases instead of one database for multi tenants functionality. The only concern I have is upgrading, for example if you have 2000 tenants you would have to upgrade each database.
From the sounds of it though, separate databases make it easier to get started, and keep the tenant's data separate, however in the long run it will cost a little more then the shared database approach. I know that wordpress uses the shared database approach and orchard uses the separate database approach.
Since the separate database approach is easier I think it would be best to start with. Also, since Nopcommerce and Orchard are both ASP.NET MVC we might be able to draw from some of the ideas they used.
Do you think this approach would work?
I was wondering if it could work as a plugin. I am thinking we would need the following parts:
1) The ability to create a new database for each tenant
2) Have a table for this plugin that would, like you said, contain all the info for the tenant. Like name, etc.
3) The ability to have a wild card " * " sub domains that would allow nopcommerce to know what tenant to display. For example: If you typed in site1.yoursite.com, it would do a search for a tenant who's site name was site1 and then somehow use that to connect to the correct database to show site1.
4) The ability to suspend/delete a tenant.
5) Someway to allow all tenants to "connect" to one code base. We don't want multiple copies of the nopcommerce code. I am really confused about this part. I am not sure how the controllers, modal and views can all work with multiple different databases. To do all this, would we have to have different config files for each tenant or could we use the wildcard sub domain to allow the main site decide what tenant to show?
Do you think all this is possible as a plugin so we did not have to change the main nopcommerce code that much? As for item 3, I think this is the approach that wordpress uses. When you enable the multisite on wordpress, you have to create a wild card sub domain like *.yoursite.com. This allows wordpress to create the sub domain look without you having to manually create the sub domains from your hosting admin.
The only trouble it is seems kind of hard to grasp how it all works. :-) Can anyone explain item 5?
I would really appreciate everyone brainstorming this out with me. I am sure we will be able to figure it all out if we work together. What do you think of the list that I have?
Let me know what you think. Thanks!
Regards,
Tim