Blanca Esthela Esqueda Gutierrez
Senior Software Engineer & Drupal Grand Master
OPIN Software
What we will discuss today...
Configuration system (D8), stores configuration data in a consistent manner. All of your site configuration from enabled modules through fields, contact categories to views, are stored with this system.
A feature is a collection of Drupal entities which taken together satisfy a certain use-case.
Advantages of having "Configuration in Code" under version control (GIT):
Local
Dev
Stage
Prod
In an ideal world, configuration updates wouldn't be done on production.
Configuration Read-only mode module helps to avoid configuration updates.
After install it only add the following line to settings.php
$settings['config_readonly'] = TRUE;
Unless the prod site doesn't exist yet, export configuration from dev to stage only after the prod db has been copied to stage.
Remember, most of the time the stage site is the combination of the dev code and prod files and db.
The configuration system is designed to optimize the process of moving configuration between instances of the same site, system.site configuration item UUID should be the same. It won't allow exporting the configuration from one site to another.
Configuration can still be overridden in settings.php using the $config variable.
Considerations:
$config_directories key is arbitrary, as it is the path. Import/Export Drush commands would use the key as specified.
Use the path suggested by your hosting (If Applicable).
Configuration folder outside the root folder.
Make sure that the configuration folder is added to git.
Update settings.php, define the configuration folder:
$config_directories['vcs'] = $app_root.'/../config/'.basename($site_path);
Troubleshooting:
Make sure local and any other environments are using the same configuration folder.
.gitignore or git update-index --assume-unchanged could avoid the updated version of settings.php to be committed and pushed.
Be-careful of hosting database information includes, always define the configuration folder after those includes.
if (file_exists('/var/www/site-php')) {
require('/var/www/site-php/[site]/[site]-settings.inc');
}
Synchronization - DB configuration and Configuration folder
Import full configuration archive or single configuration item.
Export full configuration archive or single configuration item.
It is important to first export the configuration changes and then pull changes from collaborators because the exporting action wipes the directory and re-populates it with the active configuration.
Since everything is in git, you can recover from such a mistake without much difficulty but why make your life complicated.
Import the configuration before pushing it to another repository. Broken configuration breaks the site, be a nice co-worker.
Sometimes at the time of writing, drush will signal a successful import but doesn't actually import it while the UI is more helpful and complains about instances not imported due to missing storage.
Use config-export to generate the yml files containing the configuration site.
$ drush config-export vsc
Because this is a collaborative environment merging work from any other collaborators is needed. Usually a git pull would do the trick, but git is not God so resolve any merging conflicts if needed.
$ git pull
Use commit to version the changes.
$ git commit -am "New site information configuration"
After merging always run config-import.
If the import is successful then configuration changes are ready to export, If it is not successful then fix the configuration and repeat the steps.
Also, Instead of drush config-import the UI can be use to do the import.
$ drush config-import vsc --preview=diff
Run updatedb. Instead of drush updatedb, update.php can be used.
$ drush updatedb
Push to Dev
$ git push
Note: If you export, then you import!
# Use config-export to generate the yml files containing the configuration site.
$ drush config-export vsc
# Use commit to versioning the changes.
$ git commit -am "New site information configuration"
# Merging work from any other collaborators and resolve any merging conflicts.
$ git pull
# After merging always run config-import - Also the UI can be used to import.
$ drush config-import vsc --preview=diff
# Run updatedb - Instead of drush updatedb, update.php can be used.
$ drush updatedb
# Push to Dev
$ git push
Things to remember:
# Use config-export to generate the yml files containing the configuration site.
$ drush config-export vsc
# Use commit to versioning the changes.
$ git commit -am "New site information configuration"
# Merge work from and resolve any merging conflicts if needed.
$ git pull
# After merging always run config-import. Also the UI can be used to import.
$ drush config-import vsc --preview=diff
# Run updatedb, Instead of drush updatedb, update.php can be used.
$ drush updatedb
Skip the first two commands if you want to clone the latest committed configuration, use them only if you want to merge the configuration.
OPIN Software is offering free Drupal 8 training sessions to the attendees of DrupalCamp Ottawa. Sessions will include:
•Drupal 8 Fundamentals
•Drupal 8 Module Development
•Drupal 8 Theming
If you are interested, please visit the OPIN booth.
We’ve always had a challenge synchronizing content across Drupal environments.
We’ve seen significant progress in the management of system configuration; however, we lack an effective way to deploy content in a similar fashion.
As a result, we’ve spent a lot of time synchronizing content either through migration scripting, import and export files, or “good old fashion” copy and paste.
The content synchronization module provides a mechanism to export single content items, or all content items, from an environment, and move them to another, effortlessly.
Text
Text
Questions?
Blanca Esqueda
Senior Software Engineer
& Drupal Grand Master
blanca.esqueda@opin.ca
https://www.linkedin.com/in/blancaesqueda/
https://slides.com/besqueda/d8-configuration-workflow
•Monthly meetup
•First Wednesday of every month
•From 6pm to 8pm
•New and exciting topics
•Expert speakers and presenters from the community
•Meet new people passionate about Drupal
•Get support from the local community FREE pop, beer & pizza
OPIN Software is the company behind The Open Mic Podcast, which is released bi-weekly and discusses anything & everything Drupal!
We will be hosting a live podcast today at 4pm, in the business track room, and welcome everyone to attend and contribute by discussing what you learned today and what you are hoping for from the community in the future.
To listen to The Open Mic Podcast, please visit:
http://theopenmic.libsyn.com/
Thank you for your continued support
PACIFIC NORTHWEST DRUPAL SUMMIT 2017
Thank you for your continued support
PACIFIC NORTHWEST DRUPAL SUMMIT 2017
Thank you for your continued support
PACIFIC NORTHWEST DRUPAL SUMMIT 2017