D7 as multisite or as a library?

Events happening in the community are now at Drupal community events on www.drupal.org.
wipeout_dude's picture

Hi All..

Looking for some advice on how best to setup my server to host multiple D7 sites..

I have been experimenting and there seem to be a few ways to get the same result but I don't know if there are any particular issues with managing and maintaining either of these setups.. Any input would be very much appreciated..

Setup 1

The first way I tested was the following directory setup.. ( -> is a symlink)

/public_html/
-/core
--/drupal-7.9
--/drupal-7.10
---/sites
----/all
----/site1.com -> ../../sites/site1.com
----/site2.com -> ../../sites/site2.com
-/sites
--/site1.com
--/site2.com
-/vhosts
--/www.site1.com -> ../core/drupal7.10/
--/www.site2.com -> ../core/drupal7.10/

The apache vhost config points to /public_html/vhosts/www.site[x].com as the DocumentRoot..

This is for the most part a traditional multisite setup with separation of the "sites" from the "core" files meaning that sites can be migrated to new versions of core individually..

Setup 2

This involves using core as more of a "Library" and each site having an independent "sites" directory.. So directory is structured as follows..

/public_html/
-/core
--/drupal-7.9
--/drupal-7.10
-/vhosts
--/site1.com
---/authorize.php -> ../../core/drupal-7.10/authorize.php
---/cron.php -> ../../core/drupal-7.10/cron.php
---/includes -> ../../core/drupal-7.10/includes
---/index.php -> ../../core/drupal-7.10/index.php
---/install.php -> ../../core/drupal-7.10/install.php
---/misc -> ../../core/drupal-7.10/misc
---/modules -> ../../core/drupal-7.10/modules
---/profiles -> ../../core/drupal-7.10/profiles
---/robots.txt -> ../../core/drupal-7.10/robots.txt
---/scripts -> ../../core/drupal-7.10/scripts
---/sites
----/site1.com
---/themes -> ../../core/drupal-7.10/themes
---/update.php -> ../../core/drupal-7.10/update.php
---/web.config -> ../../core/drupal-7.10/web.config
---/xmlrpc.php -> ../../core/drupal-7.10/xmlrpc.php
--/site2.com
---/authorize.php -> ../../core/drupal-7.10/authorize.php
---/cron.php -> ../../core/drupal-7.10/cron.php
---/includes -> ../../core/drupal-7.10/includes
---/index.php -> ../../core/drupal-7.10/index.php
---/install.php -> ../../core/drupal-7.10/install.php
---/misc -> ../../core/drupal-7.10/misc
---/modules -> ../../core/drupal-7.10/modules
---/profiles -> ../../core/drupal-7.10/profiles
---/robots.txt -> ../../core/drupal-7.10/robots.txt
---/scripts -> ../../core/drupal-7.10/scripts
---/sites
----/site1.com
---/themes -> ../../core/drupal-7.10/themes
---/update.php -> ../../core/drupal-7.10/update.php
---/web.config -> ../../core/drupal-7.10/web.config
---/xmlrpc.php -> ../../core/drupal-7.10/xmlrpc.php

Achieves the same result but each site is like a standalone D7 install just with a shared "core" code base..

Obviously a shared module code base could be achieved by adding a symlinked cental "sites/all/modules" directory..

I plan to use drush and create bash scripts to manage routine tasks but need to decide on which structure to use..

Hopefully someone with more experience of shared code bases can give me some feedback as to what setup is better in the long run in terms of performance and ease of management..

Thanks..

Comments

Help to build multisite

manuel_mra's picture

Hi:
I can help you a little. My skype name is manuel_mra.
Regards,

Manuel.

Hi Manuel, Thanks for the

wipeout_dude's picture

Hi Manuel, Thanks for the offer, unfortunately I don't use Skype.. Can you post any suggestions here because then it would also help others in the same position?

Thanks..

Multisites

manuel_mra's picture

Hi
About three or more months and I was trying Multisite and the Domain Access module. It was hard for me to find a tutorial to guide me in an easy way. I found a video tutorial (in French) and I added in the Drupal.org (http://drupal.org/node/340408: Installing Drupal multisite - http://www.youtube.com/watch?v = Ap-tAeSV4Z8 & feature = related - documents). People sometimes want this video in English. That's why I wanted to communicate with you by skype. In half an hour or so I can guide you, but you can follow this tutorial as well.
I just found another video tutorial (in English): http://video.google.com/videoplay?docid=5832886805997118688. I hope this video can help you.

Manuel

This may be of help. It's for

Lakeside's picture

This may be of help. It's for Green Geeks hosting, but the procedure is the same for most hosting services--Setting up Drupal Multisites.

Thanks for the link

wipeout_dude's picture

Thanks for the link Lakeside.. Seems to be a describe a fairly standard setup.. Issue I have is that upgrading and roll back wouldn't be that quick and also its not possible to upgrade a single site.. Its all or nothing.. I am trying to get a little more flexibility than the basic multisite.. If you look at the two ways I described you can see that this way you have separated the Apache DocumentRoot and the "sites" directory for the location of core meaning that its flexible if you wanted to have different sites running different core versions.. Could even combine D6 and D7 sites in the same file structure..

Multisites and different versions

manuel_mra's picture

Hi:
If you need multisites with differents versions (D6 and D7) I suggest you install two multisites : one with D6 core and the other with D7.
The goal of multisites is to share the same code (D6 and D7 don't). Perhaps you knows that a module could be only in a version. That would be a restriction too.
I hope these comments help you.

Manuel.

Is there a specific reason

Lakeside's picture

Is there a specific reason that you are trying to do this? It's an intriguing concept and one that exposes a lot of unique abilities of Drupal. If you don't mind sharing why you want to do this there might be people who can provide alternative approaches to what you're trying to accomplish.

Hi Lakeside, Really just

wipeout_dude's picture

Hi Lakeside,

Really just trying to achieve the most flexibility with the multisite advantages, the best ability to manage upgrades and development, quick and easy roll back if the upgrade fails..

I think the way I have done it does what I need and the fact I can easily run both the setup's I mentioned originally at the same time means I can in fact run either way at the same time which is useful.. Maybe I have answered my own question.. :)

Your approach is intriguing

Lakeside's picture

Your approach is intriguing and hope that you have time to do a write up and provide a link here.

Please do not use the

Garrett Albright's picture

Please do not use the "library" approach. This is like putting your pants on after your shoes; you are complicating a routine and relatively simple procedure with no apparent benefit. And you're going to confuse the hell out of anyone who needs to work on this site in the future.

Unless there's just some incredibly great reason for doing this this way that I'm just not getting or something. If that's the case, please explain. But it had better be, like, friggin' mind-blowing, and I highly doubt that's what I'm about to hear.

We share the same sentiment

Lakeside's picture

We share the same sentiment (especially like your shoes/socks analogy). What approach would you suggest to help the guy out?

Hi Garret, Wow.. Obviously

wipeout_dude's picture

Hi Garret,
Wow.. Obviously you have a strong hat for the "library" approach.. Can you elaborate on the complication it causes other than the obvious management of the symlinks?

The Library approach is something I picked up from a presentation I came across online from Warner Bros and its the way they manage their Drupal sites..

I'm guessing that you are therefore advocating the generic multisite configuration?
How do you manage upgrading individual sites to a new core version rather than the all of them?

Thanks..

Really depends on how the

Lakeside's picture

Really depends on how the Drupal multisite is set up. Most often (as you already know) the root domain has the core files and the multisite domains are parked--on virtual sites.

Have you tried setting up the root domain as a D7 with its multisite domains parked, then installing D6 in the root folder as an ADDON domain and using 301 redirects to funnel those domains running on D6 core to their location?

P.S. It would be nice if WB would share some of that knowledge. Email a contact person at WB--I have a few friends over there--no IT types, but they might ask around for me.

Wow.. Obviously you have a

Garrett Albright's picture

Wow.. Obviously you have a strong hat for the "library" approach.. Can you elaborate on the complication it causes other than the obvious management of the symlinks?

Well, as I touched on, you're going to confuse anyone who comes along to work on the site and is expecting to encounter a normal Drupal multi-site installation. You're also just so outside of the norm of what Drupal expects itself to do and what others are going to be expecting Drupal to do that, if you run into problems in the future, solutions others will offer you may not work just because your system is so twisted beyond the norm.

The Library approach is something I picked up from a presentation I came across online from Warner Bros and its the way they manage their Drupal sites..

Could you link to said presentation? I'm curious to see what their justification for doing this might be.

How do you manage upgrading individual sites to a new core version rather than the all of them?

I'm assuming you mean major core version upgrades (like D6 to D7) as opposed to minor point releases, which should be a non-issue. Assuming that, it's fairly simple. Kind of annoying and maybe confusing if you're not used to configuring web servers, but not too difficult and not something you'll have to deal with often. Here's my approach when I need to do something like this.

First, just install the new Drupal core in a separate directory from the old one. Once you have an upgraded version of a sub-site which is ready to go live on the new core, alter your web server's configuration so that it uses the new core directory as its web root instead of the old one when that site's domain names are accessed. Let Drupal take it over from there.

As an example, if you have a bunch of D7 sites and D8 has just come out, your file system would look something like this:

/path/to/webfiles/d7/
/path/to/webfiles/d8/

Now if you want to go live with a D8 version of a site at http://example.com/ , but want everything else to still use D7, your web server daemon's config file would look something like this:

if (host == 'example.com') {
  web_root_directory = /path/to/webfiles/d8/
}
else {
  web_root_directory = /path/to/webfiles/d7/
}

Obviously, the specifics of this will vary depending on what web server software you use, what level of control you have over your server, and so on. But it should be fairly simple. Any sort of redirection, as Lakeside puzzlingly mentions (can't see what they're getting at), shouldn't be necessary.

Multisite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week