Drupal Deployment with Features and Drush

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Alternate resources

James Sansbury and Joe Shindelar walk through everything you need to know about working with the Features module through the Drupal user interface as well as with Drush shortcuts. They'll show you how to get your site configuration settings out of the database and into code, and walk through some deployment workflows by using Features and the Git distributed version control system. They'll explain the code that's created by the Features module, and show the tools that are available for detecting Features overrides, recreating features, reverting features, and exporting variables with Strongarm. They'll also walk through some best practices for managing the development on features amongst a team of developers and show some of the common ways that features conflicts occur and how to resolve them. They'll show you some examples of adding example code to your exported feature modules, as well as how to make configuration from your custom modules exportable by integrating it with the CTools Export User Interface API. Finally, they'll show you some developer productivity tools and other useful Features modules that are available on Drupal.org.

You can take a look at some of the example code used throughout this video on github:

Tutorials in this course
More information

James Sansbury defines Features (a module that helps organize site components and applications for specific use cases), as distinct from Nodes and other forms of site content.

Prerequisites

This series assumes that you can install Drupal 7, create a basic content type, create a basic view, and use Drush. See the following resources if you need a refresher:

Additional resources

Features project (Drupal.org)

More information

This is a quick overview of the various pieces we'll be covering in this series.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)

More information

We'll create our very first feature and then see how it works by putting on our production site and enabling it.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
Hands-On: Generating Sample Content (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)

More information

We'll take some time to open up the feature we've created and look at the code that was generated so that we can better understand what is going on under the hood.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)

More information

In this video we'll look at how you can update a feature by making changes, reviewing overrides, and then recreating the feature for deployment.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)

More information

Sometimes when a feature has been overridden we don't want to update the feature, but instead go back to where we were. Here we will look at how to revert a feature, as well as how to use Drush to make these processes much faster and simpler.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)

More information

Often you need to create a feature with system variables to make them complete. Features itself does not provide this, but the Strongarm module does, and we'll see how to add that to the mix.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)

More information

In this video we'll specifically look at using Git as a tool to aid our development process, especially when working with other people, to make sure that you don't step on each others toes and destroy work.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)

More information

Features is a module which generates modules for us. You can then extend that module just as you would any other Drupal module. In this video we'll add some additional code to our feature to make it more complete for our needs, outside of the realm of what Features itself can provide.

The features module (and the drush command) are pretty smart about not overwriting custom changes, and your chances of overwriting your custom code are pretty slim. When features exports a module it creates a .module file with only one line of code in it. Which is an include for another file: mymodule.features.inc. Features then puts all of the automatically generated code into this included file. When you regenerate or update a feature it just uses the existing mymodule.module file which maintains any code that you wrote, and then regenerates the mymodule.features.inc and associated files.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)

More information

Features are most often used for building out actual site features. Here we look at how you can use Features to provide you with quickstart developer tools as well.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)

More information

One thing we haven't looked at in our feature yet is Drupal roles and permissions. Here we will create a role associated with out Blog feature and look at how we can roll that important bit in.

In this video we are using the Environment Indicator module to visually distinguish between different environments.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)

More information

If you have more than one feature module on your site, they can sometimes step on each other and cause nasty conflicts. We'll create some conflicts and show you how this happens and how to back out of them.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)

More information

Features will auto-detect dependencies for you, which can be very handy, but at times it can also be very frustrating when you don't want them to. In this video we introduce the Features Plumber module and show you how to use it to finely control your dependencies.

We are sometimes asked how Features can be removed. Since a Feature is just a normal module, you can disable it on your module administration page, and even uninstall and completely remove it from your modules folder. That will completely remove the feature from your site.

Note: The Features plumber module is no longer necessary if you're using Features with Drupal 7. The functionality provided by this module has been included into newer versions of the Features module. So as long as your Features module is up-to-date you should be good to go. The concepts from this video do still apply.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)

More information

When you write your own custom modules, you can make them exportable to Features as well. Here we look at how to do that with the Chaos Tools (CTools) module.

Additional resources

CTools project (Drupal.org)

More information

As we wrap up and review the series, we also look at other modules that work with, or depend on, Features to provide you a jumpstart.

Additional resources

Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)