Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Depolying Drupal with Git, Drush Make and Capistrano


Published on

Published in: Technology
  • Be the first to comment

Depolying Drupal with Git, Drush Make and Capistrano

  1. 1. Deploying Drupalwith Git, Drush Make, and Capistrano chad fennell
  2. 2. whoami• web developer• U of MN Libraries•• cfennell• twitter: chad__fennell
  3. 3. History
  4. 4. What is this all about?
  5. 5. Software Deployment“Software deployment is all of the activitiesthat make a software system available foruse.”
  6. 6. Take Many Small Risks Frequent Releases Small Releases with A Safety Line (e.g. Rollback)
  7. 7. “In software, when something is painful, theway to reduce pain is to do it more frequently,not less.” - Jez Humble, David Farley Continuous Delivery
  8. 8. Automated Deployments Are...• Free of PEBKAC/manual errors• Repeatable/shareable and therefore debuggable• Documented • Repeatable + documentation = collaboration• Testable, as in Continuous Integration• Time savers for your top earners, developers• A way to dramatically lower “cycle time” - Jez Humble, David Farley Continuous Delivery
  9. 9. Great, will this fix my code? Nope.
  10. 10. “A working software application can beusefully decomposed into four components:executable code, configuration, hostenvironment, and data.” - Jez Humble, David Farley Continuous Delivery
  11. 11. cap-drupal, a modest first step ✓ Executable Code: git ✓ Configuration: Capistrano (sort of) to me after Drupal 8 Host Environment: git, Chef?, Puppet? TBD Data: Backup and Migrate + cap-drupal? - Jez Humble, David Farley Continuous Delivery
  12. 12. “ needn’t automate everything at once” - Jez Humble, David Farley Continuous Delivery
  13. 13. cap-drupal components Manage Module, Library and Theme Code Manage the Site Build Automate Some of the Things
  14. 14. Why use Git?• Stability • Created by Linus Torvalds in 2005 for Linux kernel development.• (Crazy) Speed• Popularity• Design• Why I chose Git - Aristotle Pagaltzis•
  15. 15. Drush“Drush is a command line shell and scriptinginterface for Drupal, a veritable Swiss Armyknife designed to make life easier for thoseof us who spend some of our working hourshacking away at the command prompt.”e.g. $ drush dl drupal
  16. 16. Drush Make“Drush make is an extension to drush thatcan create a ready-to-use drupal site,pulling sources from various locations. Itdoes this by parsing a flat text file (similarto a drupal .info file) and downloading thesources it describes. In practical terms,this means that it is possible todistribute a complicated Drupaldistribution as a single text file.”
  17. 17. foo.make  
  18. 18. Drush Make• Build with a single command $ drush make foo.make
  19. 19. Drush Make Highlights• Drush Make files are “Versionable”• Build with a single command • $ drush make foo.make --working-copy • Preserves .git and .svn directories• Caches downloads locally • ~/.drush/cache/downloads • ~/.drush/cache/git• Downloads in parallel• SCM agnostic (e.g. vs git submodules)• Part of Drush (5)
  20. 20. Capistrano"Capistrano is a developer tool for deployingweb applications. It is typically installed on aworkstation, and used to deploy code fromyour source code management (SCM) to one,or more servers."
  21. 21. Why Capistrano, isnt that,like, Rails, man?? A Common Scenario: Start with manual deployment, then automate a few things with bash, then the the bash scripts become complex, and then find your way to a deployment tool. ...and Capistrano was simple...
  22. 22. Simple to Install$ gem install capistrano$ gem install capistrano-ext$ gem install railsless-deploy
  23. 23. Robust But Simple Config
  24. 24. Gemfile...Not so Different
  25. 25. Simple to Deploy$ cap development deploy (Includes rollback on failure)
  26. 26. Simple to Roll Back$ cap development deploy:rollback
  27. 27. A little deeper...
  28. 28. On your web server, Capistrano isbasically just a directory structure.
  29. 29. symlink to stuff you don’t have in an SCM system
  30. 30. Apache Points to “Current” (mod_vhost_alias)“Quick guide to wildcard Apache vhosts”
  31. 31. LIVEDEMO!
  32. 32. Alternatives (Many)• Jenkins• Aegir (uses Drush Make too)• Pantheon / Acquia Dev Cloud• Puppet, Chef, CFEngine• Bash Scripts• Git / Subversion Hooks• Drush Make: Composer (D7), Phing, Pake
  33. 33. Next Steps?
  34. 34. • Commit Hooks + Jenkins• Commit Hooks + Selenium• VM: e.g. Chef + Vagrant for Full Environments• Support multisite (join forces)?• Database + Snapshots on Releases
  35. 35. Deployment Pipeline
  36. 36. Thanks!