WP-CFM: Storing & Deploying WordPress Database Configurations

Pantheon
Pantheon Posts
Published in
3 min readDec 13, 2015

This article was originally published by Emily Miller on Dec. 4, 2015 on the Pantheon blog.

Managing configuration and content in the same database has long been a challenge for teams of developers working with WordPress. In order to make life easier, the team at ForumOne created the WP-CFM plugin. This free plugin allows developers to copy database configuration to and from the filesystem, without needing to copy the entire database. We caught up with Andy Hieb of ForumOne to learn more about the plugin and its recent improvements.

“Any time you have a content management system — like Drupal or WordPress — with configuration and content in the same database, you face certain challenges,” Hieb said. “Specifically, how to deploy the configuration side of that, but not the content side. Deploying configuration is something you want to script and automate, and there are various approaches to doing that. In the Drupal space, there has been a lot of work over the years on the contrib side — the big players there being Chaos Tools export, and the Features module. And then Drupal 8 has the configuration management initiative baked into core. WordPress has not had as much development effort on this front, although it does have a nice approach to storing much of its configuration in the wp_options table. So, we’re really excited about potential for the WP-CFM plugin.”

Why WP-CFM? A Better Deployment Workflow for All

All CMS websites have the design challenge of separating application configuration from application content. You can’t just “copy out” the database as part of a deployment, because that would mean significant downtime, and it’s not feasible if your site accepts user input such as comments. And of course “doing it live” is slow and fraught with human error.

By storing configuration in files that are version controlled, WP-CFM allows users to keep config separate from database content, as well as making it deployable. Configuration for a new feature or change can be released along with the code. This is the best-practice way to handle changes to live sites at scale.

WP-CFM allows developers to:

  • Export configuration settings to JSON files
  • Track these files in version control, along with the rest of the site’s code
  • When deploying, they can script the configuration actions (e.g. import from JSON)

By automating this process, developers are not only saving time and mitigating technical risks, but mitigating the risks of human error during deployment as well. They are also recording configuration changes over time. This allows teams to further standardize and automate the entire development workflow, with accountability across the board.

Recent Improvements

The team at ForumOne originally launched the plugin in 2014, and has since made lots of improvements to move the project forward. Pantheon has also been supporting development of the plugin as it’s clear how well WP-CFM fits with the Pantheon workflow.

For those familiar with WP-CFM, a couple notable recent updates include:

  • Expanded Import/Export Options: Developers are now allowed options around the import/export process — they can specify where to store the export in the file system. Have sensitive information in these files? No problem, this option allows users to keep that information out of the public web root entirely.
  • Diff Feature Fix: Users can log in to WordPress, go to their WP-CFM admin page, and see configuration differences between the filesystem and database — this allows users to sanity check before automated import and also ensures accountability.

Check out the changelog for more information on what’s new with the WP-CFM.

Moving the Project Forward

As with all open source projects, community buy-in is important for the WP-CFM to get integrations with other plugins. “One challenge in the WordPress community is that plugin usage is often fragmented,” Hieb said. “So hopefully the community will rally around the configuration management approaches they want to use.”

Want to get involved? Review the code in Github, and add integrations to your plugins!

--

--

Pantheon
Pantheon Posts

We’re building the world’s best WebOps (Website Operations) platform for Drupal and WordPress.