Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Configuration Management: WordPress Configurati...

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.

Tessa Kriesel

May 01, 2017
Tweet

More Decks by Tessa Kriesel

Other Decks in Technology

Transcript

  1. SCENARIO A team of developers is working on a that

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

    all likely needing to make database changes.
  3. SCENARIO Overwriting the live database is not an option. The

    content is constantly changing and untrackable.
  4. CONFIGURATION MANAGEMENT Configuration management is the act of managing your

    site configuration in code through version control.
  5. 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.
  6. 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
  7. 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.
  8. 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!
  9. 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.
  10. 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!
  11. 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/
  12. 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]
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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.
  18. 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/
  19. 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.