On api.backdropcms.org, there is a discussion of the three most widely discussed processes for configuration management with Backdrop CMS.
- The figure 8 method
- Versioned staging directory
- Versioned extra directory
Triplo is currently working to settle on a config management workflow that is suitable for our multi-developer remote team workflow. Right now, we're leaning towards a variation of the versioned staging directory method. Basically, it's the same as that method, but simply renaming the staging directory to versioned.
It works like this:
- Every project has two config directories
- Active (NOT in GIT)
- Versioned (in GIT)
- The settings.php file for each site is configured to recognize this versioned directory to function as the staging directory for this site.
$config_directories['active'] = '../config/active';
$config_directories['staging'] = '../config/versioned';
- Every time a developer wants to import config files into their local, dev, or production environment they
- Do 'git status' to make sure that there are no local changes (in whichever environment they are about to update) to config that they need to capture
- Check the config files into the versioned directory
- Watch for any conflicts in GIT and resolve them
- Run the files through 'admin/config/development/configuration/sync' in the site (the change will be copied into the active directory).
Most of the time, we need to assume that we are generating content as far upstream as possible - or assume that we will need to copy and paste it into the upstream environment. (IN RARE CASES - If we are confident that we are the only one working on the project, we can copy the database upstream. But, if we plan to do this we MUST make sure that we have the latest database changes before we start and that no one else is making changes while we work. This is always a bit risky).
Practically, (as an example) this means that if I am developing a new feature with a new content type and generating some real content for theming/development purposes, I have two choices.
- Push Pull Push
- Create the content type locally.
- Push the content type upstream (DEV) and generate some content on DEV.
- Pull the database (with my new content) back locally for my theming.
- Push the CSS/CODE changes upstream (DEV)
- Pull Push
- Simply configure the content type and the content on DEV site.
- Pull the config AND database locally and commit the config changes to versioned directory. Then do my theming/development locally.
- Push the theme/css back to DEV (and if necessary config changes).
In either scenario any locally generated content should be cut and pasted or recreated in DEV environment.
We may need to experiment with the process, but in theory we need to keep the following things in mind.
- The active config files should never be in GIT.
- We should never be copying the database upstream. Never copy database from LOCAL to DEV or from DEV to PROD
(exceptions are made carefully and at great risk).
- Always create content as far upstream as possible or be prepared to cut and paste it.