18
Optimize Site Deployments with Drush Saturday, 2011.11.12 – Drupal Camp Toronto 2011 Jon Peck, Owner, FluxSauce.com Audience: Intermediate Revision 2.

Optimize Site Deployments with Drush v2 (DrupalCamp Toronto 2011)

Embed Size (px)

DESCRIPTION

When a site goes live, are you crossing your fingers or are you confident that everything is configured? Are you looking to manage and optimize site deployments like any other operational process? Do you find it impossible to create development, test and production environments that act the same every time? Do you have a custom set of modules or configurations that you rely on for all your sites? This session will teach you how to optimize your site deployments with open tools such as drush, drush make, features, leveraging software versioning systems such as subversion and git. Beyond these projects, the session will train you to develop your own custom modules for consistent and precise deployments including variables, users, content types, nodes, imagecache presets, menus, blocks, theme configuration, and more. Using these techniques you can automate and optimize your deployment procedures, giving you technical flexibility and saving valuable time. Redesigned, revised and streamlined for DrupalCamp Toronto 2011.

Citation preview

  • 1. Optimize Site Deployments with DrushSaturday, 2011.11.12 Drupal Camp Toronto 2011Jon Peck, Owner, FluxSauce.comAudience: IntermediateRevision 2.

2. Who am I? Jon Peck Founded web applicationdevelopment firmFluxSauce Zend Certified PHPEngineer Web development since1998 Used Drupal for the lastthree years 3. Overview Why should you script site deployments? What are drush and drush make, and how can you usethem? What are features, and does it fit your needs? What are some recommended site deploymentstrategies? How can you develop your own strategy? 4. Why script site deployments? Reliability Track changes over time(including blame) Support multiple tiers Manage and optimize youroperations "Aaahhh!!!", CC BY 2.0 by Evil Erin @ flickr 5. What is drush? drush is a commandline shell andscriptinginterface for Drupal. 6. What can you use drush for? Manage modules Manipulate and extract sitevariables Manage users Execute MySQL queries using Execute Drupal commands Drupal config 7. What is drush make?A standardrecipe fordownloading everythingyou need for a siteinstallation. 8. Three steps for deployment Get the files (drush make) drush -y make --no-patch-txt "PATH/drush.make" FOLDER 2. Install and configure (drush) cd FOLDER drush -y site-install --config="PATH/drushrc.ENV.php 3. Enable modules (drush) drush -y en admin_menuctools ... 9. Scripting site deployments Drupal Deployment Skeleton (MIT license) http://goo.gl/09JkE (gitHub) /projects/NAME/config - stored in repository drush.*.php drush.make config.ini install.sh setup.sh rebuild.sh 10. What is the features module? 11. What can you use features for? Within your site (GUI) Leveraging drush (command line) 12. What are features limitations? Imperfect exports No site variables withoutthird-party modules No theme, block support No control logic If you cant do it in theGUI..."40+296 Hello?", CC BY 2.0 by Bark @ flickr 13. Custom modules for granular controlWith hook_install(), you can programmatically Create users, roles, permissions Create and hide blocks Create content (nodes) Import content types / CCK Create vocabularies and terms (fields) Set site variables (drush vget) Import views 14. Custom module gotchas Custom modules used like this need a user associateddrush -u 1 -y en custom_module Clear all caches after installing your custom moduledrush cc all Changes and updates need to go in hook_update_Nwithin your module 15. Deployment strategies Store everything in a versioning system Always backup both your scripts and database first! Tiered development strategy Unique database credentials for each tier When in doubt, rebuild on dev first Instead of repeating steps, do it in code Document the process 16. How can I do this? Get drush Get drush_make Define your needs. Build and document your module toolbox Start small, then scale up 17. "Question mark in Esbjerg", CC BY-SA 2.0 by Alexander Drachmann @ flickrQuestions?Note: I have not used these techniques with Apache Ant orphpUnderControl. 18. Thank you! drush http://drupal.org/project/drush drush_make http://drupal.org/project/drush_make Drupal Deployment Skeleton (DDS)[email protected] http://goo.gl/09JkE (gitHub)@FluxSauce http://fluxsauce.com drush make Generator http://drushmake.me permissions_api http://drupal.org/project/permissions_api Traditional Development... Practice for SoftwareDevelopment http://dltj.org/article/software-development-practice