We recently changed the way we deploy our Drupal site on our testing environment to a docker image.

The issue is that we were using a file based configuration. The current applied configuration is not deployed with the image, only the expected configuration. So we end up with a docker container with an empty active folder and a sync folder with the latest configuration.


As a result, running drush ci crashes as it tries to create everything anew on a database on which was already applied most of the configuration.

Our strategy was to go back to a database based configuration (the default of Drupal). We tried this. The results were a broken website and it was impossible to run the drush cr anymore.

Crash when running drush cr:

root@7ef127fc56af:/var/www/CMS# vendor/bin/drush cr PHP Fatal error: Call to undefined function system_rebuild_module_data() in /var/www/CMS/web/core/includes/common.inc on line 1136 PHP Stack trace: PHP 1. {main}() /var/www/CMS/vendor/drush/drush/drush:0 PHP
2. require() /var/www/CMS/vendor/drush/drush/drush:4 PHP 3. Drush\Runtime\Runtime->run() /var/www/CMS/vendor/drush/drush/drush.php:66 PHP 4. Drush\Runtime\Runtime->doRun() /var/www/CMS/vendor/drush/drush/src/Runtime/Runtime.php:41 PHP 5. Symfony\Component\Console\Application->run() /var/www/CMS/vendor/drush/drush/src/Runtime/Runtime.php:112 PHP 6. Symfony\Component\Console\Application->doRun() /var/www/CMS/vendor/symfony/console/Application.php:148 PHP 7. Symfony\Component\Console\Application->doRunCommand() /var/www/CMS/vendor/symfony/console/Application.php:255 PHP 8. Symfony\Component\Console\Command\Command->run() /var/www/CMS/vendor/symfony/console/Application.php:978 PHP 9. Consolidation\AnnotatedCommand\AnnotatedCommand->execute() /var/www/CMS/vendor/symfony/console/Command/Command.php:255 PHP 10. Consolidation\AnnotatedCommand\CommandProcessor->process() /var/www/CMS/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:405 PHP 11. Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() /var/www/CMS/vendor/consolidation/annotated-command/src/CommandProcessor.php:151 PHP 12. Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() /var/www/CMS/vendor/consolidation/annotated-command/src/CommandProcessor.php:181 PHP 13. call_user_func_array:{/var/www/CMS/vendor/consolidation/annotated-command/src/CommandProcessor.php:235}() /var/www/CMS/vendor/consolidation/annotated-command/src/CommandProcessor.php:235 PHP 14. Drush\Commands\core\CacheCommands->rebuild() /var/www/CMS/vendor/consolidation/annotated-command/src/CommandProcessor.php:235 PHP 15. drupal_rebuild() /var/www/CMS/vendor/drush/drush/src/Commands/core/CacheCommands.php:203 PHP 16. drupal_flush_all_caches() /var/www/CMS/web/core/includes/utility.inc:52 [error] Drush command terminated abnormally due to an unrecoverable error. Error: Call to undefined function system_rebuild_module_data() in /var/www/CMS/web/core/includes/common.inc, line 1136


  • Did we choose the right solution by trying to fallback on a database based configuration, or is there a better idea?

We could find a way to keep the active configuration saved and put it back after each deployment, however, we use different technologies on our environments (for example we use docker for our testing environment), at first glance it seems quite complex to me.

  • How can we change to a database based configuration?


root@7ef127fc56af:/var/www/CMS# vendor/bin/drush status
 Drupal version : 8.7.12                                            
 Site URI       : default                                           
 DB driver      : mysql                                             
 DB hostname    : __DB_HOST__                                       
 DB port        :                                                   
 DB username    : __DB_USER__                                       
 DB name        : __DB_NAME__                                       
 PHP binary     : /usr/bin/php5.6                                   
 PHP config     : /etc/php/5.6/cli/php.ini                          
 PHP OS         : Linux                                             
 Drush script   : /var/www/CMS/vendor/bin/drush             
 Drush version  : 9.3.0                                             
 Drush temp     : /tmp                                              
 Drush configs  : /var/www/CMS/vendor/drush/drush/drush.yml 
 Drupal root    : /var/www/CMS/web                          
 Site path      : sites/default   
  • 1
    Not sure what the difference between the actual and the expected configuration is. You just need to find a strategy to get the live config to your local dev copy and then export it once and from then on ensure that your exported config lands on live somehow and them import it there. Maybe use strategies like config ignore or config split to have different configuration in different environments. That's all. Please for your own sake don't switch back from configuration management to database configuration. You just need to find the right strategy to deploy your config. – leymannx Sep 4 '20 at 9:56
  • BTW, both your PHP and your Drupal are outdated. Consider upgrading ASAP. – leymannx Sep 4 '20 at 10:01
  • Can you confirm that your current strategy is this: File system based workflow? – sonfd Sep 4 '20 at 10:49
  • @sonfd yes this our current workflow. Sync = Staging in our case. – Gabriel Sep 4 '20 at 11:59
  • @leymannx So, I have my testing environment (for validation purposes) and my dev environment. When I dev locally, I then export the configuration changes I made using drush cex and commit them in sync. When I deploy, I only deploy the content of sync. Since we're using a file based configuration, to import the new configuration, Drupal looks at the diff between active/sync. Since active is not commited (as it's environment related), it's empty. So the diff is actually the full sync folder – Gabriel Sep 4 '20 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.