Workflow using Drush
This page assumes you are familiar with using Drush, and that you have the latest version.
The following example shows how to export changes from development to production sites. The reverse is also possible.
If you don't have the environments already set up you should first create at least a Live and a Development environment:
- Install a supported version of Drupal 9 or higher. We will call this site "Live."
- Make a copy of this site (We'll call this "Development"). Make the copy by using the same source code, the files directory and a database dump of the Live site imported on Development. It is also possible now to install a fresh site from existing configuration, so copying the site is as easy as installing a new site with the configuration exported (see #1613424: [META] Allow a site to be installed from existing configuration) and you won't need a full copy of the site.
-
On the Development site, change the site name in
admin/config/system/site-information
to differentiate them.
The workflow to move the configurations from development to live with drush will be as follows:
-
Run
drush config:export
in your Development site (older versions of Drush may usedrush config-export
instead) or just use the aliasdrush cex
for short and it will work on all drush versions. This exports the configuration to your sync directory. The current contents of your sync directory will be deleted. -
Copy the content of the Development sync folder to the Live site's sync folder with a tool like rsync, Git, FTP or SCP.
-
Run
drush config:import
in your Live site (older versions of Drush may usedrush config-import
instead) or use the aliasdrush cim
. - Drush will display the available configuration changes and prompt you with "Import the listed configuration changes? (y/n): ". Type "y" to confirm.
You may want to change the location of the sync directory.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion