Building and Deployment of Drupal sites with Features and Context


Published on

Slides for Features and Context modules in Drupal presented at Drupalcamp Bulgaria 2011.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  •   Hello everyone, My name is Svilen Sabev. I started exploring open source since 2003 and met Drupal in 2007. I work for Propeople more than 4 years. I guess you already know that Propeople is a great company.
  • Building and Deployment of Drupal sites with Features and Context

    1. 1. <ul><li>Building and Deployment of </li></ul><ul><li>Drupal sites with </li></ul><ul><li>Features and Context </li></ul><ul><li>by Svilen Sabev </li></ul><ul><li>at DrupalCamp Sofia 2011 </li></ul><ul><li>on 23 Jan 2011 </li></ul>
    2. 2. <ul><li>We love Drupal because </li></ul><ul><li>Drupal is robust content management system with great possibilities that can be used to build almost any kind of website </li></ul><ul><li>Drupal has a lot of contributed modules to solve problems and to make different desirable solutions </li></ul><ul><li>Drupal has great community all over the world </li></ul>
    3. 3. <ul><li>Frequent tasks </li></ul><ul><li>create content types and CCK fields </li></ul><ul><li>create taxonomy vocabularies and terms </li></ul><ul><li>configure imagecache presets </li></ul><ul><li>create views to display content </li></ul><ul><li>build panel pages to position content </li></ul><ul><li>setup user roles and permissions </li></ul>
    4. 4. <ul><li>Problems </li></ul><ul><li>Business decisions and configuration settings are in database </li></ul><ul><li>Making changes and deployment is time consuming and error prone process </li></ul><ul><li>No history log of modifications </li></ul><ul><li>No organization of site’s features </li></ul>
    5. 5. <ul><li>The Solution </li></ul><ul><li>A module that would automatically package any of your site’s features into another module for you to download and share </li></ul>
    6. 6. <ul><li>Features module </li></ul><ul><li>Features is a Drupal module created by Development Seed </li></ul><ul><li>Features provides a UI and API for taking different site building components from modules with exportables and bundling them together in a single feature module </li></ul><ul><li> </li></ul>
    7. 7. <ul><li>Features moves configuration from the database to code </li></ul><ul><li>Features lets you organize your project </li></ul><ul><li>Features lets you control your site’s features with version-controlled systems </li></ul><ul><li>Features makes deployment easy </li></ul><ul><li>Features lets you share and reuse configurations </li></ul>
    8. 9. <ul><li>What can be exported? </li></ul><ul><li>Content types </li></ul><ul><li>CCK fields </li></ul><ul><li>Views </li></ul><ul><li>Imagecache presets </li></ul><ul><li>Ctools (Panels, Variables, Feeds, Data and more) </li></ul><ul><li>User roles and permissions </li></ul><ul><li>Menus and menu links </li></ul><ul><li>Input formats </li></ul><ul><li>Context </li></ul>
    9. 10. <ul><li>What is difficult to be exported? </li></ul><ul><li>Vocabularies </li></ul><ul><li>Nodequeues </li></ul><ul><li>Nodes, Terms and Users * </li></ul><ul><li>because Features hates sequential IDs </li></ul><ul><li> </li></ul><ul><li> </li></ul>
    10. 11. <ul><li>Let’s see Features in demo </li></ul>
    11. 12. <ul><li>Think how to organize </li></ul><ul><li>Separate features by context </li></ul><ul><li>(News, Events, Gallery, Videos, Homepage) </li></ul><ul><li>Separate features by components </li></ul><ul><li>(Imagecache, Views, Panels, Permissions, Menus) </li></ul><ul><li>Make reusable features </li></ul><ul><li>Don’t share same CCK field with different configurations between two features </li></ul><ul><li>Be careful with dependencies </li></ul>
    12. 13. <ul><li>Deployment process </li></ul><ul><li>Build on development site locally </li></ul><ul><li>Show staging site to the client </li></ul><ul><li>Update the result on production site </li></ul>
    13. 14. <ul><li>Workflow of Deployment Process in team </li></ul><ul><li>Darin create a content type and the CCK fields on his local development site. He package everything as a feature and commit that module to the repository </li></ul><ul><li>I update my repository, install the feature and automatically receive the configuration that Darin created. I add couple views and imagecache presets and attach them to that feature. </li></ul><ul><li>Darin update and make adjustments on fields. He commits the changes. </li></ul><ul><li>I update and overwrite styles for views and commit again. </li></ul><ul><li>Jens update his repository and fixes our configurations. He commits the changes to our staging site and install the feature. If the client is satisfied he can upload the feature to production site. </li></ul>
    14. 15. <ul><li>The advantages </li></ul><ul><li>Every feature modification is logged </li></ul><ul><li>Features makes deployment easy </li></ul><ul><li>Features makes reuse of configuration possible </li></ul><ul><li>Changes by clients will be logged and can be easily reverted. </li></ul>
    15. 16. <ul><li> Component states </li></ul><ul><li>Feature keeps tracks on following things to define its component states: </li></ul><ul><li>Current configuration in code </li></ul><ul><li>Change of current configuration in code with svn update </li></ul><ul><li>Configuration represented in database </li></ul><ul><li>Features determines components in following states: </li></ul><ul><li>Default, Overridden, Needs Review, Rebuilding, Conflict </li></ul>
    16. 17. <ul><li>Drush and Features </li></ul>drush features List all the available features on your site and their status. drush features-export [feature name] [component list] Write a new feature in code containing the components listed. drush features-update [feature name] Update the code of an existing feature to include any overrides from your database drush features-revert [feature name] Revert a feature in your site's database to the state described in your code drush features-diff [feature name] Show a diff between a feature's database components and those in code.
    17. 18. <ul><li>Kit </li></ul><ul><li>A set of guidelines that facilitates </li></ul><ul><li>building compatible and interoperable </li></ul><ul><li>Feature modules. </li></ul><ul><li>KIT Feature Specification (kitf 1.0-draft) </li></ul><ul><li>KIT Theme Specification (kitt 1.0-draft) </li></ul><ul><li> </li></ul>
    18. 19. <ul><li>Context module </li></ul><ul><li>Context allows you to manage contextual conditions and reactions for portions of your site. </li></ul><ul><ul><li>Conditions are set of rules that are checked during page load to see what context is active. </li></ul></ul><ul><ul><li>Any reactions that are associated with active contexts are then fired. </li></ul></ul><ul><li>Think for context like sections of the site </li></ul>
    19. 20. <ul><li>Basic “News” context </li></ul><ul><li>Conditions </li></ul><ul><ul><li>Menu item “News” is clicked </li></ul></ul><ul><ul><li>Node type “News” is opened </li></ul></ul><ul><li>Reactions </li></ul><ul><ul><li>Menu item “News” is active </li></ul></ul><ul><ul><li>News categories block in right sidebar </li></ul></ul>
    20. 21. <ul><li>Define context layouts </li></ul><ul><li>layouts[columns][name] = &quot;Columns&quot; </li></ul><ul><li>layouts[columns][description] = &quot;Three column layout.&quot; </li></ul><ul><li>layouts[columns][stylesheet] = &quot;layout-columns.css&quot; </li></ul><ul><li>layouts[columns][template] = &quot;layout-columns&quot; </li></ul><ul><li>layouts[columns][regions][] = &quot;header&quot; </li></ul><ul><li>layouts[columns][regions][] = &quot;content&quot; </li></ul><ul><li>layouts[columns][regions][] = &quot;left&quot; </li></ul><ul><li>layouts[columns][regions][] = &quot;right&quot; </li></ul>
    21. 22. <ul><li>Drupal Thursdays </li></ul><ul><li>For you that want to learn advanced Drupal from the developers and themers in Propeople </li></ul><ul><li>Location: Sofia, Pirin 40A street </li></ul><ul><li>Date: Every Thursday from ~19.30 </li></ul><ul><li>More info: </li></ul>
    22. 23. <ul><li>We’re hiring  </li></ul><ul><li>Team Lead / Senior PHP developer </li></ul><ul><li>PHP / Drupal developers </li></ul><ul><li>Senior HTML developer </li></ul><ul><li>Interested? </li></ul><ul><li>Talk with Welin or Rumen </li></ul>
    23. 24. <ul><li>Thank You! </li></ul><ul><li>Any questions? </li></ul>