Features + Installation Profiles          February 24, 2012
David WatsonRensselaer Polytechnic Institute  Web Developer   Experimental Media and   Performing Arts Center (EMPAC)  Adj...
Best PracticesRevision ControlDev/Test/Prod workflowOne-click Deployment
Revision ControlEasier collaboration with conflict handlingChange historyAbility to revertEasier to merge in new codeBest ...
Dev/Test/ProdWorkstations check out code from Dev serverPatches are reviewed, committed to Dev  Possibly running Jenkins/H...
Dev/Test/ProdBest Practice: Use a workflow like this to ensure that only production-quality code is running on production ...
One-click DeploymentEnd-users shouldnt have to configure their sites, thats what were here for!Best practice: Let the inst...
Drupal DatabaseData  Nodes  Fields  ...Configuration  Content Types  Field Info  Rules  Views Settings  Variables
Drupal Deployment ChallengesHow do we deploy our Drupal instances from one box to another?  Moving the database?  Manually...
Drupal Deployment ChallengesHow to we use revision control with Drupal?  Works great with modules, but what about our   co...
Drupal Deployment ChallengesHow do we achieve one-click deployment?  Modules are handled through dependencies...  What abo...
THE Drupal Deployment ChallengeAll of these problems can be reduced to one:  configuration that lives in the database inst...
The AnswerInstallation Profiles provide a means of one-  click (or even fully automated!) deployment for  modules and them...
Installation ProfilesCore functionalityAllows users to perform one-time setup tasks  during installation, based on presets...
Anatomy of an Install ProfileExist in profiles/PROFILENAMEWithin each...  PROFILENAME.info – metadata/dependencies  PROFIL...
FeaturesContrib module that allows for exporting existing configuration as modulesFirst, some terminology...
Features TerminologyFeatures refers to the Features moduleFeatures packages components together - bits of configuration fo...
Why Features?Feature modules can be committed to version controlCode is more portable than database between Dev/Test/ProdO...
Commonly UsedBoxes – What custom blocks shouldve beenViews – All views are exportable!Rules – Also exportable. Very handy ...
Special CasesNot everything is exportable  Make it exportable, and contribute a patch!  Last resort: hook_(un)install()Con...
Putting it all togetherFeatures provides the means of separating configuration from contentInstall Profiles allow for pack...
Features WorkflowPerform configuration in the UIExport config as a feature and move to profiles/PROFILENAME/modules/featur...
Site Development WorkflowCreate an install profileDownload/write contrib/custom modules  Required libraries should go in t...
Site Theming WorkflowCreate an install profileDownload/create (sub)themes in profiles/PROFILENAME/themesIn .install file.....
ExampleAqueduct Install ProfileHeavily commentedUses Features to export configuration settingsPlay, experiment, use as a b...
Questions?
Get in Touch!d.o – davidwatsone – dmw@davidwatson.namet - @caughtexceptionin – linkedin.com/in/davidmwatson
Upcoming SlideShare
Loading in …5
×

Features & Installation Profiles

507 views

Published on

After providing a brief summary of common pitfalls in working with Drupal (included the dreaded Dev/Test/Prod problem), this presentation illustrates the usefulness of developing with Features and Installation Profiles to create fully revisioned sites capable of one-click deployment.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
507
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Features & Installation Profiles

  1. 1. Features + Installation Profiles February 24, 2012
  2. 2. David WatsonRensselaer Polytechnic Institute Web Developer Experimental Media and Performing Arts Center (EMPAC) Adjunct Professor Web Systems DevelopmentDrupal Consultant ~3 years in the community Specialized Generalist
  3. 3. Best PracticesRevision ControlDev/Test/Prod workflowOne-click Deployment
  4. 4. Revision ControlEasier collaboration with conflict handlingChange historyAbility to revertEasier to merge in new codeBest Practice: Use it.Reality: This is hard to do for sites!
  5. 5. Dev/Test/ProdWorkstations check out code from Dev serverPatches are reviewed, committed to Dev Possibly running Jenkins/HudsonRelease candidates are pushed to Test/Staging environmentFinal release pushed to Production along with any staged content
  6. 6. Dev/Test/ProdBest Practice: Use a workflow like this to ensure that only production-quality code is running on production servers.Reality: This is hard to do for sites!
  7. 7. One-click DeploymentEnd-users shouldnt have to configure their sites, thats what were here for!Best practice: Let the installer do all of the heavy lifting, providing sane defaults site-wideReality: ...You get the idea.
  8. 8. Drupal DatabaseData Nodes Fields ...Configuration Content Types Field Info Rules Views Settings Variables
  9. 9. Drupal Deployment ChallengesHow do we deploy our Drupal instances from one box to another? Moving the database? Manually duplicating configuration changes?
  10. 10. Drupal Deployment ChallengesHow to we use revision control with Drupal? Works great with modules, but what about our configuration? Add SQL dumps to the repository?
  11. 11. Drupal Deployment ChallengesHow do we achieve one-click deployment? Modules are handled through dependencies... What about our configuration? Write some sort of custom installation script?
  12. 12. THE Drupal Deployment ChallengeAll of these problems can be reduced to one: configuration that lives in the database instead of the codeHow do we move as much configuration into code as possible, and load it when the site is first installed?
  13. 13. The AnswerInstallation Profiles provide a means of one- click (or even fully automated!) deployment for modules and themesFeatures provide a means of exporting configuration to code as feature modules, used to satisfy a specific use case
  14. 14. Installation ProfilesCore functionalityAllows users to perform one-time setup tasks during installation, based on presets Install and enable modules/themes Run custom codeCan be used to package modules and themesPossible to select through the UI and through drush site-install!
  15. 15. Anatomy of an Install ProfileExist in profiles/PROFILENAMEWithin each... PROFILENAME.info – metadata/dependencies PROFILENAME.install – installation-specific hooks PROFILENAME.profile – other hooks modules/ - modules packaged with this profile themes/ - themes packaged in the profile libraries/ - Libraries API looks here for libs
  16. 16. FeaturesContrib module that allows for exporting existing configuration as modulesFirst, some terminology...
  17. 17. Features TerminologyFeatures refers to the Features moduleFeatures packages components together - bits of configuration for individual modules, like individual viewsThese components are taken from modules that integrate with Features, usually by providing CTools exportablesThe feature modules that Features creates contain the components that you select
  18. 18. Why Features?Feature modules can be committed to version controlCode is more portable than database between Dev/Test/ProdOverrides to feature modules can be reverted to their default stateHooks can be added to the module later (remember, feature modules are just modules!)
  19. 19. Commonly UsedBoxes – What custom blocks shouldve beenViews – All views are exportable!Rules – Also exportable. Very handy when working w/ Drupal Commerce!Strongarm – Makes the variables table exportableUUID – Paired with other modules to provide unique identifiers for content that wont change depending on the order theyre installed
  20. 20. Special CasesNot everything is exportable Make it exportable, and contribute a patch! Last resort: hook_(un)install()Content-based Configuration? Boxes module for blocks Defaultcontent for nodes Drupal Commerce7 in progress...
  21. 21. Putting it all togetherFeatures provides the means of separating configuration from contentInstall Profiles allow for packaging of modules (contrib/devel/features/custom) and themes, while offering one-click deployment
  22. 22. Features WorkflowPerform configuration in the UIExport config as a feature and move to profiles/PROFILENAME/modules/features/Implement any necessary hooks in the features .module fileMake sure the install profile depends on the new featureReinstall the site and test
  23. 23. Site Development WorkflowCreate an install profileDownload/write contrib/custom modules Required libraries should go in the profiles libraries/ directoryCreate core feature for site-wide settings, add to profiles .infoRepeat feature creation for all other functionality Remember, features are modules too; you can depend on other features!
  24. 24. Site Theming WorkflowCreate an install profileDownload/create (sub)themes in profiles/PROFILENAME/themesIn .install file... theme_enable(THEMENAME); variable_set(theme_default, THEMENAME);*hack hack hack*
  25. 25. ExampleAqueduct Install ProfileHeavily commentedUses Features to export configuration settingsPlay, experiment, use as a base, send suggestions/patches for improvement, enjoy!
  26. 26. Questions?
  27. 27. Get in Touch!d.o – davidwatsone – dmw@davidwatson.namet - @caughtexceptionin – linkedin.com/in/davidmwatson

×