Working with configurations using Drush
This page assumes you’re familiar with using Drush and have the latest version installed.
The following example demonstrates how to export changes from development sites to production sites. The reverse is also possible.
1. Install Drupal 8. We'll refer to this site as "Live".
2. Make a copy of this site (we’ll call it "Development"). Use the same source code, files directory, and a database dump from the Live site, then import it into Development. In Drupal 7, you’d only need the database dump and uploaded files, but in Drupal 8 other parts of the file directory are relevant, including configuration and PHP files. Make a full copy of the site.
Once improved configuration installation becomes available, it will be possible to install a new site directly from existing configuration. Until then, a full site copy is needed.
3. On the Development site, change the site name via admin/config/system/site-information
.
4. In your terminal, navigate to the Development site and run the command:
drush config:export
(In older versions of Drush, use drush config-export
instead.) This exports the configuration to your sync directory. Any existing content in that directory will be overwritten.
5. Use a tool such as rsync
, Git
, FTP
, or SCP
to copy the contents of the Development sync directory to the Live site's sync directory.
6. On the Live site, in your terminal, run:
drush config:import
(Use drush config-import
for older versions of Drush.)
7. Drush will list the available configuration changes and prompt you with: “Import the listed configuration changes? (yes/no):”. Type yes
to confirm.
You can also change the location of the sync directory.
Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.