Nov 13, 2009

Drupal's multi-site feature makes it possible to significantly increase the efficiency of managing a group of similar sites.  Imagine you have a group of clients where each client owns a site within your multi-site structure.  Undoubtedly, many of them will want to take advantage of Drupal's ability to add new features, which makes sense.  But if you're not careful, you can find yourself in a nightmare situation caused by a perfectly reasonable business decision to implement what clients want, when they want it.  The purpose of this blog entry is to provide some best practices that will make managing this kind of system a rewarding experience for you and your clients:

1. Prohibit Site-Specific Functionality:
One of the biggest advantages to using multi-site is that an arbitrary number of sites can use the same code.  This means if a bug is discovered on one site then it can easily be fixed across all sites.  So, whether there are five sites or fifty, the cost of adding new features and fixing bugs is about the same. 

Avoid breaking this rule at all costs; if you have to do it, copy the site in question completely out of the multi-site system and then make changes.  Ideally, you would eventually integrate this one-off site back into the herd, along with it's custom functionality.

2. Make Use of a Development Cycle:
Your clients are going to want new features.  When a request for site-specific customization comes in, during deployment of a new site or later on, resist the temptation to implement it immediately, even if it is simple. Instead, save it for later in a prioritized queue of feature requests.  Once the current version of the code is stable and bug-free, you can start working on the next version. Your clients may not like this because it means they will have to wait longer for new features, but the end result is that they will get more features sooner.  Also, any bugs that are found can be fixed faster since developers won't have to account for a laundry list of site-specific code.  It may be helpful to consider what you're offering to be a product with a version and a concrete set of features rather than a highly customizable service.

3. Make Theme Customization an Up-Sell:
I would suggest you set up a template site with a default theme that allows color customization.  Depending on the services your sites will provide, some of your clients may be satisfied with your default theme.  For clients who need to customize their theme, charge more money because this introduces a measure of complexity to the system; the more changes you make to a given site's theme, the greater the chance that something may work incorrectly.  These pricing options help encourage clients to opt for a more standardized theme.

4. Limit Site-Specific Admin Role Functionality:
Set up a site-specific admin role with permissions that don't allow clients to add new features and absolutely never give them access to the "PHP code" input format.   If clients have full admin access to their sites then, worst case, the security of all of your sites could be compromised.  Although that probably won't happen, if a client implements new functionality that causes problems then the resultant business need to fix it may force you to hack the code for all sites to satisfy a single client's immediate needs.  This situation is a good example of what needs to be avoided.

5. Never Give Clients Server Access:
If one client has access and breaks something then all sites could be compromised.  If clients want to submit code then accept it and treat it like a feature request.


Thanks for this and I look
Dec, 16 2009 - Chris Traynor

Thanks for this and I look forward to reading more of your posts.

Can you tell me if this new feature already exists with any of the other free CMS systems like Joomla or wordpress?

This is very innovative if not and I'm sure this will give Drupal a cutting edge in the market in the near future.

Regards,
Harry


defining "multi-site"
Dec, 2 2009 - Cindy

First, great set of pointers. Good advice. On that note, it might be helpful to advise which of the following multi-site scenario were thinking about when you wrote this.

Multi-site means different configurations to different situations.

1. one install of drupal, one database for each site on the install
2. one install of drupal, one database with multiple shared/not-shared tables in the database.
3. one install of drupal, one database, multiple sites (is this what happens with Spaces and Domain Access?)

I have created sites in scenarios 1 and 2 and the management practices are a little different. If on multi-database situation, "taking it out" is relatively easy. If on scenario 3 where the content is so integrated, removing a site and then sticking it back in doesn't seem like a very easy thing to do.

thoughts?


Use Aegir
Dec, 2 2009 - q0rban

One thing to be aware of in working with numerous multi-site implementations is that updating can be a nightmare. What if you have a module update that breaks sites immediately upon code upload before running update.php? You could have sites down for quite a while as you navigate to update.php in each site. While drush can certainly speed up this process, we have switched to Aegir for our multisite implementations, as you can migrate sites one at a time to the updated codebase and it handles running update.php on each site for you.


Brief, yet helpful
Dec, 2 2009 - David Needham

Thanks Josh for the article. I've been wanting to get into using a multi-site configuration for awhile but have been a little concerned about a number of things you covered in the article. Doesn't sound like such a problem anymore!

David Needham
Enjoy Creativity.


Great article!
Nov, 16 2009 - Jay Callicott

Good advice


custom modules for mult-sites
Nov, 16 2009 - techpop

I guess my question concerns point #2. If you're implementing site-specific functionality, this may result in creating a custom module for that site. Do you recommend minimizing custom module development? In your multi-site setup, do all clients have their own databases?


Site-Specific Functionality
Dec, 2 2009 - Josh Estep

In the setup I'm suggesting, here's how I would handle requires for site-specific functionality:

1. If the custom functionality isn't needed immediately, add it as a "feature request" to be implemented in an upcoming version of the code.

2. If the custom functionality is needed immediately, move the child site in question completely out of the multi-site structure into a standalone site using a copy of the current multi-site code base.  Make changes there, and then also add those changes as a feature request.

Once you've done this, you can add this custom functionality to the multi-site code and offer it to all of the child sites.  Then, the child site in question can be moved back into the multi-site structure.

The goal here is to keep all sites in your multi-site system as similar as possible.  Keep in mind, this approach only makes sense if you're able to treating the set of functionality available to each site as a product.


css_injector
Nov, 14 2009 - Simon Hobbs

I use multisite quite tightly, I don't mind site specific additional modules or themes *from* Drupal.org, but I avoid any customized code - ie. I am strongly in favour of what you are saying here.

The first place I find that customization is warranted is in the theme. Often, however, the requirement can be solved with css, and so my advice is to use the css_injector module to allow some custom css through the UI (usually by one of my guys). This also means I don't need to manage FTP access to the server for these design tweaks.


Link
Nov, 13 2009 - Onopoc

I posted a link to your article from this Drupal group http://groups.drupal.org/node/35448


Thanks for sharing Josh.
Nov, 13 2009 - Onopoc

Thanks for sharing Josh. Interesting reading.


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.