Organizing your code to run a multi-tenant ecosystem
If you work for, or with, a medium-to-large company using AEM, there’s a good chance that you will need to run multiple sites on a single production environment.
In terms of code, this means multiple tenants. A tenant is a project that includes:
-->All the applicative code to implement components, workflows, services, servlets, etc. for a website (eg: /apps/yoursite)
-->All the configuration for a website (eg: /conf/yoursite)
-->The initial website structure (eg: /content/yoursite, but not its children)
So what’s the best way to organise your code projects so that multiple tenants can co-exist?
The use case
Your company has two brands:
-->Brand A offers services for the general public.
-->Brand B is tailored more towards B2B clients.
Each brand has:
-->A public website which is available on the internet.
-->A private website which is only available via a mobile app.
This leaves us with four different websites in total and therefore four different tenants.
All tenants are live on the same AEM instances (Author and Publisher) and they all also share a Dispatcher, but have one Dispatcher configuration each since there are different requirements between tenants.
Additionally, your company has decided to customize the AEM Touch UI in certain places to improve UX for authors.
So our objective is to design an ecosystem which allows all the tenants, the teams who deliver change for each tenant and the content authors to co-exist peacefully on the same AEM platform.
In case of single git ( AMS or AEM as cloud service) code from multiple projects can be merged with help of parent project for multitenancy but main problem starts when you wanted to deploy a single site. Suppose Parent Project have 3 sites SiteA, SiteB, SiteC. we can commit code for all of these in single git as a module inside Parent project. But How we can deploy on Site A sometimes only Site B. People share your thoughts on it.