Configuration Management¶
We use the Configuration Ignore Auto module to manage configuration.
In general all configuration is ignored except for configuration which should explicitly be managed by DPL CMS core.
Background¶
Configuration management for DPL CMS is a complex issue. The complexity stems from the following factors:
Site types¶
There are multiple types of DPL CMS sites all using the same code base:
- Developer (In Danish: Programmør) sites where the library is entirely free to work with the codebase for DPL CMS as they please for their site
- Webmaster sites where the library can install and manage additional modules for their DPL CMS site
- Editor (In Danish: Redaktør) sites where the library can configure their site based on predefined configuration options provided by DPL CMS
- Core sites which are default versions of DPL CMS used for development and testing purposes
All these site types must support the following properties:
- It must be possible for system administrators to deploy new versions of DPL CMS which may include changes to the site configuration
- It must be possible for libraries to configure their site based on the options provided by their type site. This configuration must not be overridden by new versions of DPL CMS.
Configuration types¶
This can be split into different types of configuration:
- Core configuration: This is the configuration for the base installation of DPL CMS which is shared across all sites. The configuration will be imported on deployment to support central development of the system.
- Local configuration: This is the local configuration for the individual site. The level of configuration depends on the site type but no matter the type this configuration must not be overridden on deployment of new versions of DPL CMS.
Howtos¶
Install a new site from scratch¶
- Run
drush site-install --existing-config -y
Add new core configuration¶
- Create the relevant configuration through the administration interface
- Run
drush config-export -y
- Append the key for the configuration to
config_ignore.settings.ignored_config_entities
with the~
prefix - Commit the new configuration files and the updated
config_ignore.settings
file
Update existing core configuration¶
- Update the relevant configuration through the administration interface
- Run
drush config-export -y
- Commit the updated configuration files
NB: The keys for these configuration files should already be in
config_ignore.settings.ignored_config_entities
.
Add new local configuration¶
- Update the relevant configuration through the administration interface
- Run
drush config-export -y
- Commit the updated configuration files
Enable a new module¶
- Add the module to the project code base or as a Composer dependency
- Create an update hook in the DPL CMS installation profile which enables the
module1. You may want to use
dpl_update.install
.
- Run the update hook locally
drush updatedb -y
- Export configuration
drush config-export -y
- Commit the resulting changes to the site configuration, codebase and/or Composer files
Uninstall a existing module¶
- Create an update hook in the DPL CMS installation profile which uninstalls the module1
- Run the update hook locally
drush updatedb -y
- Commit the resulting changes to the site configuration
- Export configuration
drush config-export -y
- Plan for a future removal of code for the module
Deploy configuration changes¶
- Run
drush deploy
NB: It is important that the official Drupal deployment procedure is followed. Database updates must be executed before configuration is imported. Otherwise we risk ending up in a situation where the configuration contains references to modules which are not enabled.