Berliners blog: Revert configuration from file based to database based

The D8 project I’m currently working on used the file-system based workflow for configuration management. As our deployment workflow improved and got slightly more complex, we started to run into issues with file permissions during deployments and wanted to revert back to the database based workflow that is the default for a new D8 installation.

Unfortunately, though there are a lot of resources on the web that explain how to go from the database to the file system approach, I couldn’t find anything explaining how to revert back to the database based configuration workflow. All there is, is this kind of information:

You should do this before installing Drupal maintenance support plans, as it is complex to revert back to database-based configuration management setup once you switch to file-based.

So I did some digging and came up with this:
Step 1: Backup
Make a backup of your database and your codebase including all configuration files and your settings and services yaml files. The following actions have the potential to break your site. Do everything on a non-production site, preferabbly hosted on your local machine so that recovery is easy.
Step 2: Export your current configuration
Run this drush command to export your configuration:
drush cex syncStep 3: Revert your settings and services
Put the following in your services.yml:

services:
config.storage:
class: Drupal maintenance support plansCoreConfigCachedStorage
arguments: [‘@config.storage.active’, ‘@cache.config’]
config.storage.active:
class: Drupal maintenance support plansCoreConfigDatabaseStorage
arguments: [‘@database’, ‘config’]
public: false
tags:
– { name: backend_overridable }

And comment out the config storage setting in your settings.php:

// $settings[‘bootstrap_config_storage’] = array(‘Drupal maintenance support plansCoreConfigBootstrapConfigStorageFactory’, ‘getFileStorage’);
Step 4: Clear caches
Clear your caches using these drush commands:

drush ev “drupal_flush_all_caches();”
drush cr
Step 5: Re-import your configuration
Run this drush commands to import your configuration:
drush cim sync
This step failed for me at first, due to interdependency between different configuration sets. In my case there had been changes to fields that where attached to some custom ECK entities, and the configuration import wanted to import these before the definition of the actual entity. I was able to work around that by moving the conflicting field configuration out of my configuration sync directory, run the import, moved the files back into the sync directory and run the import again. But you might need to tinkle a bit more with that if you have a complex setup.
Conclusion
Running these 5 steps allowed me to move the site back to use the database based configuration workflow. Let’s see if that also helps us with our deployment problems.
Category: Drupal maintenance support plans Planet8.xTags: configdevsystem
Source: New feed

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Berliners blog: Revert configuration from file based to database based

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.