SlideShare una empresa de Scribd logo
1 de 50
Descargar para leer sin conexión
CONFIGURATION AS
DEPENDENCY
Managing Drupal 8 Configuration
with Git and Composer
ERICH BEYRENT
➤ Senior Drupal Developer at
BioRAFT
➤ Working with Drupal since
2004
➤ Drupal: https://drupal.org/u/ebeyrent
➤ Twitter: https:/twitter.com/ebeyrent
➤ Github: https://github.com/ebeyrent
Moshe Weitzman
Justin Ludwig
Justin works for BioRAFT as a Development
Engineer and am responsible for anything that
gets thrown my way. He thrives in areas related
to user management including SSO & permissions
templates as well as adding some whizz-bang to
sites with jQuery. Drupal has been his tool of
choice since 2007.
Moshe has been a consistent contributor to Drupal
core and Contrib since November 2001. As such, he
has pretty much touched the whole core code. He
maintains the user.module, the bootstrap code, and
the groups.drupal.org web site.
AGENDA
➤ Overview of Drupal 8 configuration management
AGENDA
➤ Overview of Drupal 8 configuration management
➤ Managing your Git repository
AGENDA
➤ Overview of Drupal 8 configuration management
➤ Managing your Git repository
➤ Using Composer and Drupal Console
AGENDA
➤ Overview of Drupal 8 configuration management
➤ Managing your Git repository
➤ Using Composer and Drupal Console
➤ Multisite considerations
https://www.flickr.com/photos/majathurup/2305054569/
BACKGROUND
➤ Pre-Drupal 8 Challenges
➤ Configuration cannot easily be represented in code
➤ Configuration changes performed by clients and/or client
services cannot be represented in code without going
through patch/release with developers
BACKGROUND
➤ Drupal 8 Goals
➤ Allow non-developers to change configuration safely
➤ Clients can safely change configurations to the extent that
they are allowed
➤ Provide an audit trail of all configuration changes made
➤ Easily and automatically create new instances of sites with
default configurations
Two Types of Configuration in Drupal 8
http://www.moviepulp.be/wp-content/uploads/2007/04/alienvspredator.jpg
DRUPAL 8 CONFIGURATION SYSTEM
➤ Standardizes configuration export into YAML files
➤ Used for both simple config and config entities (fields, views,
workflows, roles, etc)
“Sites own their configuration, not
modules.
- Alex Pott
https://www.chapterthree.com/blog/principles-of-configuration-management-part-two
https://dev.acquia.com/blog/ultimate-guide-drupal-8-episode-6-new-back-end-features-drupal-8
DRUPAL 8 CONFIGURATION SYSTEM
➤ Contrib/custom modules have the same tools for enabling
default configurations
➤ Default YAML files are stored with the module
➤ Once a module is installed, the site now owns the config and
those YAML files are copied to the site-wide config directory
DRUPAL 8 CONFIGURATION SYSTEM
➤ Robust system for managing hard and soft/optional
dependencies
➤ Nested module dependencies are automatically added to the
configuration (when exported)
USEFUL CONFIGURATION MODULES
➤ Configuration Update
https://www.drupal.org/project/config_update
➤ Configuration Tools
https://www.drupal.org/project/config_tools
➤ Configuration Synchronizer
https://www.drupal.org/project/config_sync
➤ Configuration Development
https://www.drupal.org/project/config_devel
➤ Configuration Log
https://www.drupal.org/project/config_log
WANT MORE INFORMATION?
http://drupalnights.org/events/2015/moshe-weitzman-d8-configuration-management
Watch Moshe Weitzman’s DrupalNights presentation about
Drupal 8’s configuration management system!
“There is no “recommended”
workflow.
-Matthew Tift
https://www.lullabot.com/articles/configuration-management-in-drupal-8-the-key-concepts
GIT REPO STRATEGY
➤ Create two repositories:



Code Configuration
https://cdn.meme.am/instances/59742810.jpg
YES, THERE’S TWO OF THEM
➤ Use git to manage individual site differences and conflict
resolution
➤ Default configurations for all sites can be managed on the
master branch of the configuration repository
➤ Each client site has its own branch of the Config Repo
➤ Code repository contains only custom modules/themes/
libraries, “sites” directory and build scripts
GIT REPO STRATEGY: CODE REPO
➤ All dependencies are managed by Composer
➤ Package and version added to composer.json and it is built
with all dependency dependencies resolved automatically
“Configuration is just another
dependency.
-Erich Beyrent
CONFIGURATION AS DEPENDENCY
➤ Manage configuration as a dependency in composer.json
➤ Use tags to identify configuration versions
"repositories": [
{
"type": "composer",
"url": "https://packagist.drupal-composer.org"
},
{
"type": "vcs",
"url": "https://github.com/weitzman/multiplesite-config.git"
}
],
"require": {
"composer/installers": "^1.0.20",
"drupal-composer/drupal-scaffold": "^2.0.1",
"cweagans/composer-patches": "~1.0",
"drupal/core": "~8.0",
"drush/drush": "8.x-dev",
"drupal/console": "~1.0",
"multiplesite-config/alpha": "dev-alpha",
"multiplesite-config/bravo": "dev-bravo"
},
"config": {
"preferred-install": {
"multiplesite-config/*": "source"
}
}
"extra": {
"installer-paths": {
"config/{$name}": ["type:bonefish-package"],
"web/core": ["type:drupal-core"],
"web/modules/contrib/{$name}": ["type:drupal-module"],
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
"web/themes/contrib/{$name}": ["type:drupal-theme"],
"drush/contrib/{$name}": ["type:drupal-drush"]
}
},
"scripts": {
"drupal-scaffold": "DrupalComposerDrupalScaffoldPlugin::scaffold",
"pre-install-cmd": [
"DrupalProjectcomposerScriptHandler::checkComposerVersion"
],
"pre-update-cmd": [
"DrupalProjectcomposerScriptHandler::checkComposerVersion"
],
"post-install-cmd": [
"DrupalProjectcomposerScriptHandler::createRequiredFiles"
],
"post-update-cmd": [
"DrupalProjectcomposerScriptHandler::createRequiredFiles"
]
},
GIT REPO STRATEGY: CONFIG REPO
➤ Master branch contains the default configurations for any/all
modules
➤ Each client site gets its own branch in the config repository
➤ For a site to work, we need both repos
➤ Master branch containing site defaults is mirrored from the
Config Repo into the Drupal Repo (read-only) using git
subtree split
DEVELOPER WORKFLOW
➤ Create a branch of Code Repo for a new ticket/card/bug/
feature and do some work
➤ The Config Repo will be available to edit configs for sites
where module is already enabled
➤ The same YAML will also have to be added to the module for
sites where it was never enabled
CONFIG REPO BENEFITS
➤ While a feature is being worked on, a specific version of config
can be used that won’t conflict with other features being
developed
➤ If a problem arises with configuration, it can easily be “rolled
back” by specifying the working version
➤ Exact replica of an entire site’s configuration can be built from
scratch during development or debugging without any client
data being used
MORE CONFIG REPO BENEFITS
➤ Helps determine if a bug involving config is actually solved
rather than just solved for a particular piece of data
➤ Helps with testing unique configuration considerations
➤ Potential to assist with new site rollouts
WHAT ELSE?
➤ Theme repositories?
MULTISITE CONFIGURATION REQUIREMENTS
➤ <?php return count($sites) >= 2; ?>
➤ Configuration defaults exist and may need to be updated
➤ Each site is configured uniquely and may override defaults as
required
➤ Both simple config (e.g. site name) and complex config
(“config entities”) may need to be overridden
➤ A config may need to be to be changed for a single site or a
group of sites
➤ Conflict management varies from case to case
THE EXPERIMENT
➤ https://github.com/weitzman/multiplesite
An experiment in how to to handle the "multisite" pattern in Drupal 8. This is
when you run dozens or hundreds of very similar sites. You want these sites to
vary configuration in slight ways, but still easily push out config changes to
all. Examples include one site for each member of Congress, or one site for
each musician in our portfolio.
IMPLEMENTATION
multisite multisite-config
master 

config
master 

config
client a 

branch
client b

branch
client c

branch
git subtree-split
IMPLEMENTATION ALTERNATIVE
multisite multisite-config
master 

config
master 

config
client a 

branch
client b

branch
client c

branch
x
IMPLEMENTATION
master 

config
client a 

branch
client b

branch
client c

branch
master
config
changes
git merge
client c
config
changes
PUSHING COMMITS
➤ When fixing bugs while using a client site, a developer can
choose to push commits to master config or to client config as
needed. Pushing to client config happens automatically since
that’s “origin”. If dev wants to integrate changes into
multiplesite, add a remote pointing to multiplesite and then
push commits there.


git remote add multiplesite https://github.com/weitzman/multiplesite.git

git checkout -b multiplesite-master multiplesite/master

git cherry-pick <COMMITS>

git push
IMPLEMENTATION
master 

config
client c

branch client c
configuration
config
changes
client c
production
database
SUMMARY
➤ Multisite projects have unique config requirements
➤ The proposed workflow should be able to handle all of those
requirements elegantly
➤ The process can be automated enough to reduce cognitive
strain and allow everyone to focus their energy on what
matters: the product!
RESOURCES
➤ https://www.drupal.org/developing/api/8/configuration
➤ https://dev.acquia.com/blog/ultimate-guide-drupal-8-
episode-6-new-back-end-features-drupal-8
➤ https://github.com/weitzman/multiplesite
➤ https://www.lullabot.com/articles/configuration-
management-in-drupal-8-the-key-concepts
➤ http://drupalnights.org/events/2015/moshe-weitzman-d8-
configuration-management
https://wordhavering.files.wordpress.com/2013/01/questions-and-answers1.jpg
BIORAFT
IS HIRING!
http://bioraft.com/company/careers

Más contenido relacionado

La actualidad más candente

Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Nuvole
 

La actualidad más candente (20)

Using Composer with Drupal and Drush
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer with Drupal and Drush
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
Docman - The swiss army knife for Drupal multisite docroot management and dep...
Docman - The swiss army knife for Drupal multisite docroot management and dep...Docman - The swiss army knife for Drupal multisite docroot management and dep...
Docman - The swiss army knife for Drupal multisite docroot management and dep...
 
Drupal 8 deploying
Drupal 8 deployingDrupal 8 deploying
Drupal 8 deploying
 
Drupal 8 CMI on a Managed Workflow
Drupal 8 CMI on a Managed WorkflowDrupal 8 CMI on a Managed Workflow
Drupal 8 CMI on a Managed Workflow
 
The OpenEuropa Initiative
The OpenEuropa InitiativeThe OpenEuropa Initiative
The OpenEuropa Initiative
 
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
 
Development Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesDevelopment Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP Libraries
 
Drupal 8 Configuration Management with Features
Drupal 8 Configuration Management with FeaturesDrupal 8 Configuration Management with Features
Drupal 8 Configuration Management with Features
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
Yet Another Drupal Development/Deployment Presentation
Yet Another Drupal Development/Deployment PresentationYet Another Drupal Development/Deployment Presentation
Yet Another Drupal Development/Deployment Presentation
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupal
 
11 tools for your PHP devops stack
11 tools for your PHP devops stack11 tools for your PHP devops stack
11 tools for your PHP devops stack
 
Java User Group Cologne
Java User Group CologneJava User Group Cologne
Java User Group Cologne
 
Drupal 8 improvements for developer productivity php symfony and more
Drupal 8 improvements for developer productivity  php symfony and moreDrupal 8 improvements for developer productivity  php symfony and more
Drupal 8 improvements for developer productivity php symfony and more
 
Headless Drupal
Headless DrupalHeadless Drupal
Headless Drupal
 
Speedrun: Build a Website with Panels, Media, and More in 45 Minutes
Speedrun: Build a Website with Panels, Media, and More in 45 MinutesSpeedrun: Build a Website with Panels, Media, and More in 45 Minutes
Speedrun: Build a Website with Panels, Media, and More in 45 Minutes
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
 
Webkit/chromium contribution process
Webkit/chromium contribution processWebkit/chromium contribution process
Webkit/chromium contribution process
 

Destacado

Tips and tricks for building Large web applications with Drupal
Tips and tricks for building Large web applications with DrupalTips and tricks for building Large web applications with Drupal
Tips and tricks for building Large web applications with Drupal
MitzaCeusan
 
Ag Comm Drupal 7 Platform Initiative Intro
Ag Comm Drupal 7 Platform Initiative IntroAg Comm Drupal 7 Platform Initiative Intro
Ag Comm Drupal 7 Platform Initiative Intro
ashooner
 
Drupal multisite
Drupal multisiteDrupal multisite
Drupal multisite
Ly Phuong
 
Drupal Multisite Setup
Drupal Multisite SetupDrupal Multisite Setup
Drupal Multisite Setup
ipsitamishra
 

Destacado (14)

Tips and tricks for building Large web applications with Drupal
Tips and tricks for building Large web applications with DrupalTips and tricks for building Large web applications with Drupal
Tips and tricks for building Large web applications with Drupal
 
Local Drupal MultiSite Set-up
Local Drupal MultiSite Set-upLocal Drupal MultiSite Set-up
Local Drupal MultiSite Set-up
 
Ag Comm Drupal 7 Platform Initiative Intro
Ag Comm Drupal 7 Platform Initiative IntroAg Comm Drupal 7 Platform Initiative Intro
Ag Comm Drupal 7 Platform Initiative Intro
 
Drupal multisite
Drupal multisiteDrupal multisite
Drupal multisite
 
Skillsume brochure
Skillsume brochureSkillsume brochure
Skillsume brochure
 
Domain Access Module
Domain Access ModuleDomain Access Module
Domain Access Module
 
August 2015 - Web Governance - PWP Introduction
August 2015 - Web Governance - PWP IntroductionAugust 2015 - Web Governance - PWP Introduction
August 2015 - Web Governance - PWP Introduction
 
drush_multi @ DrupalDevDays 2010
drush_multi @ DrupalDevDays 2010drush_multi @ DrupalDevDays 2010
drush_multi @ DrupalDevDays 2010
 
Drush und Multisite: drush_multi
Drush und Multisite: drush_multiDrush und Multisite: drush_multi
Drush und Multisite: drush_multi
 
Inside OpenChange scalable architecture
Inside OpenChange scalable architectureInside OpenChange scalable architecture
Inside OpenChange scalable architecture
 
Drupal Multisite Setup
Drupal Multisite SetupDrupal Multisite Setup
Drupal Multisite Setup
 
Drupal Multisite
Drupal MultisiteDrupal Multisite
Drupal Multisite
 
Créez votre site web vous-même 2/2
Créez votre site web vous-même 2/2Créez votre site web vous-même 2/2
Créez votre site web vous-même 2/2
 
Олександр Лінивий — Multisite platform with continuous delivery process for m...
Олександр Лінивий — Multisite platform with continuous delivery process for m...Олександр Лінивий — Multisite platform with continuous delivery process for m...
Олександр Лінивий — Multisite platform with continuous delivery process for m...
 

Similar a Configuration as Dependency: Managing Drupal 8 Configuration with git and Composer

Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
Drupalcon Paris
 

Similar a Configuration as Dependency: Managing Drupal 8 Configuration with git and Composer (20)

Improving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLAImproving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLA
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-Translator
 
Voiture tech talk
Voiture tech talkVoiture tech talk
Voiture tech talk
 
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
Building a Drupal Distribution using Features, Drush Make, Installation Profi...Building a Drupal Distribution using Features, Drush Make, Installation Profi...
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
 
Drupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.xDrupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.x
 
Blt introduction
Blt  introductionBlt  introduction
Blt introduction
 
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
 
Face your fears: Drush and Aegir
Face your fears: Drush and AegirFace your fears: Drush and Aegir
Face your fears: Drush and Aegir
 
Help! I inherited a Drupal Site! - DrupalCamp Atlanta 2016
Help! I inherited a Drupal Site! - DrupalCamp Atlanta 2016Help! I inherited a Drupal Site! - DrupalCamp Atlanta 2016
Help! I inherited a Drupal Site! - DrupalCamp Atlanta 2016
 
Drupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflowDrupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflow
 
DDAY2014 - Features per Drupal 8
DDAY2014 - Features per Drupal 8DDAY2014 - Features per Drupal 8
DDAY2014 - Features per Drupal 8
 
VCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT WorkshopVCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT Workshop
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
Into to drupal8
Into to drupal8Into to drupal8
Into to drupal8
 
Bootstrap Framework and Drupal
Bootstrap Framework and DrupalBootstrap Framework and Drupal
Bootstrap Framework and Drupal
 
Getting Into Drupal 8 Configuration
Getting Into Drupal 8 ConfigurationGetting Into Drupal 8 Configuration
Getting Into Drupal 8 Configuration
 
Phase2 Large Drupal Multisites (gta case study)
Phase2   Large Drupal Multisites (gta case study)Phase2   Large Drupal Multisites (gta case study)
Phase2 Large Drupal Multisites (gta case study)
 
Acquia BLT for the Win, or How to speed up the project setup, development an...
Acquia BLT for the Win, or  How to speed up the project setup, development an...Acquia BLT for the Win, or  How to speed up the project setup, development an...
Acquia BLT for the Win, or How to speed up the project setup, development an...
 
Magento Docker Setup.pdf
Magento Docker Setup.pdfMagento Docker Setup.pdf
Magento Docker Setup.pdf
 

Más de Erich Beyrent

Hack-Proof Your Drupal App
Hack-Proof Your Drupal AppHack-Proof Your Drupal App
Hack-Proof Your Drupal App
Erich Beyrent
 

Más de Erich Beyrent (6)

{ JSON:API} 2 - A Path to Decoupled Drupal
{ JSON:API} 2 - A Path to Decoupled Drupal{ JSON:API} 2 - A Path to Decoupled Drupal
{ JSON:API} 2 - A Path to Decoupled Drupal
 
Test your modules
Test your modulesTest your modules
Test your modules
 
Digital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Digital Mayflower - Data Pilgrimage with the Drupal Migrate ModuleDigital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Digital Mayflower - Data Pilgrimage with the Drupal Migrate Module
 
Hack-Proof Your Drupal App
Hack-Proof Your Drupal AppHack-Proof Your Drupal App
Hack-Proof Your Drupal App
 
Staging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for DrupalStaging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for Drupal
 
Staging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for DrupalStaging Drupal: Change Management Strategies for Drupal
Staging Drupal: Change Management Strategies for Drupal
 

Último

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Último (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 

Configuration as Dependency: Managing Drupal 8 Configuration with git and Composer

  • 1. CONFIGURATION AS DEPENDENCY Managing Drupal 8 Configuration with Git and Composer
  • 2. ERICH BEYRENT ➤ Senior Drupal Developer at BioRAFT ➤ Working with Drupal since 2004 ➤ Drupal: https://drupal.org/u/ebeyrent ➤ Twitter: https:/twitter.com/ebeyrent ➤ Github: https://github.com/ebeyrent
  • 3. Moshe Weitzman Justin Ludwig Justin works for BioRAFT as a Development Engineer and am responsible for anything that gets thrown my way. He thrives in areas related to user management including SSO & permissions templates as well as adding some whizz-bang to sites with jQuery. Drupal has been his tool of choice since 2007. Moshe has been a consistent contributor to Drupal core and Contrib since November 2001. As such, he has pretty much touched the whole core code. He maintains the user.module, the bootstrap code, and the groups.drupal.org web site.
  • 4. AGENDA ➤ Overview of Drupal 8 configuration management
  • 5. AGENDA ➤ Overview of Drupal 8 configuration management ➤ Managing your Git repository
  • 6. AGENDA ➤ Overview of Drupal 8 configuration management ➤ Managing your Git repository ➤ Using Composer and Drupal Console
  • 7. AGENDA ➤ Overview of Drupal 8 configuration management ➤ Managing your Git repository ➤ Using Composer and Drupal Console ➤ Multisite considerations
  • 9. BACKGROUND ➤ Pre-Drupal 8 Challenges ➤ Configuration cannot easily be represented in code ➤ Configuration changes performed by clients and/or client services cannot be represented in code without going through patch/release with developers
  • 10. BACKGROUND ➤ Drupal 8 Goals ➤ Allow non-developers to change configuration safely ➤ Clients can safely change configurations to the extent that they are allowed ➤ Provide an audit trail of all configuration changes made ➤ Easily and automatically create new instances of sites with default configurations
  • 11. Two Types of Configuration in Drupal 8 http://www.moviepulp.be/wp-content/uploads/2007/04/alienvspredator.jpg
  • 12. DRUPAL 8 CONFIGURATION SYSTEM ➤ Standardizes configuration export into YAML files ➤ Used for both simple config and config entities (fields, views, workflows, roles, etc)
  • 13. “Sites own their configuration, not modules. - Alex Pott https://www.chapterthree.com/blog/principles-of-configuration-management-part-two
  • 15. DRUPAL 8 CONFIGURATION SYSTEM ➤ Contrib/custom modules have the same tools for enabling default configurations ➤ Default YAML files are stored with the module ➤ Once a module is installed, the site now owns the config and those YAML files are copied to the site-wide config directory
  • 16. DRUPAL 8 CONFIGURATION SYSTEM ➤ Robust system for managing hard and soft/optional dependencies ➤ Nested module dependencies are automatically added to the configuration (when exported)
  • 17. USEFUL CONFIGURATION MODULES ➤ Configuration Update https://www.drupal.org/project/config_update ➤ Configuration Tools https://www.drupal.org/project/config_tools ➤ Configuration Synchronizer https://www.drupal.org/project/config_sync ➤ Configuration Development https://www.drupal.org/project/config_devel ➤ Configuration Log https://www.drupal.org/project/config_log
  • 18. WANT MORE INFORMATION? http://drupalnights.org/events/2015/moshe-weitzman-d8-configuration-management Watch Moshe Weitzman’s DrupalNights presentation about Drupal 8’s configuration management system!
  • 19. “There is no “recommended” workflow. -Matthew Tift https://www.lullabot.com/articles/configuration-management-in-drupal-8-the-key-concepts
  • 20.
  • 21. GIT REPO STRATEGY ➤ Create two repositories:
 
 Code Configuration
  • 23. YES, THERE’S TWO OF THEM ➤ Use git to manage individual site differences and conflict resolution ➤ Default configurations for all sites can be managed on the master branch of the configuration repository ➤ Each client site has its own branch of the Config Repo ➤ Code repository contains only custom modules/themes/ libraries, “sites” directory and build scripts
  • 24. GIT REPO STRATEGY: CODE REPO ➤ All dependencies are managed by Composer ➤ Package and version added to composer.json and it is built with all dependency dependencies resolved automatically
  • 25. “Configuration is just another dependency. -Erich Beyrent
  • 26. CONFIGURATION AS DEPENDENCY ➤ Manage configuration as a dependency in composer.json ➤ Use tags to identify configuration versions
  • 27. "repositories": [ { "type": "composer", "url": "https://packagist.drupal-composer.org" }, { "type": "vcs", "url": "https://github.com/weitzman/multiplesite-config.git" } ],
  • 28. "require": { "composer/installers": "^1.0.20", "drupal-composer/drupal-scaffold": "^2.0.1", "cweagans/composer-patches": "~1.0", "drupal/core": "~8.0", "drush/drush": "8.x-dev", "drupal/console": "~1.0", "multiplesite-config/alpha": "dev-alpha", "multiplesite-config/bravo": "dev-bravo" },
  • 30.
  • 31.
  • 32.
  • 33. "extra": { "installer-paths": { "config/{$name}": ["type:bonefish-package"], "web/core": ["type:drupal-core"], "web/modules/contrib/{$name}": ["type:drupal-module"], "web/profiles/contrib/{$name}": ["type:drupal-profile"], "web/themes/contrib/{$name}": ["type:drupal-theme"], "drush/contrib/{$name}": ["type:drupal-drush"] } },
  • 34. "scripts": { "drupal-scaffold": "DrupalComposerDrupalScaffoldPlugin::scaffold", "pre-install-cmd": [ "DrupalProjectcomposerScriptHandler::checkComposerVersion" ], "pre-update-cmd": [ "DrupalProjectcomposerScriptHandler::checkComposerVersion" ], "post-install-cmd": [ "DrupalProjectcomposerScriptHandler::createRequiredFiles" ], "post-update-cmd": [ "DrupalProjectcomposerScriptHandler::createRequiredFiles" ] },
  • 35. GIT REPO STRATEGY: CONFIG REPO ➤ Master branch contains the default configurations for any/all modules ➤ Each client site gets its own branch in the config repository ➤ For a site to work, we need both repos ➤ Master branch containing site defaults is mirrored from the Config Repo into the Drupal Repo (read-only) using git subtree split
  • 36. DEVELOPER WORKFLOW ➤ Create a branch of Code Repo for a new ticket/card/bug/ feature and do some work ➤ The Config Repo will be available to edit configs for sites where module is already enabled ➤ The same YAML will also have to be added to the module for sites where it was never enabled
  • 37. CONFIG REPO BENEFITS ➤ While a feature is being worked on, a specific version of config can be used that won’t conflict with other features being developed ➤ If a problem arises with configuration, it can easily be “rolled back” by specifying the working version ➤ Exact replica of an entire site’s configuration can be built from scratch during development or debugging without any client data being used
  • 38. MORE CONFIG REPO BENEFITS ➤ Helps determine if a bug involving config is actually solved rather than just solved for a particular piece of data ➤ Helps with testing unique configuration considerations ➤ Potential to assist with new site rollouts
  • 39. WHAT ELSE? ➤ Theme repositories?
  • 40. MULTISITE CONFIGURATION REQUIREMENTS ➤ <?php return count($sites) >= 2; ?> ➤ Configuration defaults exist and may need to be updated ➤ Each site is configured uniquely and may override defaults as required ➤ Both simple config (e.g. site name) and complex config (“config entities”) may need to be overridden ➤ A config may need to be to be changed for a single site or a group of sites ➤ Conflict management varies from case to case
  • 41. THE EXPERIMENT ➤ https://github.com/weitzman/multiplesite An experiment in how to to handle the "multisite" pattern in Drupal 8. This is when you run dozens or hundreds of very similar sites. You want these sites to vary configuration in slight ways, but still easily push out config changes to all. Examples include one site for each member of Congress, or one site for each musician in our portfolio.
  • 42. IMPLEMENTATION multisite multisite-config master 
 config master 
 config client a 
 branch client b
 branch client c
 branch git subtree-split
  • 43. IMPLEMENTATION ALTERNATIVE multisite multisite-config master 
 config master 
 config client a 
 branch client b
 branch client c
 branch x
  • 44. IMPLEMENTATION master 
 config client a 
 branch client b
 branch client c
 branch master config changes git merge client c config changes
  • 45. PUSHING COMMITS ➤ When fixing bugs while using a client site, a developer can choose to push commits to master config or to client config as needed. Pushing to client config happens automatically since that’s “origin”. If dev wants to integrate changes into multiplesite, add a remote pointing to multiplesite and then push commits there. git remote add multiplesite https://github.com/weitzman/multiplesite.git git checkout -b multiplesite-master multiplesite/master git cherry-pick <COMMITS> git push
  • 46. IMPLEMENTATION master 
 config client c
 branch client c configuration config changes client c production database
  • 47. SUMMARY ➤ Multisite projects have unique config requirements ➤ The proposed workflow should be able to handle all of those requirements elegantly ➤ The process can be automated enough to reduce cognitive strain and allow everyone to focus their energy on what matters: the product!
  • 48. RESOURCES ➤ https://www.drupal.org/developing/api/8/configuration ➤ https://dev.acquia.com/blog/ultimate-guide-drupal-8- episode-6-new-back-end-features-drupal-8 ➤ https://github.com/weitzman/multiplesite ➤ https://www.lullabot.com/articles/configuration- management-in-drupal-8-the-key-concepts ➤ http://drupalnights.org/events/2015/moshe-weitzman-d8- configuration-management