Creating multi-tenancy (separated content) in 1 tenant

Topics: Core, Customizing Orchard, General, Troubleshooting, Writing modules
Aug 7, 2013 at 3:09 PM
I want to create 4 "sections" of content. Depending on the URL that is being visited, certain content will be available, while others will not be available.

In the end I would like to reach a point where I can configure 4 home pages (for each of the 4 URLs), be able to create content to have it automatically be assigned to a certain "section".

The idea is to have:
http://domain.com/
http://a.domain.com/
http://b.domain.com/
http://c.domain.com

All the 4 domains would share the same user repository and some content (that's why I don't want to use multi tenancy).

However, most content need to be specific to only 1 domain. Also, the homepage must be per-domain.

I've been looking quite a lot now, but I can hardly find any way to do this.
  • Create a custom IContentManager where I specify (through a Part) the domain the content belongs to. Then I run into issues with multi-threading, as I always need to have a HttpContext to be able to determine if the content should be returned or not.
  • Create ContentHandlers to assign a Part that says to which domain this content belongs.
I was hoping any of you guys would have some ideas regarding this; the idea is to have a site that is reachable through 4 "domains", that has 4 themes (already done with IThemeSelector) and has 4 sections of content + 1 section of shared content (Orchard without any modification, as this is how Orchard standardly works).
Aug 7, 2013 at 3:13 PM
Right now, Orchard has only 1 alias "/", which determines the homepage.

I was hoping, doing it this way, to be able to configure 4 aliasses "/", so I can have a separate homepage on each of the domains.
I was also hoping to find a way to do this, without having to change Orchard entirely. More like create a "lightweight" multi-tenancy layer (that is not separated by database, but by a column in the database, for example).
Coordinator
Aug 7, 2013 at 6:07 PM
Use multi-tenancy, and for sharing content, you'd rather synchronize your contents instead. Can be done with a custom module which could pull/push custom data using the import/export API, or waiting for the next release which will have this.
Aug 7, 2013 at 6:30 PM
Edited Aug 7, 2013 at 7:30 PM
CRM products as Salesforce and MS CRM use a 'hierarchy view of the company ' to do this, each level has associated roles able to see or not the other levels (I make it very simple for easy understanding).
You could try to segment your users with roles and create corresponding page layers.
If there are not so many users and pages it may work?
What are the numbers and constraints ?
Aug 8, 2013 at 8:57 AM
Edited Aug 8, 2013 at 10:12 AM
sebastienros wrote:
Use multi-tenancy, and for sharing content, you'd rather synchronize your contents instead. Can be done with a custom module which could pull/push custom data using the import/export API, or waiting for the next release which will have this.
Is there any source code repository for the pull/push feature? I'd love to have a look at it

Or documentation maybe, or a discussion-topic.

Also, which release is the next release? 1.7.1 or 1.8 or higher?
Aug 8, 2013 at 10:42 AM
We use custom rewrites (+ custom 'rule') to pull this off for a subdomain of ours.

http://partner.tacx.com is same 'tenant' (default one) as http://www.tacx.com

Internally, the partner site is actually located @ http://www.tacx.com/service/partnersite but this is not visibile to our visitors.

It does also rewrite the urls in our menu before rendering it.
Aug 8, 2013 at 11:00 AM
Hi AimOrchard,

Thanks. So you actually have 1 tenant (Default), with both domains pointing to that tenant?

I think we need to take this to a higher level than you do, as we will be having people that maintain the websites. Essentially, the 4 "tenants" are separate websites, that share all content, except for a few pages.

I'm interested in what your rewrites and custom rules are. Would you mind sharing that?

Right now, we have a domain() rule provider, which allows us to make layers visible on certain domains. So http://b.domain.com/ would have Layer "B", while http://a.domain.com/ would have layer "A"

Then we have created permissions to allow us to configure whether users are able to modify content, if they belong in the same organisation as the owner of the content. This works for all content items that have a commonpart.

We created an IThemeSelector that allows us to load the correct theme, depending on the URL.

We created an ISiteService to configure settings for our "tenants".

However, we still feel we are missing quite some things. We need to do more.
Aug 8, 2013 at 11:06 AM
We just use the Contrib.RewriteRules module for the rewrites, and the custom rule is to just detect the subdomain.

We also use the custom rule for some of the widgets but we didn't do the 'style' switching through a IThemeSelector.

We used an IResultFilter for that, that detects the 'partner site' being active or not, and switches to the relevant 'Layout' in our active theme.

Simple reason we did it like this: with the exception of 2 changes, all the styling is EXACTLY the same compared to the main site.