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, 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 sync
Step 3: Revert your settings and services
Put the following in your services.yml:
services: config.storage: class: Drupal\Core\Config\CachedStorage arguments: ['@config.storage.active', '@cache.config'] config.storage.active: class: Drupal\Core\Config\DatabaseStorage 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\Core\Config\BootstrapConfigStorageFactory', '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 tinker a bit more with that depending on your 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.