Drupal development:   The workflow     Anna Fedoruk, Sterno.ru
Gold Sponsor ofDrupalCamp Kyiv 2011
Silver Sponsors ofDrupalCamp Kyiv 2011
Table of contents1.Dark side of Drupals power2.Whats the problem and how to deal with  settings in DB3.Approach 1: migrain...
Why developers cry?Drupal is great:• Flexible• Build whatever you want• Powerful tools like CCK, Views, Rules, Panles  etc...
Why developers cry?OMG, the settings in DB!• Enabled modules and their settings• Blocks, taxonomy vocabularies, CCK conten...
Why developers cry?Migrations of DB-ed settings are very time-   consuming, boring and error-prone
What can we do?We need to:• Track configuration changes• Migrate these changesApproaches:• Migrate changes in DB via versi...
The developers best friend: DrushTons of useful tools:• Modules enabling, disabling, downloading• Updates• Cache clearing•...
Approach 1: versioned DB dumps
Our experience with Migraine• Migraine by Noosphere Networks http://ashearer.com/software/server-administration/migraine• ...
The point of MigraineMigraine knows how to deal with different types oftables: • Config tables • Content tables • Temporar...
Migraine Drush add-onA wrapper for migraine commands:• Create local DB dump• Restore DB from local dump• Full site migrati...
Migraine: workflowDeveloper 1:             Developer 2:• Works with code and    • pull  configuration          • Restores ...
Migraine: workflowMigration from @dev to @test:• Make special dump• Sync files• Migrate DBMigration from @dev to @prod:• M...
Migraine: pros and consAdvantages:• As all tables are classified, no need to think• Doesnt require anything from component...
Approach 2: code-driven development
Features: the ideaImage source: http://developmentseed.org/blog/2009/may/29/making-and-using-features-drupal
Features• Code-driven development: put all the settings  into code• Features know how to deal with Views, CCK,  Imagecahe,...
Features ecosystem• Features• Ctools exportables• Strongarm — variables• Boxes — custom blocks (replaces core «add  block»...
Feature is a module•   .info — meta-info, dependencies•   .module — place your code here•   .install — usual install file•...
Feature state can be:• Default — config in code = config in DB• Overriden — config in code != config in DB  (needs revert ...
A feature workflowDeveloper 1           Developer 2• Creates feature     • Pull• Enables feature     • Enables/revert feat...
Features management• Web UI• Drush commands:  o   view features list  o   creates new feature  o   updates code state from...
Features without UITo create feature or add component:• Add meta-info and dependencies in .info file• Update feature
What about our coworkers?feature is a module, so one can use hook_install()и hook_update() to: • Enable modules • Add role...
Contoller feature• Includes other features as dependencies• hook_install() and hook_updates() relfect  general changes in ...
Features: The Workflow
Features: advantages• Easy to work with code in VCS• Features are reusable• Beautiful
Features: disadvantages• Requires more efforts to keep systems state up-  to-date• Complex dependencies• Some components a...
Useful links• More about Migraine  o   http://www.slideshare.net/drupalindia/migraine-drupal-syncing-      your-staging-an...
Contacts    Anna Fedoruk,    Sterno.ru    afedoruk@sterno.ru    @sternodevteam    http://devteam.sterno.ru
Upcoming SlideShare
Loading in...5
×

Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011

1,554

Published on

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

No Downloads
Views
Total Views
1,554
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011"

  1. 1. Drupal development: The workflow Anna Fedoruk, Sterno.ru
  2. 2. Gold Sponsor ofDrupalCamp Kyiv 2011
  3. 3. Silver Sponsors ofDrupalCamp Kyiv 2011
  4. 4. Table of contents1.Dark side of Drupals power2.Whats the problem and how to deal with settings in DB3.Approach 1: migraine-powered workflow4.Approach 2: features-driven development
  5. 5. Why developers cry?Drupal is great:• Flexible• Build whatever you want• Powerful tools like CCK, Views, Rules, Panles etc. So whats the problem?
  6. 6. Why developers cry?OMG, the settings in DB!• Enabled modules and their settings• Blocks, taxonomy vocabularies, CCK content types• User roles, permissions• Views, Rules, Contexts, Panels...
  7. 7. Why developers cry?Migrations of DB-ed settings are very time- consuming, boring and error-prone
  8. 8. What can we do?We need to:• Track configuration changes• Migrate these changesApproaches:• Migrate changes in DB via versioned dumps• Move settings into code: Features ecosystem
  9. 9. The developers best friend: DrushTons of useful tools:• Modules enabling, disabling, downloading• Updates• Cache clearing• Dumps, backups, sync• ...• + modules add-ons
  10. 10. Approach 1: versioned DB dumps
  11. 11. Our experience with Migraine• Migraine by Noosphere Networks http://ashearer.com/software/server-administration/migraine• D6 modification by mukesh.agarwal17 http://www.blisstering.com/migraine-synchronize-your- development-staging-and-production-sites-databases-drupal-6• drush• drush add-on by Danil Semelenov
  12. 12. The point of MigraineMigraine knows how to deal with different types oftables: • Config tables • Content tables • Temporary tables • Cache tables • Ignore tables
  13. 13. Migraine Drush add-onA wrapper for migraine commands:• Create local DB dump• Restore DB from local dump• Full site migration including source code and DB• Sync files on local server with remote server
  14. 14. Migraine: workflowDeveloper 1: Developer 2:• Works with code and • pull configuration • Restores from special• Makes special dump dump• Lets Migraine know • Config migrates! about new tables (if any)• commit, push
  15. 15. Migraine: workflowMigration from @dev to @test:• Make special dump• Sync files• Migrate DBMigration from @dev to @prod:• Migration doesnt affect content tables• Manually correct content tables schema
  16. 16. Migraine: pros and consAdvantages:• As all tables are classified, no need to think• Doesnt require anything from componentsDisadvantages:• Hard to resolve conflicts in dumps• Chaos reigns• In fact you still need to think
  17. 17. Approach 2: code-driven development
  18. 18. Features: the ideaImage source: http://developmentseed.org/blog/2009/may/29/making-and-using-features-drupal
  19. 19. Features• Code-driven development: put all the settings into code• Features know how to deal with Views, CCK, Imagecahe, node types, user roles and permissions, Panels, Contexts, Rules and more
  20. 20. Features ecosystem• Features• Ctools exportables• Strongarm — variables• Boxes — custom blocks (replaces core «add block»)• Context — blocks, breadcrumbs and so on• Diff — a tool for work with features states
  21. 21. Feature is a module• .info — meta-info, dependencies• .module — place your code here• .install — usual install file• .features.incConfiguration blocks:• feature_name.<smthng>.inc — generated by Features module
  22. 22. Feature state can be:• Default — config in code = config in DB• Overriden — config in code != config in DB (needs revert or update)• Needs review — config in code != config in DB, code was changed
  23. 23. A feature workflowDeveloper 1 Developer 2• Creates feature • Pull• Enables feature • Enables/revert feature• Works with config • Config migrates!• Updates feature• commit, push
  24. 24. Features management• Web UI• Drush commands: o view features list o creates new feature o updates code state from DB o updates DB state from code (revert) o view differencies between code and DB states
  25. 25. Features without UITo create feature or add component:• Add meta-info and dependencies in .info file• Update feature
  26. 26. What about our coworkers?feature is a module, so one can use hook_install()и hook_update() to: • Enable modules • Add roles, url aliases etc. • Any custom codehook_update() to share with those who work in thesame timehook_install() to share with new developers
  27. 27. Contoller feature• Includes other features as dependencies• hook_install() and hook_updates() relfect general changes in the sites state
  28. 28. Features: The Workflow
  29. 29. Features: advantages• Easy to work with code in VCS• Features are reusable• Beautiful
  30. 30. Features: disadvantages• Requires more efforts to keep systems state up- to-date• Complex dependencies• Some components arent exportable
  31. 31. Useful links• More about Migraine o http://www.slideshare.net/drupalindia/migraine-drupal-syncing- your-staging-and-live-sites-presentation• More about Features o http://developmentseed.org/blog o http://nuvole.org/blog/code-driven-development o http://openatrium.com/
  32. 32. Contacts Anna Fedoruk, Sterno.ru afedoruk@sterno.ru @sternodevteam http://devteam.sterno.ru
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×