Configuration Management: WordPress Configuration in Code

Configuration Management: WordPress Configuration in Code

Problem: You have a team of developers and you all work locally pushing up to one central development environment. Your client has been adding content to your live environment while your team is working away on other features. Your client decides they want to add calendar functionality to the site, which you can easily do with a plugin. However, configuring this plugin requires database changes. If you make any changes to your database, or even the development environment database, you are going to have to go make those changes again on the live site since they already have content in the site and you can’t copy over that entire database.

UGH! There has got to be a better way! We have all been in this situation more than once. So how do we get out of this situation?!

Solution: Configuration Management! We will talk about what configuration management is and how you can start to use it in your current workflow. We will also talk about WordPress plugins that make our lives easier by using similar methodologies.

3734ba5f47b3e579b367b4202aaba163?s=128

Tessa Kriesel

May 01, 2017
Tweet

Transcript

  1. CONFIGURATION MANAGEMENT INTRO TO

  2. ABOUT ME Agency & Community Engineer 
 Instructor Founder

  3. REACH OUT @tessak22
 me@tessak22.com tessakriesel.com Find me at other WordPress

    events!
  4. SCENARIO A team of developers is working on a that

    is already live, adding additional functionality.
  5. SCENARIO Each developer is working in their own feature branch,

    all likely needing to make database changes.
  6. SCENARIO Content from the live environment needs to be tested

    against new features being created.
  7. SCENARIO Overwriting the live database is not an option. The

    content is constantly changing and untrackable.
  8. SCENARIO Branches Joe (Theme) Joanna (Page Cache Setup) John (MailChimp)

    Environments Dev Test Live
  9. WHAT IS SITE CONFIGURATION?

  10. SITE CONFIGURATION Your site’s configuration includes items configurable in the

    CMS dashboard not related to content.
  11. None
  12. SO WHAT IS CONFIGURATION MANAGEMENT?

  13. CONFIGURATION MANAGEMENT Configuration management is the act of managing your

    site configuration in code through version control.
  14. None
  15. WP-CFM CONFIGURATION MANAGEMENT PLUGIN

  16. PERKS OF WP-CFM ➤Less need to copy the database. ➤No

    need to manually apply database setting changes. ➤ Track and migrate configuration files using git, subversion, etc.
  17. WHAT CAN IT TRACK wp_options is the only table that

    can be tracked by the plugin. This table is populated by the following sources: ➤ Default settings (/wp-admin/options-general.php ➤ Theme options - includes customizer options stored in the row theme_mods_yourthemename ➤ Settings and option pages for plugins
  18. TERMINOLOGY Bundle: A group of settings to track. This could

    be a single setting, or all the site's available settings.
 Push: Export configuration from your database to the filesystem.
 Pull: Import configuration from the filesystem into your database.
  19. SCENARIO Branches Joe (Theme) Joanna (Page Cache Setup) John (MailChimp)

    Environments Dev Test Live
  20. DEMO LET’S SEE HOW IT WORKS!

  21. STEPS TO CONFIGURE WP-CFM 1. Install WP-CFM plugin 2. Activate

    plugin 3. Go to Settings > WP-CFM 4. Click Add Bundle 5. Check the settings you would like included in each bundle. 6. Save Changes 7. Push your bundle 8. Commit your code changes (the newly created json file) 9. From your other environment, follow steps 1-3, where you should see the bundle someone else setup. Click Pull. 10.Repeat!
  22. TIPS & TRICKS ‣ WordPress Codex for Option Reference
 https://codex.wordpress.org/

    Option_Reference ‣ View Settings on Your Site
 http://yoururl.com/wp-admin/ options.php ‣ Create as many bundles as makes sense for you. I like to see WordPress settings in one and plugins in a different bundle.
  23. MAJOR SECURITY CONSIDERATION WP-CFM, by default, will store bundles in

    a directory called “config” within wp-content. This directory, by default is usually web accessible. Your bundles can include API keys - change permissions on this directory!
  24. WP-CLI WP-CLI is a set of command-line tools for managing

    WordPress installations. You can update plugins, configure multisite installs and much more, without using a web browser. http://wp-cli.org/
  25. WP-CFM + WP-CLI wp config pull [bundle_name] wp config push

    [bundle_name] wp config diff [bundle_name] wp config bundles wp config show_bundle [bundle_name]
  26. CHEAT SHEET: SETTINGS > GENERAL Site Title: blogname Tagline: blogdescription

    Email Address: admin_email Membership: users_can_register New User Default Role: default_role Timezone: timezone_string Date Format: date_format Time Format: timezone_string Week Starts On: start_of_week
  27. CHEAT SHEET: SETTINGS > WRITING Default Post Category: default_category Default

    Post Format: default_post_format Mail Server: mailserver_url Port: mailserver_port Login Name: mailserver_login Password: mailserver_pass Default Mail Category: default_email_category Update Services: ping_sites
  28. CHEAT SHEET: SETTINGS > READING Front page displays: show_on_front Front

    page: page_on_front Posts page: page_for_posts Blog pages show at most: posts_per_page Syndication feeds show the most recent: posts_per_rss For each article in a feed, show: rss_use_excerpt Search Engine Visibility: blog_public
  29. CHEAT SHEET: SETTINGS > MEDIA Thumbnail Width: thumbnail_size_w Thumbnail Height:

    thumbnail_size_h Crop thumbnails to exact dimensions: thumbnail_crop Medium Width: medium_size_w Medium Height: medium_size_h Large Width: large_size_w Large Height: large_size_h Organize my uploads into month and year based folders: 
 uploads_use_yearmonth_folders
  30. CHEAT SHEET: SETTINGS > PERMALINKS Permalink Common Settings: permalink_structure Category

    Base: category_base Tag Base: tag_base
  31. CHEAT SHEET: THEMES, WIDGETS & PLUGINS Theme Settings (Customizer settings):

    theme_mods_themename Widgets: widget_nameofwidget Plugins (Activated): active_plugins 3rd party plugins may include their own set of settings. Check WP-CFM after installing a plugin to see if there are any new/applicable name options. For example: Yoast SEO has it’s own settings that can be included in a bundle.
  32. OTHER HELPFUL RESOURCES ➤ Pantheon Documentation
 https://pantheon.io/docs/wp-cfm/ ➤ WP-CFM Documentation


    http://forumone.github.io/wp-cfm/ ➤ WordPress Codex Options Reference
 https://codex.wordpress.org/Option_Reference ➤ Advanced Custom Fields Synchronized JSON
 https://www.advancedcustomfields.com/resources/synchronized-json/
  33. FEEDBACK I would love to hear what you think! http://tessakriesel.com/feedback/

    Anonymous feedback is a-okay, none of the form fields are required.