Drupal Patterns

Version 3 (Mike Gifford, 01/23/2012 09:01 am)

1 1
Drupal is an amazing tool for quickly constructing attractive,
2 1
functional web sites. It lets you manage large numbers of web sites
3 1
from a single installation, and (via add-on modules) provides
4 1
almost any CMS or blog feature you could want.
5 1
6 1
However, like any powerful tool, Drupal takes some learning. It
7 1
also needs a certain amount of discipline to manage Drupal servers
8 1
without getting into a chaotic mess. The Drupal sysadmin can end up
9 1
trying to navigate a spaghetti of ad-hoc symlinks and face problems
10 1
upgrading, maintaining, monitoring and backing up a large Drupal
11 1
installation.
12 1
13 1
The primary tool for automating Drupal management is
14 1
[Drush](http://drupal.org/project/drush) - a command-line utility
15 1
which can download and update modules, themes and core code, access
16 1
the database, and many other useful functions. Here is an example
17 1
recipe using Drush to manage modules:
18 1
19 1
    define module() {
20 1
      exec { "install-module-$name":
21 1
        cwd => "/var/www/drupal/sites/all/modules",
22 1
        command => "/usr/local/bin/drush dl $name",
23 1
        creates => "/var/www/drupal/sites/all/modules/$name",
24 1
      }
25 1
    }
26 1
    
27 1
    class drupal::modules {
28 1
      drupal::module { [ "admin_menu",
29 1
                         "cck",
30 1
                         "comment_notify",
31 1
                         "contact_forms",
32 1
                         "filefield",
33 1
                         "google_analytics",
34 1
                         "imagecache",
35 1
                         "nodewords",
36 1
                         "views",
37 1
                         "views_attach",
38 1
                         "views_bulk_operations",
39 1
                         "weblinks" ]: }
40 1
    }
41 1
42 1
You can find more about using Drush and Puppet to automate Drupal,
43 1
plus a complete set of recipes for managing Drupal sites, here:
44 3 Mike Gifford
Puppet Drupal recipes: [Bitfield Consulting](http://bitfieldconsulting.com/puppet-drupal) or [Evolving Web](http://evolvingweb.ca/story/controlling-your-cloud-puppet).