Session report: Building and Maintaining Drupal Distributions

The guys from Nuvole (italian for cloud) gave a great and very precise presentation called "Building and Maintaining Drupal Distributions" which was basically about code driven development with Drupal. It covered the usage of installation profiles and the tools Features and drush make.

The overall goal of all procedures described in the presentation, is to have all configuration of a Drupal site in code. That way Drupal distributions can be shipped and maintained (i.e. update the configuration after the site went live, and content was created, etc.). Also, it allows multiple developers to work on the same project without getting troubles. Multiple developers working on the same project have to merge their work at some time; and while this task is easy with code, it is hard with data stored in databases (like Drupal configuration).

drush make

drush make is an extension to drush, which reads a file ("make file") containing a list of drupal modules, themes and install profiles and downloads them all. It supports fetching modules not only from d.o., but also from svn or git repositories. Also, patches can be applied automatically. After you have created such a make-file, you can use a single drush command to get all needed source files for your project. I have attached working example a make-file, which includes a couple of interesting modules. Try it!

install profiles

An installation profile looks bit like a module, as it has a .info and .install file. Additionally there is a .profile file. You use install profiles to pre-configure Drupal during the installation process (i.e. when running install.php). You can set variables, define roles and permissions, install modules (including Features of course) an so on. In short: in .make file you list all your modules, and in the install profile you enable the needed ones and configure them. And with drush the process of running the make-file and installing Drupal with the installation profile is just a single command on the command line!

Features

Features are the final missing link to make the whole procedure actually do-able. Features provide an UI to export configuration to code. So, you configure a certain functionality of your site, which usually includes content types, menu-items, permissions, views, variables and so on, and export it to a Feature. This Feature is a module which can be included in your make-file (must be hosted on a git or svn server) and can be enabled on install by the install profile.

Conclusion

While it is a bit cumbersome to adjust your workflow to actually have all your configuration in code, it provides a way to maintain Drupal projects after release and to have multiple developers working on the same project simultaneously.

PS: As always examples are a great way to learn. Download and explore the Open Public distribution, which uses make-files, install profiles and Features heavily.
See also: This blog post about building your own project on the Build Kit.