Drupal 8 deployment
New configuration management system
by Andrew Siz
Let’s look at three cases
1. Simple deployment from dev site to live one.
1. Deployment with usage of git.
1. Deployment with usage of git and drush commands.
1. Simple deployment from dev site
to live one.
So, we have two instances of one site:
http://drupal8.loc/ - dev site
http://drupal82.loc/ - live site
Currently in Drupal 8 all site Instances should be cloned from one installed source (sql dump, files, some settings in
settings.php should be the same on all site instances), because you won’t be able to sync all configurations. More info
1.1 Simple Ex.: Trying to change “Default country” to “Ukraine” on dev site.
Go to the admin/config/regional/settings and change current Default country to “Ukraine”. After, click “Save configuration”
1.2 Export all configurations to config.tar.gz on dev site.
Go to the admin/config/development/configuration/full/export and click “Export” button. You will receive archive with all
1.3 Import all configurations to the live site.
Go to the admin/config/development/configuration/full/import on the live site and upload our configurations from
1.4 Check if configurations which we want to apply are correct.
Go to the admin/config/development/configuration on live site and click button “View differences”. In popup we can see
what was changed. If this exactly what we want, we can close the popup and click “Import all”.
1.5 Check if our configurations of “default country” were deployed.
Go to the admin/config/regional/settings on the live site and see new default country. That’s all :)
2. Deployment with usage of git.
In drupal 8 we have 2 states of configurations:
active - state of configuration which is currently being used.
staging - state of configuration which was changed and which is currently waiting for review.
The active configuration files can be found at sites/default/files/config_XXXX/active (where XXXX is a hash that looks
somewhat like iND62oxf-4DyUHcbCA7mhupb_KEpUaGZ6qcfTnAscNQ). BUT for performance, by default, the active
store is in a "config" table in the database (somewhat analogous to the "variables" table in D7 and below), though the
storage location is swappable.
The staging configuration files can be found by default at sites/default/files/config_XXXX/staging (where XXXX is a
hash that looks somewhat like iND62oxf-4DyUHcbCA7mhupb_KEpUaGZ6qcfTnAscNQ).
During the installation, Drupal writes the location of the (active & staging) configuration directories to the settings.php
file. For our example we will override location of staging configurations files. But this is not required and will be made
only for showing possibility. So, go to the settings.php and change default location to “staging”. After creating
“staging” folder in our site folder.
NOTE: settings.php configurations should be the same on dev and live sites.
2.1 Preparing dev and live sites
Before any changes will be made, we should go to admin/config/development/configuration/full/export on dev site and
export configurations archive. After, go to admin/config/development/configuration/full/import on dev site and import this
Now we can go to “staging” folder and see that this folder is not even empty, but has all configuration files. As you can
mention, after importing all configuration files, they upload to staging folder.
2.2 Add all site files to Git
Just go to webroot on dev site, commit all site files to git, AND commit our “staging” folder as well. After, pull all these
changes on live site. So, we should have “staging” folder with all files on dev and live site as well. (screenshot)
2.3 Again simple Ex.: Trying to change “Default country” from “Ukraine” (in our
case) to “Germany” on dev site.
2.4 Export new changes, and after, revert all changes to get rid of annoying
Go to the admin/config/development/configuration/full/export on dev site and export all our changes. After go to
admin/config/development/configuration on dev site, we see message “Your current configuration has changed” and we
see what exactly was changed.(screenshot) To get rid of annoying message we should revert all changes to old state by
click on “import all” button, in any case we already have our new changes in archive which we have downloaded few
seconds ago, so nothing will be lost.
2.5 Import our new changes on dev site and revert to current state
Go to the admin/config/development/configuration/full/import and upload our archive. After, go to
admin/config/development/configuration and now revert all changes to current state by clicking “Import all” button. On
clicking “Import all” drupal takes all changed configurations from staging folder and moves them to the active (as we
know, by default, active configurations are stored in a database). It means that all changes were applied.
2.6 Commit and pull all new changes.
In Command-line on dev site we can see that one configuration file was changed (in our case configuration file with
default country)(screenshot). After, commit this file and push to git repo. Go to Command-line on live site and pull all new
2.7 Check and apply configurations on live site.
Go to admin/config/development/configuration on live site and check what was changed by clicking the button “View
differences”. In our case it should be something like UA => DE . If this is exactly what we want, we can apply this by clicking
on “Import all” button.(screenshot). After that, our staging settings will be active and we can check it on
admin/config/regional/settings page. That’s all :)
3. Deployment with usage of git and
Drush of 7 version has new commands for working with configurations in Drupal 8. More information you can find on
In general all steps of deployment are mostly the same as in case number 2, but, for example, on live site, after “git
pull”, you can run “drush config-import -y” and all new changes will be immediately applied on site. Pretty handy! ;)
In general that’s all ;)
How to install drush 7 for drupal 8?
Why active configurations are stored in database and how to swap it to files?
- https://www.drupal.org/node/2241059, for example, there is one module which saves active configuratins in files
After pulling new changes on live, I have an error “The staged configuration cannot be imported, because it originates
from a different site than this site. You can only synchronize configuration between cloned instances of this site.”
- please read notes from the slide number 3.
After running “drush config-import -y” I have some errors.
- Try to upload latest dev version of Drupal 8 and Drush 7.
Offenbar haben Sie einen Ad-Blocker installiert. Wenn Sie SlideShare auf die Whitelist für Ihren Werbeblocker setzen, helfen Sie unserer Gemeinschaft von Inhaltserstellern.
Sie hassen Werbung?
Wir haben unsere Datenschutzbestimmungen aktualisiert.
Wir haben unsere Datenschutzbestimmungen aktualisiert, um den neuen globalen Regeln zum Thema Datenschutzbestimmungen gerecht zu werden und dir einen Einblick in die begrenzten Möglichkeiten zu geben, wie wir deine Daten nutzen.
Die Einzelheiten findest du unten. Indem du sie akzeptierst, erklärst du dich mit den aktualisierten Datenschutzbestimmungen einverstanden.