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.

Continuous Integration and Deployment Patterns for Magento

5,721 views

Published on

Fabrizio Branca (@fbrnc) speaking about "Continuous Integration and Deployment Patterns for Magento" at the Meet Magento Conference 2015 in New York City (#mm15ny)

Published in: Technology

Continuous Integration and Deployment Patterns for Magento

  1. 1. for Magento
  2. 2. San Francisco, CA Janine Fiona that’s me Leo
  3. 3. for Magento = 18.55 slides/min (1 slide every 3.23 sec)
  4. 4. for Magento 4
  5. 5. (and that’s ok…)
  6. 6. type “YESIKNOWWHATIMDOING” + click automatically
  7. 7. Continuous Development Continuous Delivery Continuous Integration Continuous Deployment Continuous Monitoring Continuous Jenkins Everything sounds better with “continuous”
  8. 8. “Deployment Pipeline”
  9. 9. every time you change code passed all tests deployed to production
  10. 10. One size doesn’t fit all!
  11. 11. What is it? A simple shell script. That’s it! No Ant, no Phing, no fancy PHP tool/framework Where is it used? In the build job of a Jenkins server What does it need to know? Where to get all the source code from What does it do? add metadata, composer, minify, packaging, upload to S3
  12. 12. What is it? A couple of chef cookbooks. Run by AWS OpsWorks or Vagrant,… Where is it used? On the target servers What does it need to know? The role of the server (web server, devbox, Redis,…) What does it do? Installing and configuring web server, PHP, MySQL, Redis,…
  13. 13. What is it? A simple shell script. Or the “deploy” chef cookbook Or EasyDeployWorkflows Where is it used? On the target servers What does it need to know? How to get the build and where to deploy it to What does it do? (Resetting the environment), getting the build, extracting it, managing release folders and symlinks, triggering installer, cleanup old releases
  14. 14. What is it? A simple shell script. Sometimes triggered inside “deploy” before_migrate.rb Where is it used? On the target servers, called from deployment step What does it need to know? What environment this is. Injected settings What does it do? Run modman, apply settings, trigger update scripts, customize cache prefix, indexing,…
  15. 15. doesn’t know anything about the app, except where to get it from and where to put it knows how to get the app up and running
  16. 16. no creating CMS blocks no creating product attributes no updating of any configuration settings! no clearing the cache no purging CDN or Reverse Proxy content!
  17. 17. media directory (sometimes minified) Database dump (Vanilla) Magento core Modules Scripts Settings Tools
  18. 18. Urls Database Settings Payment Provider Configuration Feature Flags… Everything that’s different between two environments
  19. 19. Every file is a potential security risk Don’t deploy anything you don’t need to operate the website
  20. 20. .git* ./htdocs/dev ./htdocs/includes ./htdocs/downloader ./htdocs/pkginfo ./htdocs/LICENSE* ./htdocs/RELEASE_NOTES.txt ./htdocs/phpunit.xml* ./htdocs/*.sample ./.modman/Aoe_TemplateHints ./.modman/Aoe_Profiler ./.modman/EcomDev_PHPUnit composer.* …
  21. 21. production, staging,… devbox and integration environment
  22. 22. Use Jenkins to implement a full deployment pipeline for your projects! Test our Open Source Magento modules with Travis CI!
  23. 23. Vagrant Boxes
  24. 24. Awesome stuff Every single line potentially can break production! Bratwurst (Germans) Donut (Americans) Pizza (Italians)
  25. 25. master Feature B Feature A Hotfix (if master is not modified) Hotfix (if master is modified) Feature C build install on integration tests build install on integration tests install on deploy build install on integration tests deploy to stage deploy to prod build install on integration tests deploy to stage deploy to prod build install on integration tests deploy to stage deploy to prod single mainline no commits, only --no-ff merges
  26. 26. Version Control GIT, SVN,… PHP lint
  27. 27. Version Control Code Reviews Crucible,…
  28. 28. Code Reviews Build Files DB Installer Settings Triggered by commits, by time or manually Build job in Jenkins minify js/css .tar.gz “virtual package” (revision)
  29. 29. Version Control Code Reviews Build Files DB Installer Settings eat your own dogfood
  30. 30. Build Files ler Settings Static Code Analysis CodeSniffer php-pmd php-cpd php-depend
  31. 31. Static Code Analysis Install on “Integration” First system where code from all developers/teams meets each other unstable system, might be broken, will be rebuilt without warning
  32. 32. Install on “Integration” Unit Tests PHPUnit
  33. 33. Unit Tests Integration Tests MPMD broken links, HTTP headers, W3C validity,… Test features that rely on other parts (e.g. framework, external services,…) External components (SSL, Redis, Varnish, ERP, Data Import,…) Basically this is also PHPUnit, but addressing other things
  34. 34. Integration Tests Acceptance Tests Selenium
  35. 35. US languagesUK DE FRIT
  36. 36. size 640 980 1280 1900 US languagesUK DE FRIT
  37. 37. language size browser
  38. 38. language size browser touchstone job
  39. 39. Acceptance Tests Install on “Staging” Behat, PDIFF,… Same setup as production, but different machines Client QA / approval
  40. 40. Install on “Staging” Stress Tests JMeter Spin up EC2 instances to produce traffic
  41. 41. Again: multiple servers or autoscaling setup Stress Tests Install on “Production” A/B Deployments on different scales Plan B: rollback Zero Downtime
  42. 42. Stress Tests Install on “Production”
  43. 43. Deployment != Feature Release
  44. 44. Install on “Production” Enable Features
  45. 45. Version Control Code Reviews Build Static Code Analysis Install on “Integration” Unit Tests Integration Tests Acceptance Tests Install on “Staging” Install on “Production” Enable Features
  46. 46. Pipeline Visualization #284 #283 #282 #281 #280 Build Static Code Analysis Unit Tests Install on “Integration” Integration Tests Acceptance Tests #285 for team dashboards
  47. 47. Tom E.
  48. 48. Follow me on twitter! My blog

×