Orchard CMS: Multiple Site Capability with Single Codebase

Discover my passion for Orchard CMS and how its multitenant implementation enables me to serve multiple sites from a single installation codebase.

The more I dive into the Orchard CMS platform the more I really love what they’ve built! Earlier this year I redeployed my site as an Orchard CMS site. Since then I have deployed a few more sites for customers and a few times they’ve wanted to stand up a few different sites. One killer capability that Orchard provides is the ability to serve up multiple sites from the same installation codebase as a multitenant implementation. This means that I can have a single Orchard codebase install but serve up multiple websites from the same installation.

This is especially cool when you want to deploy your sites using Azure Web Sites . This is how I’m running my site. I have a single Azure Web Site where I’ve deployed the Orchard codebase. I then have multiple tenants created. What you do is enable the module Multi Tenancy module:

Multi-tenant OrchardCMS Deployment

Multi-tenant OrchardCMS Deployment

Once this is done, you then have a new Tenant link within the administration portal. Navigating to that page will list all the tenants as mine does here

Multi-tenant OrchardCMS Deployment

Multi-tenant OrchardCMS Deployment

Now, your primary site (in my case, www.andrewconnell.com) is the default tenant that contains the list of other tenants. Creating a new tenant is as simple as filling out a form that asks for the tenant name, the URL it listens on and what themes you’ve deployed in the codebase are available to this theme.

Multi-tenant OrchardCMS Deployment

Multi-tenant OrchardCMS Deployment

Once this is done, you can then go set up the site by going through the standard set up process where you specify the site name, site administration user & database information. This means that while each site uses the same codebase, each site’s content can be segmented into different databases. In fact, if you use a unique prefix (like I do for some sites) when creating the database, you can stick multiple tenants in the same database! That’s what I am doing… my site is in one primary SQL Azure database while three other sites are in the same SQL Azure database.

Within Orchard, all the site-specific things, like media, warmup scripts, etc… all that stuff is stored on the file system is kept separate in different folders in the codebase. Or, if you are leveraging the new support for Azure blob storage for storing your site’s media, you can also extract that site-specific content to Azure blob storage. Now each site can have it’s own storage account allocated with it as well. And if you take this even further, you can also implement site by site caching using the new Azure caching support as well!

Using this multitenant capability of Orchard CMS, with the improvements in v1.7.1, you can have a single site codebase that stores site specific data, media and cache data in separate containers. Very slick!

One More Thing – Orchard Harvest Session Videos

By the way, recently there was an Orchard conference, the Orchard Harvest, in Europe. They took all the videos from the conference and posted them to their YouTube page … very cool stuff!

Andrew Connell
Developer & Chief Course Artisan, Voitanos LLC. | Microsoft MVP
Written by Andrew Connell

Andrew Connell is a web & cloud developer with a focus on Microsoft Azure & Microsoft 365. He’s received Microsoft’s MVP award every year since 2005 and has helped thousands of developers through the various courses he’s authored & taught. Andrew’s the founder of Voitanos and is dedicated to helping you be the best Microsoft 365 web & cloud developer. He lives with his wife & two kids in Florida.

Share & Comment