Subversion/Drupal distributed multisite project
(please excuse the note form of this article)
I am involved in a number of drupal projects, both new and legacy, some as paid projects, some volunteer.
I am involved or want to help with the maintainence of the code base (security patching, upgrades etc). However not all of the projects are on my own server. And as I am not a hosting company that is how things should be.
However, patching and upgrading is a pain, especially over many sites. How could this be managed efficiently and cooperatively?
The Solution in general
Make a designated server for subversion. Create a "master" drupal instance that is not actually used to publish anything, and from this create a subversion repository that will house the drupal "core" codebase, AND a seperate but related repository that can house the files specific to each drupal instance. Install each drupal instance that is to be maintained in this way via svn checkout on their own server, wherever it is. Lets call these drupal instances client instances.
When patches and upgrades come out, do these on the master instance and commit the changes to the repository to create a new revision. To upgrade each client instance simply run svn update on each server, possibly followed by running the drupal update.php script.
The Solution in more detail (NB. this is not a how-to yet ;)
We need to adhere to the conventions of drupal multisite installations to make this work nicely, even though the sites are most probably on different servers so this is not actually a multisite installation.
As we need to combine two code projects (the drupal core files and the files specific to each client instance) to create each instance, we make use of the svn:externals property. The master drupal files will be "external" to the domain specific files.
Basically, the drupal core repository will store all of the files, including the core modules EXCEPT anything under the sites/directory.
The sites/ directory is EXCLUDED from the drupal core repository, except for sites/all/modules, where we can keep modules that are NOT core but are used in pretty much every client.
To complete the picture we create seperate svn projects for each client instance. these projects will house the following files and directories:
(where www.thisparticularone.com is the base url of each instance - this adheres to the convention of drupal multisite installations and drupal will look here for the files)
When we install a new drupal we do it like this:
(NB these commands currently untested as i've changed things a bit since last version)
#install drupal "core"
svn checkout https://svn.southspace.org/subversion/drupal/thisparticularone/trunk/ .
#add the externals property
svn propedit svn:externals .
(which will launch an editor)
#add a line like this:
#get the new items from the external project, ie drupal mater
(to update your drupal including core ie. master project files run)
will NOT commit to the external files, ie. the drupal "master". this is what we want ;)
though should committ files in /sites/www.thisparticularone.com
this is the behavour we want.
What i've done already
Installed a xen virtual machine (debian etch) on mediaartprojects.org.uk specificaly for subversion and master instances
Made the repositories available via https
Apache access control only so far
Installed webSVN for viewing repositories (https)
Created master drupal repro, and some "test" projects
Done lots of tests with checking out, setting externals property updating etc using master and projects
i'm not the only one working on this, by the way ;)