These instructions explain BackdropCMS.org's Configuration Management workflow.
For an overview of config management, see the
API docs.
BackdropCMS.org uses the
'Versioned staging directory'
approach with a few changes (namely the inclusion of the live-active directory
in version control).
Never commit anything into the live-active directory (unless you are on the live server)
'Live' config will only ever be added and committed to directly from the live
server. All changes that need to be made to configuration should be added from
the live server and then copied and committed to the staging directory, so it can be
safely deployed to any environment.
-
Make sure your local
settings.phpfile has the following directories defined:$config_directories['active'] = '../config/dev-active'; $config_directories['staging'] = '../config/staging';
-
Check that
live-activeis an exact match to what's on BackdropCMS.org (ask someone in a GitHub ticket or in Zulip to confirm this for you). See Updatinglive-activenote below. -
Compare the contents of the
live-activeandstagingfolders. If the step "Updatinglive-active" below was carried out, they will be the same.
Ideally, your PR should only contain config changes that are relevant to the
issue that your PR is responding to, so staging should match live-active
before you begin making your changes. If they do not match, and you have server
access, you should follow the steps in Updating live-active to make them
match before proceeding with your PR (or ask again for an admin to perform the
match).
If they don't match, you don't have server access, and you don't want to wait
further, then you can roll the config changes into your PR: copy the contents
of the live-active directory into the staging directory by first deleting
everything in staging, then copying everything from live-active
- if you have
drushinstalled locally, you can rundrush bcex - if you have
beeinstalled locally, you can runbee cex
Once they do match, you can proceed as follows.
-
Synchronize config on your local environment to bring your
dev-activedirectory up-to-date withstaging(and thus alsolive-active). You can do this via the UI at/admin/config/development/configuration.- or with Drush via
drush bcim. - or with Bee via
bee cim.
- or with Drush via
-
Perform a
git checkouton the staging directory (or, set the$config['system.core']['config_sync_clear_staging'] = 1;variable in your local copy ofsettings.php).
-
Make your changes to code and/or config in your local environment.
-
Commit just the code changes (don't include any changes to config yet).
-
Copy the contents of the
dev-activedirectory into thestagingdirectory. The best way to do this is to first delete everything instaging, then copy everything fromdev-active. These two directories need to be an exact match. If you have Drush installed, you can simply rundrush bcex. -
Confirm that all of the changes you see in the
stagingdirectory are changes you want to deploy live (usinggit statusand/orgit diff). Note that:- You do not usually want to commit changes to
system.core.json - The file
xmlsitemap.settings.jsonmay also report unintended changes
Perform a
git checkouton any changes you do not want to deploy. - You do not usually want to commit changes to
-
Commit the config changes. (The commit should contain changed files only in the
stagingdirectory, and no changes inlive-active(see Rule #1 above). -
Push your changes, create a PR, etc.
These instructions are solely for people with access to the live server who
have been asked to make sure live-active is up-to-date as per step 2 of the
Setup instructions above or are making their own changes.
-
On Backdrop's live server, perform a
git statusto see if there are any uncommitted changes to thelive-activeconfig directory. -
On the live server, visit Configuration Manager to see if there are any differences between
stagingandlive-activenot reflected in the result of step 1. -
If there are no uncommitted changes or staging/live-active differences, skip to step 5.
-
Otherwise, copy the contents of the
live-activedirectory into thestagingdirectory. These two directories need to be an exact match. You can do this by either:Delete everything in
staging, followed by copying everything fromlive-activetostaging,OR, via the command line,
cd ~/repo/wwwfollowed bydrush bcex. -
Commit the changes made to
stagingplus any uncommitted changes inlive-active:
cd ~/repogit status(to review the changes)git add <file>if there are untracked file(s) to be added to the commit.git commit -a --message="Update config files from live-active."git push origin main
- Inform the user that
live-activeis up-to-date and thatstagingandlive-activeare identical.