Site architecture patterns, Install Profiles, & automated site configuration

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
ChrisBryant's picture

EDIT: There will be a BOF discussion tomorrow, Wed morning at 9:00am here at Drupalcon. Please join the discussion and share your thoughts.

Setting up Drupal sites requires a lot of time clicking through forms and redoing common tasks. This can be automated and reused to save time. Install profiles were built to help solve this problem, but there are limitations. We'd like to discuss these limitations and figure out what can be done to address them and plan the next steps and evolution of automated site configuration? Also, what needs to be done or changed in Drupal core to facilitate this?

Defining site architecture and best practice patterns

It would be great to be able to define common and specific site architecture and best practice patterns in a format that is easy to read and work with and can easily be shared and collaborated on. Ideally the system would support different backends to allow site configuration documents in multiple languages.

Projects and implementations

Install Profiles (http://drupal.org/project/Installation+profiles)
Install Profile API & Profile Wizard, CRUD (http://drupal.org/project/install_profile_api)
Profile Generator (http://drupal.org/project/profile_generator)
Civic Space APIs (https://customprofiles.civicspaceondemand.org/api/file)

Related Projects and discussions

Cocktail - CCK Type Language: (http://raincitystudios.com/blog/cocktail-cck-type-language)
GHOP - Drupal automated staging toolkit project proposal: (http://code.google.com/soc/2007/drupal/appinfo.html?csaid=AD069F51C0E75638)
Distributions Group: (http://groups.drupal.org/distributions)
Effectiveness of install profiles?: (http://groups.drupal.org/node/6820)
Drush: (http://drupal.org/project/drush)
HostMaster2: (http://drupal.org/project/hostmaster)
AutoPilot: (http://drupal.org/project/autopilot)
Multisite Management Tools Review: (http://drupal.org/files/issues/review_0.pdf)

Limitations in Install Profiles

Here are some of the limitations with install profiles that would be great to address:
It's a one time initial setup and can't change anything on the site after the initial configuration.
You can't create separate, smaller groups of features and configurations that can be combined together and mixed and matched individually or as a group.
It can be hard to read and work with since it's in PHP code and so there is a disconnect between site planners/architects.
It's not possible to setup all the desired settings/configurations (ie., API and additional module support.)
It's hard to manage changes to the profile or setup as requirements and best practices change (which they constantly do.)
Can't easily have slightly differing configurations (would need a separate install profile for each.)

Proof of concept solution

We started work on a project called Patterns that attempts to address and solve some of these points and limitations. Our idea was to make a simple, flexible, powerful custom module/system to handle definitions of site configurations that was easy to change, update and manage. We decided to create a module that supports definitions of requirements (patterns of any type) and runs/enables them on an new or existing site. We also created a very simple install profile that's sole purpose is to set up the Patterns module.

It's in an early proof of concept stage. You can find the project placeholder on Drupal here:

http://drupal.org/project/patterns

Here are some design ideas and implementation details:

Overview

The patterns module will enable the setup of complex and detailed sites without actually doing any of the setup yourself. A pattern will be a collection of rules, definitions, and dependencies that will automatically setup and create simple or complex features for you. Patterns allow you to define features and functionality for a site in a standard text format (currently XML with planned support for other formats,) or directly on the site, and then apply them to an already running site. An administration page will let you enable (and possibly disable or remove) each pattern that has either been provided by default, contributed, or created specifically for the application at hand.

A typical example would be to easily and simply setup a fully functional forum with user registration, authorization, avatars, comments, captchas, views and more without touching a single setting. Of course the unique, specific settings for the site at hand can be adjusted like usual, however basic settings can also be tweaked when turning on the pattern.

For those that need more control over the setup of their desired features, patterns could possibly guide the user through all of the setting pages and settings that are available for a particular feature set. They could have stop points that prompt the user for a specific choice or input (similar to Photoshop actions.)

Patterns primary uses

Define reusable site architecture patterns and best practices that are easy to update and maintain.
Quickly setup and configure new (and existing!) sites based on site architecture documents/patterns. (Next evolution of Install Profiles)
Migrate changes, updates and new features from you local development environment to dev server to QA site to the final production environment. (Change Management)
Possibility of making a specific pattern to update/change a site(s) from some other known configuration (legacy best practice to current best practice for instance)

Architecture Overview

Base install profile (setup Patterns module)
Patterns Drupal module
Patterns component modules
Hooks/API
Pattern XML files
Stop points for allowing the user to set/change a value
Pattern groups/subgroups

Most patterns will be made up of a combination of any/all these components:

Module(s)
Module settings
CCK Content Type(s)
Fields
Field weights/order
Views
Type
Fields
Panels
Blocks
Permissions
Content/Nodes (not finished yet)
Files
Other patterns!

Features:

XML based. Keeps it open and flexible so you can possibly use other systems to process or work with the XML
Creation of content types and fields
Creation of views and settings
User and node creation
Setup of user roles and permissions
Automatic and assisted panel creation
Automatic and assisted menu setup
Basic conflict checking and resolution
A pattern can be a list of other patterns
Support for tokens from the Tokens module

Challenges

XML Based (other formats may be more readable or better to work with.)
Keeping component modules up to date
Resolving conflicts in patterns and pattern dependencies
Getting parts of this into Drupal core

Primary plans and ideas for the future

Nicely formatted view of the pattern live on the site (currently it just displays the raw XML)
Extensive pattern administration:
Pattern builder: choose configuration components from an existing site to make a pattern out of specific parts (or the entire site)
Import from another site/file
Export to another site/file
Record patterns when setting options or configuration
Stop points (to ask the user for an input or value)
Pattern versions and dependencies
Display and automatic downloading of patterns from a central repository
Run/control from the command line (Drush integration)
Add/Import by URL (with ability to choose from a list of available ones)
Publish/Export list of patterns to URLs, Master site (enable repository functionality) and individual patterns
Repository system (list of available sites to check for patterns)
Ability to easily add your site automatically to the repository list
Version checking

Possible other side benefits and solutions

Central or distributed pattern repositories with community managed best practice patterns
Unified API for configuration import/export
Change Management solution
Development shops can share common configurations and work together to improve them.

Sorry for the overload of information here. We'd love to hear your thoughts and feedback and work together to create a solution is properly planned and can hopeful integrated with core for Drupal 7. What do you think?

Comments

Great!

SamRose's picture

I was resorting to install profiles, or just making "template" sites locally on my pc, then copying those to start out with. Because, it does take a huge amount of time to configure a new Drupal site from scratch.

So, this is fantastic idea

Sam Rose
Social Synergy
Blog

Great review in today's BoF

ebrittwebb's picture

Great review of this in today's BoF session at DrupalCon. Look forward to following (and even participating) in continued progress on Patterns.

I especially love its recursive nature, where a pattern can actually be a collection of other patterns!

Erik

Erik Britt-Webb
drupal@ebrittwebb.com

very very awesome. I would

tjholowaychuk's picture

very very awesome. I would just quickly copy the latest modules from the repository and then use firefox's Selenium plugin to run through the configuration haha.. silly silly

vision media
350designs
Print Huge Edmonton Printing Services
Design Inspiration Gallery

BoF was very intresting

Jo Wouters's picture

The Bof session about patterns was very intresting. Looking forward for the first code-release.
When I told to my co-workers about it, we immediately decided to try using it in combination with DAST (Drupal automated staging toolkit - http://drupal.org/project/DAST) so we can rollout sites very fast.

What was your experience with DAST?

allisterbeharry's picture

Hello Jo I've been trying to drum up support for the project for a while and there's a new 2.1 release with several bug fixes / enhancements you can try out. Could you tell me what your experience was? Did you find it useful/awesome/terrible or were there any bugs or issues you ran into?

Nice...what is the direction for core?

Boris Mann's picture

As you know, I'm not particularly happy about this release. It was created without first discussing or announcing it's progress, so there is no community input. It also does nothing to move core forward -- it doesn't extend install profiles, and there is no path to getting this into D7 :(

There has been lots of discussion of something LIKE patterns. The CivicSpace "packages" stuff really does all of this today, but it's in a tricky situation while there is an attempt to get the source code for that out.

I'll be focusing mine and my team's time on extending install profiles directly. Hope to see you involved in the discussion for D7.

Today vs. Tomorrow

qbnflaco's picture

Is there a way to tack on patterns to install profile, then try to get that into D7? I think people are looking for a solution today and not something that will be viable in 1+ years when there are enough modules ported to D7 to start building sites off of it.

Sammy

Already tacked on

Boris Mann's picture

That's how patterns work today. But I actually don't really understand what this brings above and beyond install profiles. All of this could have been built "natively" with install profiles...

ebrittwebb's picture

With all due respect, I disagree with Boris. I sat in on the Patterns BoF and was very impressed with where it is going. I think it brings much more robustness and flexibility than install profiles currently provides (although I could be wrong).

Either way, I got the distinct impression they ARE interested in evolving their feature set, sharing it with others and even possibly integrating in into core. I think we should applaud the Patterns authors for what they have created so far, understand how it works, how it compares/contrasts with Install Profiles, and continue to encourage/support/guide their progress forward.

Erik Britt-Webb
drupal@ebrittwebb.com

travischristopher's picture

My take away from the little bit of experimentation i've done with patterns is it makes it very easy for non developer types to create configuration for site and module architecture without writing any php. You can instantly understand whats going on by opening up any one of the xml "patterns".

Its a bit of a bummer that this seems to be creating a rift, we should try to resolve it if possible. Installer profiles need to be as easy to use and create as patterns to be be truly useful tool for the greater community. Maybe there is a way to merge the two projects, or at least borrow some ideas? At the very least support for D6 and D7 is essential to move forward with patterns, although the long term game should be something like this in core.

DAST looks very promising and seems to cover real issues that we deal with during the lifecycle of a drupal site, i will be doing further research there for sure.

On another but related note http://drupal.org/project/PluginManager project was recently created.

TravisC

I was today asked to review

sime's picture

I was today asked to review Patterns module by one of my developers, and by definition that means like 10 minutes of my time. The project home page makes no reference to install profiles and how this module differentiates itself from those. The install_profile_api module does a lot of good work in answering the question "how do I programmatically make that thing happen" and has some awesome devs who've contributed to it. So I'd rather ask: is this an opportunity going begging for the developers of patterns?

I can hear the call "can someone create a patterns profile for ecommerce" competing with "can someone finally create an install profile for ecommerce"!

Some code please :-)

omar's picture

It would be great to have some code in cvs to review/toy around with. Thanks.

Omar

Code posted in CVS

ChrisBryant's picture

Hi Everyone, The code is posted in CVS on the patterns project page, sorry for the delay. Feel free to check it out and have a look as well as test or write your own patterns. Looking forward to your feedback on it. :-)

--
Gravitek Labs

allisterbeharry's picture

The primary motivation of the DAST project is to provide a formal XML-based build language and tasks for creating Drupal sites, providing a reusable way to specify and build a Drupal site and eliminate the repetitive steps everybody is familiar with. With the current release of DAST you can specify core module and revisions to co from CVS or unpack from .tar, run a specified profile, target web and database server locations for deployment, and even write configuration directives for Apache vhosts and MySQL instances. Each site to be built is written once in a Phing build script, and then customized at runtime through simple text properties files You can read more about the motivations and scope of DAST at the wiki page: http://groups.drupal.org/node/3913

Only local images are allowed.

The 4.0 major release(the next 3.0 release will focus on unit testing) is where I want to extend into what this group has been discussing with regard to patterns. The basic strategy I've come up with is to create and configure a site with the required features, generate a SQL dump, and then parameterize the script with placeholders for fields that the user would like to customize. This parameterized SQL script is fed into the site-import build file where the user will use properties either specified in properties files or on the command line with the Phing PropertyPrompt task. So the work of creating the site is done once and the end users only need the DAST kit and a build file to create a complete Drupal site will all feature and configuration done.

I'd like to encourage everyone in this group to at least give DAST a spin because a lot of thought and work has gone into implementing much of what is being discussed here. File issues or contact me on #drupal or through email if you run into any show-stoppers or need any questions answered. Send me your love it / hate it /fix this/why not this feedback; I'd love to hear it.

Wizard

frazras's picture

It would be nice if there could be a "wizard" interface - similar to the installion of some linux operating systems, where you select the purpose of the site - say for example e-commerce and it would install the required modules.

Are there plans to support Drupal 6?

jandd's picture

Hello, the pattern module looks very promising. I'm in the planning stage of a new site which I want to base on Drupal 6. Are there plans to port the module to 6.x?

Better late than never

jhebel's picture

The 6.x Dev version of Patterns is quite stable:
http://drupal.org/project/patterns

trying to understand patterns vs. spaces / context

justageek's picture

I think I get patterns after reading the various docs, but I'm trying to understand it in relationship to context and spaces. I really, really like context and spaces, and I hope we don't have 2 "competing" systems trying to accomplish the same goal.

They definitely have very

ChrisBryant's picture

They definitely have very similar goals but vary on approach although there are some key differences in goals as well.

We've outlined some of the differences in the Patterns FAQ: http://drupal.org/node/406982

How is the Patterns module different from Context/Features/Spaces modules?

  • The primary difference is that Context/Features/Spaces only use available module specific APIs such as Views Imports/Exports. Patterns on the other hand uses the FormAPI because it's the one consistent API that can work for all configurations/features currently available in Drupal. Patterns does also support using Views module direct import and export arrays but it does not define them statically in code.
  • The secondary difference is the format. Context/Features/Spaces define the feature in code as a module while Patterns defines the configuration in XML, YAML or PHP arrays. This is because the Patterns developers want them to be more easily shared and allow non developers to contribute to them. With Context/Features/Spaces you end up with one module per feature (or defined set of functionality and with Patterns you can define features or configuration as small or as large as you like and then mix and match them.
  • There are discussions under way about combining these efforts to support both methods in parallel and use the APIs when available and fall back to FAPI when necessary (until there is a common import/export or Data API in Drupal core.)

Maybe the Context/Features/Spaces developers can elaborate on some more of the differences here as well.

In addition to our talks at the BOFs from DrupalconDC, There is also a discussion about how we can combine efforts and collaborate on in the new Packages and Deployment group:
http://groups.drupal.org/node/20119#comment-69996 and bhuga's comment below it.

I also hope we don't end up with 2 "competing" systems. It is important to note that Patterns could leverage Context/Features/Spaces and vice-versa. For instance you could have a pattern define a context that essentially draws a circle around that feature or configuration so that you can later theme it more easily or possibly turn it on or off with spaces.

On the other hand Features could work with Patterns (and the new Configuration Framework) and allow a feature module to ship with supplementary pattern files to be optionally run when the Feature is enabled. We've added the ability for any module to be able to ship with Patterns and have those run when that module is installed.

I hope that helps answer the question a little bit feel free to ask any further questions you may have. :-)

--
Gravitek Labs

Two or more competing

moshe weitzman's picture

Two or more competing systems is just fine and healthy in these early days. Data propogation is a huge, complex issue and we need multiple approaches. This is healthy. We might or might not consolidate down the road.

Need of "form_alter" hook?

dunglv's picture

I see patterns module in Drupal 6.x has only 'patterns' hook function with noway to alter form after 'build' operation. Is it need new hook function to alter the form created by patterns?

Grammar -> CCK

jyamada's picture

Has anyone tried to create a CCK Content Type from DTD or XSD using Patterns, or some other technique.
It's not that I don't want to type it out each cck field. But rather, I'd like it to be more automated and trouble free.
Ideas?

staging module

Thomas_Zahreddin's picture

the module http://drupal.org/project/staging promises to handle database entries and deploys them to a production server.
So if this module can create a queue of all changes and replays them (i will test this), than this is the data we are looking for. This does of course not handle stuff in the filespace.

Does someone sees a chance to save the recorded changes form staging and let them run against other (plain) Drupal sites, e.g. with patterns?

Patterns Generation possible patch

johnbarclay@drupal.org's picture

I wrote a small feature for the patterns module and wanted to see if others thought it would be useful.

http://www.youtube.com/watch?v=PJb2U6Ya0IQ

The basic idea of feature is to facilitate generating simple patterns that emulate configuration of existing site. The pattern author might export perms, variables, and roles related to a module or 2 and piece them into a single pattern. The feature merely saves a little hand coding or complex sql that might be used to generate patterns xml.

I have 2 in mind. One that generates the pattern for your current roles and permissions. You select which roles and which module's permissions and if you want the overwrite option and the pattern xml is generated. This is the one I coded and is in the video. Blocks, menus and other easy to generate patterns would fit into this also.

If people like the idea I'll turn it into patches. I put some of the code at http://drupal.org/node/504774 but have cleaned it up a bit since and added an interface to generate patterns xml for variables (from variables table).

ps if anyone knows of a way to convert an array to xml with a parser that comes with a standard php install (such as simplexml) could you email me the code. I know how to loop around for and generate the xml, just would like a single function to do it for me and google hasn't offered me any help on this.

johnbarclay's picture

I finished this and submitted it as a patch:

http://drupal.org/node/514234

A 4 minute video walk through is at:

http://www.youtube.com/watch?v=NmwZmKS7S30

Theory is nice, but ...

NancyDru's picture

Theory is nice, but are there any actual patterns available? A list would be very nice. For example, I need to set up a conference site; is there such a thing?

You want LA Drupal's package for conferences and camps

Cliff's picture

Nancy, check the Drupal showcase for DrupalCampLA 2009. They have a complete description of the site development process and, towards the end of the page itself — after the list of contrib modules and the acknowledgments — they have a link to a package of everything you need to set up the site.

Would that be what you had in mind?

Use COD

niccolox's picture

Conference Organizing Distribution has all the basics
http://usecod.com