O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Agile Workflows

205 visualizações

Publicada em

Multiple Environments, Git, WP-CLI & WP-CFM

Publicada em: Internet
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

Agile Workflows

  1. 1. AGILE WORKFLOWS MULTIPLE ENVIRONMENTS, GIT, WP-CLI, & WP-CFM @rachwhitton WordCamp San Antonio 2017
  2. 2. @rachwhitton I write the docs for Pantheon rachwhitton rachelwhitton More about me: ‣ Support background ‣ Self-taught ‣ Remote from ATX 2 Hello, I’m Rachel
  3. 3. @rachwhitton 3 Building a new feature.. before ‣ Cowboy Coding • Working directly on production ‣ Local Development • Bring production down to your machine
  4. 4. @rachwhitton 4 Deploying a new feature.. before ‣ FTP local to production ‣ Copy the DB / Reapply settings
  5. 5. @rachwhitton 5 Why doesn’t this work?? ‣ Shit. I broke the site. ‣ But, it worked on my machine.. ‣ Yes, I did accidentally overwrite your latest work. I’m so sorry. ‣ We lost content because I copied the DB from my local. ‣ No, the page isn’t supposed to look like that.
  6. 6. @rachwhitton 6 YES! There IS a better way… ‣ Dev environments that mirror prod environments ‣ Efficient code and configuration management ‣ Continuous integration
  8. 8. @rachwhitton 8 Many Development Environments Local Development Environment ‣ Exactly what it sounds like. Cloud Development Environment ‣ Also, exactly what it sounds like.
  9. 9. @rachwhitton 9 Workflow Overview
  10. 10. GIT & WP-CFM
  11. 11. @rachwhitton 1 Tracking Code Changes
  12. 12. @rachwhitton 12 What does it track? Git is used to keep track of code between production and development environments ‣ What is code? • Core • Plugins • Themes ‣ What’s not code? • Posts and page content • wp-content/uploads directory • Configurations / Settings
  13. 13. @rachwhitton 13 What’s the point?
  14. 14. @rachwhitton 14 Intro to WP-CFM WP-CFM is designed to standardize the process of moving configuration between different environments of the same site.
  15. 15. @rachwhitton 15 What is “configuration”? Any items configurable in the WordPress Dashboard that is not content: ‣ Theme settings ‣ Plugin settings ‣ Widget placement ‣ Menus ‣ & lots more!
  16. 16. @rachwhitton 16 Version Controlled Configuration When configuration is in code.. ‣ See what has changed, by who ‣ Quickly revert configuration changes ‣ Configure once, and migrate across environments with Git ‣ Less need to copy the database
  17. 17. @rachwhitton 17 Terminology of WP-CFM Bundle ‣ A group of settings to track. Could be a single setting, or all the site’s available settings. Push ‣ Export configuration changes from the database to code. Pull ‣ Import configuration changes from code into the database.
  18. 18. @rachwhitton 18 What does it track? wp_options is the only table able to be tracked by default. This table is populated by the following: ‣ Default settings at /wp-admin/options-general.php ‣ Theme options pages, including customizer options in the row theme_mods_yourthemename ‣ Settings and options for plugins
  19. 19. @rachwhitton 19 Developer Hooks The wpcfm_configuration_items hook lets you register custom configuration items to track in a bundle:
  20. 20. @rachwhitton 20 Tips and Tricks WordPress Codex for Option Reference View settings on your site example.com/wp-admin/options.php Create as many bundles as makes sense for you.
  21. 21. Continuous Integration
  22. 22. ― Josh Koenig https://pantheon.io/blog/continuous-integration-delivery-and-deployment-behind-hype In the context of websites, Continuous Integration means frequently combining all pending code changes with the latest content from the “real world” of the production environment.
  23. 23. @rachwhitton 23 Continuous Buzzwords.. Continuous Integration Continuous Deployment Continuous Delivery
  24. 24. @rachwhitton WordPress Command Line Interface
  25. 25. @rachwhitton WP-CLI + WP-CFM Site < /> Code Configuration $ wp config pull <bundle_name> $ wp config push <bundle_name> $ wp config diff <bundle_name> $ wp config bundles $ wp config show-bundles <bundle_name>
  26. 26. @rachwhitton Repeatable, Deployable, Testable Configurations Before: Site config manually repeated on each deploy After: Site config can be applied by machine and tested within CI/CD workflow
  27. 27. @rachwhitton Examples and Resources ‣ Andrew Taylor: Automating WordPress Updates with Visual Regression ‣ Build Tools Guide ‣ Example WordPress Composer repository on GitHub
  28. 28. QUESTIONS?
  29. 29. @rachwhitton I write the docs for Pantheon rachwhitton rachelwhitton More about me: ‣ Support background ‣ Self-taught ‣ Remote from ATX 2 Hello, I’m Rachel
  30. 30. THANK YOU!