SlideShare a Scribd company logo
1 of 53
From Drupal 7 to Drupal 8
Features vs. Configuration
Management
Fabian Bircher - fabian@nuvole.org
0
Nuvole
a 100% Drupal company
✈ Our Distributed Team
Italy Belgium Czech
Republic
ὄ Our Clients
Ὃ Our Projects
International organisations
Institutions
Fast delivery: several developers working simultaneously
on the same site
Frequent configuration changes: need for safe updates
 Challenges We Face
Remote collaboration on site development
Keeping track of all configuration changes during
development
Pushing upgrades to production sites
Chapter 1
ἱ ἴ ἳ ἲ ἱ
The Evolution of
Code-Driven Development
in Drupal 8
὆ The long march to a
"code-driven" Drupal
Historically, Drupal has kept both configuration and content
in the same database.
Every time you click in the administrative interface, no record is kept.
Drupal 6: Features appears, with the possibility to export
configuration to PHP code
Drupal 7: Features support is mature, but still relying on
third parties and incomplete
Drupal 8: Configuration and content are separated,
configuration is text-based
  
The database-driven
workflow disadvantages
Default in Drupal 6 and Drupal 7 (core)
Standard approach: you click, you save, Drupal saves to
database and forgets
Bad: Mixing configuration and content
Bad: Losing track of configuration changes
Theoretically still possible in Drupal 8!
 
The Features-driven
workflow disadvantages
A structural flaw: to package configuration into modules,
you need to make it exportable to "code"
Features is very good for packaging, not as good for
exporting; but there's no packaging without exporting
Not everything is exportable/traceable
You must "whitelist" elements to be tracked: you never
have the whole site under control
 
Code-driven is not just
Features
It’s a global technical choice
For example, it includes makefiles and profiles, still
applicable in D8
Keywords: text-based configuration, traceability,
repeatability, reuse
Ἲ
New in Drupal 8
Configuration Management
Ἲ
A guided example of
Configuration Management
Ἲ
Reference Use Case
Modify the configuration of a production site:
Keeping the site online all the time.
Developing/testing the new configuration on a
development copy.
Exporting the configuration changes from development
and importing them into production.
Ἲ Step 1 of 6
Clone Site to Dev
Production
Install Site
Full backup:
Database
Full Drupal tree
Files
Development
Restore the backup
(or install with
config_installer)
Ἲ Step 2 of 6
Modify Configuration
Production
Site operates normally:
new users
new content
Development
Ἲ Step 3 of 6
Export Configuration
Production
Site operates normally:
new users
new content
Development
Ἲ Step 4 of 6
Import into Staging
Production Development
Ἲ Step 5 of 6
Review Changes
Production Development
Ἲ Step 6 of 6
Apply Changes
Production Development
How this would have
worked in Drupal 7
Clone site to development environment
Create a feature exporting the site name variable
Development: update the feature
Transfer the feature to Production
Production: enable/revert the feature
drush
DRUpal SHell: everybody loves!
Drupal 8 ⇔ drush 7
Both not stable yet, but matching beta releases
A new installation method: composer
Ἲ Step 3 of 6 — Drush Style
Export Configuration
Development
$ drush config-export
The current contents of your export directory
(sites/default/files/config_H6raw/staging) will be deleted. (y/n): y
Configuration successfully exported to [success]
sites/default/files/config_H6raw/staging.
Ἲ Step 5 of 6 — Drush Style
Review Changes
Production
$ drush config-import --preview=diff
Configuration successfully exported to /tmp/drush_tmp_xy. [success]
diff -u /tmp/drush_tmp_xy/system.site.yml sites/.../staging/system.site.yml
--- /tmp/drush_tmp_xy/system.site.yml
+++ sites/default/files/config_H6raw/staging/system.site.yml
@@ -1,5 +1,5 @@
uuid: ca04efa4-51bf-4d12-8b00-e7b244b97aef
-name: 'Drupal 8'
+name: 'DDD 2015'
mail: drupal@example.com
slogan: ''
page:
Import the listed configuration changes? (y/n):
Chapter 2

Inner workings of
Configuration Management
and Features
 Use case
Features
A collection of logically
related Drupal elements
Packaged into PHP code,
using hooks
Exportability is a
precondition to packaging
Configuration Management
Reference for the whole site
configuration, development to
production
Ὄ Configuration format
PHP
Imperative
Interpreted
Can break site if corrupted
Located in folders for
modules
Treated as modules
YAML
Declarative
Parsed
Cannot break anything if corrupted
Located in specific folders
for config
Treated as data (like Rules'
JSON in D7)
 Support
Optional
Modules must offer support
for Features
No guarantees
Mandatory
Core configuration
The only way to supply
configuration
ὒ Configuration and
modules
Drupal 7
Features are special
modules
Once a Feature is enabled,
its configuration is tracked
forever
Drupal 8
Modules provide initial
values
In this sense, every module
is a Feature
Configuration is decoupled
from modules after
installation
 Components selection
Drupal 7
Explicitly listed in info file
Rest is not tracked
Drupal 8
All configuration is tracked
Configuration is saved per
config entity
Can be individually
imported/exported
Config synchronisation
requires all files to be
present (missing = deleted)
 Configuration staging
Drupal 7
Feature states: normal,
overridden, needs review
Operations: features
update/revert
Diff available
Drupal 8
Active store and staging
store (multiple stores
possible)
Operations: import and
export
Diff available

Drush workflow
Drupal 7
drush features-update
drush features-revert
Drupal 8 (with drush 7.x-dev)
drush cex
drush cim
Ἴ ⚽
Cross-site compatibility
Drupal 7
Write once, deploy
anywhere
A feature is ready to be
deployed on multiple sites
Drupal 8
Specific to multiple
instances (dev, prod) of the
same site
This is the CMI use case
Configuration Management
relies on UUIDs
 Ὁ
Boundaries of configuration
Drupal 7
Entities through entity api,
CTools plugins
Variables with Strongarm
Content with
features_uuid
Menu links, custom and
contrib modules can be
problematic
Drupal 8
Configuration
Content
State
All clearly defined
὎ ὎ ὎
Features done right?
Drupal 7
Not optimal
A bit "forced" at times since
it is not native in Drupal 7
Drupal 8
Clean
Native
Not as powerful as
D7+Features yet
Chapter 3
 
How to build
Re-usable components
 Use case
Drupal 7: Features
Package configuration
Reuse configuration
Focus on efficiency
Drupal 8: CM
Deploy configuration
Tracking configuration
Focus on reliability
We want both, efficiency and reliability
⚠ Drawbacks
Drupal 7: Features
Not designed for
deployment
Used for deployment
It drives people crazy
Drupal 8: CM
Designed for deployment
Not designed for packaging
Possible shortcomings
when creating re-usable
configuration.
 Features 8.x-3.x
Goes back to the core mission of Features: package
functionality for re-use.
No more project specific features!
Under development, alpha available.
Phase2 blog post
Development module, not for production sites using CMI
Announcing Features for Drupal 8
(http://www.phase2technology.com/blog/announcing-
features-for-drupal-8/)
Chapter 4
Ἱ
Configuration Management
For Developers
 An overview
⇆ API import
The Config namespace configuration must always be
imported/exported through the API, never edit the files!
The filesystem is not a good option, and this is the reason
for Drupal 8 to store the active config in database by
default:
Performance
Safety
Security
⚙
Configurables in Drupal 8
ConfigEntityBaseclass
Two entity namespaces: one for config, one for content
⚙
Working with configuration
Reading and writing configuration
// Get site name for displaying.
$site_name = Drupal::config('system.site')->get('name');
// Get site name for editing.
$editable_config = Drupal::configFactory()->getEditable('system.site');
$site_name = $editable_config->get('name');
// Set site name.
$editable_config->set('name', 'My site')->save();
⛼
variable_get()and variable_set()died.
⚙
Information about the
system state
instance-specific? (e.g., last cron run) → state
configuration? (e.g., site mail) → config
Site = filesystem + content + configuration + state
⚙
Working with states
Reading and writing states
// Get last cron run timestamp.
$time = Drupal::state()->get('system.cron_last');
// Set cron run timestamp.
Drupal::state()->set('system.cron_last', REQUEST_TIME);
⚙
Overriding "on the fly"
The $confarray is still available as $config
Useful in settings.local.php:
Differentiate development and production environment
Chapter 8
⚛
A taste of
Paradigm shift
Multi developer workflow
Configuration needs to be exported and imported!
Version all configuration in git. (current site config state)
Commit to git before synchronizing. (as a backup)
Import merged configuration before continuing.
( pending)patch (https://www.drupal.org/node/2416109)
∆config = development
Lock configuration changes on the live site.
If locking is not an option: export and commit to a
dedicated branch, so developers can merge it into the
configuration which will be deployed.
Best practices yet to be found. Join
config_readonly
(https://www.drupal.org/project/config_readonly)
groups
(https://groups.drupal.org/node/466373)
Features workflow
If you use features 8.x for deployment
⇒ you are doing it wrong. ™
Re-use configuration for other projects!
Synchronize partial configuration between different sites.
Use features in development environments.
Features workflow
Project A
Production
Staging
Development
 
 
 
← features →
Project B
Production
Staging
Development
ὄ
Thank you!

More Related Content

What's hot

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 FeaturesNuvole
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentsparkfabrik
 
Becoming A Drupal Master Builder
Becoming A Drupal Master BuilderBecoming A Drupal Master Builder
Becoming A Drupal Master BuilderPhilip Norton
 
Getting Into Drupal 8 Configuration
Getting Into Drupal 8 ConfigurationGetting Into Drupal 8 Configuration
Getting Into Drupal 8 ConfigurationPhilip Norton
 
Introduction to Module Development (Drupal 7)
Introduction to Module Development (Drupal 7)Introduction to Module Development (Drupal 7)
Introduction to Module Development (Drupal 7)April Sides
 
Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7Phase2
 
DDAY2014 - Features per Drupal 8
DDAY2014 - Features per Drupal 8DDAY2014 - Features per Drupal 8
DDAY2014 - Features per Drupal 8DrupalDay
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionPhilip Norton
 
Convert modules from 6.x to 7.x
Convert modules from 6.x to 7.xConvert modules from 6.x to 7.x
Convert modules from 6.x to 7.xJoão Ventura
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesGerald Villorente
 
Configuration Deployment in Drupal 8
Configuration Deployment in Drupal 8Configuration Deployment in Drupal 8
Configuration Deployment in Drupal 8Manifesto Digital
 
ExtBase workshop
ExtBase workshop ExtBase workshop
ExtBase workshop schmutt
 
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 DrupalCampLAJesus Manuel Olivas
 
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 3Drupalcon Paris
 
Hive Quick Start Tutorial
Hive Quick Start TutorialHive Quick Start Tutorial
Hive Quick Start TutorialCarl Steinbach
 
Working with Hive Analytics
Working with Hive AnalyticsWorking with Hive Analytics
Working with Hive AnalyticsManish Chopra
 

What's hot (20)

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
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend development
 
Becoming A Drupal Master Builder
Becoming A Drupal Master BuilderBecoming A Drupal Master Builder
Becoming A Drupal Master Builder
 
Getting Into Drupal 8 Configuration
Getting Into Drupal 8 ConfigurationGetting Into Drupal 8 Configuration
Getting Into Drupal 8 Configuration
 
Introduction to Module Development (Drupal 7)
Introduction to Module Development (Drupal 7)Introduction to Module Development (Drupal 7)
Introduction to Module Development (Drupal 7)
 
Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7
 
DDAY2014 - Features per Drupal 8
DDAY2014 - Features per Drupal 8DDAY2014 - Features per Drupal 8
DDAY2014 - Features per Drupal 8
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency Injection
 
Convert modules from 6.x to 7.x
Convert modules from 6.x to 7.xConvert modules from 6.x to 7.x
Convert modules from 6.x to 7.x
 
Drupal 8 Services
Drupal 8 ServicesDrupal 8 Services
Drupal 8 Services
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, Terminologies
 
Configuration Deployment in Drupal 8
Configuration Deployment in Drupal 8Configuration Deployment in Drupal 8
Configuration Deployment in Drupal 8
 
ExtBase workshop
ExtBase workshop ExtBase workshop
ExtBase workshop
 
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
 
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
 
Drupal 8 Configuration Management
Drupal 8 Configuration ManagementDrupal 8 Configuration Management
Drupal 8 Configuration Management
 
Hive Quick Start Tutorial
Hive Quick Start TutorialHive Quick Start Tutorial
Hive Quick Start Tutorial
 
Changelog
ChangelogChangelog
Changelog
 
Working with Hive Analytics
Working with Hive AnalyticsWorking with Hive Analytics
Working with Hive Analytics
 
Test
TestTest
Test
 

Similar to Drupal 8 Configuration Management with Features

Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...Erich Beyrent
 
Drupal migrations in 2018 - SFDUG, March 8, 2018
Drupal migrations in 2018 - SFDUG, March 8, 2018Drupal migrations in 2018 - SFDUG, March 8, 2018
Drupal migrations in 2018 - SFDUG, March 8, 2018Irina Zaks
 
Drupal Migrations in 2018
Drupal Migrations in 2018Drupal Migrations in 2018
Drupal Migrations in 2018Pantheon
 
Drupal 8 Configuration Management for you and your team
Drupal 8 Configuration Management for you and your teamDrupal 8 Configuration Management for you and your team
Drupal 8 Configuration Management for you and your teamLuc Bézier
 
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 2013Mack Hardy
 
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...Eric Sembrat
 
Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Angela Byron
 
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...Aleksey Tkachenko
 
Drupal Workflow Concepts
Drupal Workflow ConceptsDrupal Workflow Concepts
Drupal Workflow Conceptscgmonroe
 
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...Ben Shell
 
Drupal 8 configuration development flow
Drupal 8 configuration development flowDrupal 8 configuration development flow
Drupal 8 configuration development flowAndrii Podanenko
 
Drupal Now! - Introduction to Drupal
Drupal Now! - Introduction to DrupalDrupal Now! - Introduction to Drupal
Drupal Now! - Introduction to DrupalAlozie Nwosu
 
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overviewDrupalMumbai
 
Config management
Config managementConfig management
Config managementAlexei Goja
 
Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7Phase2
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesShabir Ahmad
 
Open Source CMS Certification
Open Source CMS CertificationOpen Source CMS Certification
Open Source CMS CertificationVskills
 
How to Migrate Drupal 6 to Drupal 8?
How to Migrate Drupal 6 to Drupal 8?How to Migrate Drupal 6 to Drupal 8?
How to Migrate Drupal 6 to Drupal 8?DrupalGeeks
 
Drupal 6 to Drupal 8 Migration
Drupal 6 to Drupal 8 MigrationDrupal 6 to Drupal 8 Migration
Drupal 6 to Drupal 8 MigrationAmeex Technologies
 

Similar to Drupal 8 Configuration Management with Features (20)

Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
 
Drupal migrations in 2018 - SFDUG, March 8, 2018
Drupal migrations in 2018 - SFDUG, March 8, 2018Drupal migrations in 2018 - SFDUG, March 8, 2018
Drupal migrations in 2018 - SFDUG, March 8, 2018
 
Drupal Migrations in 2018
Drupal Migrations in 2018Drupal Migrations in 2018
Drupal Migrations in 2018
 
Drupal 8 Configuration Management for you and your team
Drupal 8 Configuration Management for you and your teamDrupal 8 Configuration Management for you and your team
Drupal 8 Configuration Management for you and your team
 
Into to drupal8
Into to drupal8Into to drupal8
Into to drupal8
 
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
 
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
 
Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8
 
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 Workflow Concepts
Drupal Workflow ConceptsDrupal Workflow Concepts
Drupal Workflow Concepts
 
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 8 configuration development flow
Drupal 8 configuration development flowDrupal 8 configuration development flow
Drupal 8 configuration development flow
 
Drupal Now! - Introduction to Drupal
Drupal Now! - Introduction to DrupalDrupal Now! - Introduction to Drupal
Drupal Now! - Introduction to Drupal
 
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview
 
Config management
Config managementConfig management
Config management
 
Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API Changes
 
Open Source CMS Certification
Open Source CMS CertificationOpen Source CMS Certification
Open Source CMS Certification
 
How to Migrate Drupal 6 to Drupal 8?
How to Migrate Drupal 6 to Drupal 8?How to Migrate Drupal 6 to Drupal 8?
How to Migrate Drupal 6 to Drupal 8?
 
Drupal 6 to Drupal 8 Migration
Drupal 6 to Drupal 8 MigrationDrupal 6 to Drupal 8 Migration
Drupal 6 to Drupal 8 Migration
 

More from Nuvole

The OpenEuropa Initiative
The OpenEuropa InitiativeThe OpenEuropa Initiative
The OpenEuropa InitiativeNuvole
 
CMI 2.0 session at Drupal DevDays in Cluj-Napoca
CMI 2.0 session at Drupal DevDays in Cluj-NapocaCMI 2.0 session at Drupal DevDays in Cluj-Napoca
CMI 2.0 session at Drupal DevDays in Cluj-NapocaNuvole
 
Introducing the UI Patterns module: use atomic UI components everywhere in Dr...
Introducing the UI Patterns module: use atomic UI components everywhere in Dr...Introducing the UI Patterns module: use atomic UI components everywhere in Dr...
Introducing the UI Patterns module: use atomic UI components everywhere in Dr...Nuvole
 
Remote Collaboration and Institutional Intranets with Drupal and Open Atrium
Remote Collaboration and Institutional Intranets with Drupal and Open AtriumRemote Collaboration and Institutional Intranets with Drupal and Open Atrium
Remote Collaboration and Institutional Intranets with Drupal and Open AtriumNuvole
 
Public Works Monitoring
Public Works MonitoringPublic Works Monitoring
Public Works MonitoringNuvole
 
Extending and Customizing Open Atrium
Extending and Customizing Open AtriumExtending and Customizing Open Atrium
Extending and Customizing Open AtriumNuvole
 
Code driven development: using Features effectively in Drupal 6 and 7
Code driven development: using Features effectively in Drupal 6 and 7Code driven development: using Features effectively in Drupal 6 and 7
Code driven development: using Features effectively in Drupal 6 and 7Nuvole
 
Features based development workflow
Features based development workflowFeatures based development workflow
Features based development workflowNuvole
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentNuvole
 

More from Nuvole (9)

The OpenEuropa Initiative
The OpenEuropa InitiativeThe OpenEuropa Initiative
The OpenEuropa Initiative
 
CMI 2.0 session at Drupal DevDays in Cluj-Napoca
CMI 2.0 session at Drupal DevDays in Cluj-NapocaCMI 2.0 session at Drupal DevDays in Cluj-Napoca
CMI 2.0 session at Drupal DevDays in Cluj-Napoca
 
Introducing the UI Patterns module: use atomic UI components everywhere in Dr...
Introducing the UI Patterns module: use atomic UI components everywhere in Dr...Introducing the UI Patterns module: use atomic UI components everywhere in Dr...
Introducing the UI Patterns module: use atomic UI components everywhere in Dr...
 
Remote Collaboration and Institutional Intranets with Drupal and Open Atrium
Remote Collaboration and Institutional Intranets with Drupal and Open AtriumRemote Collaboration and Institutional Intranets with Drupal and Open Atrium
Remote Collaboration and Institutional Intranets with Drupal and Open Atrium
 
Public Works Monitoring
Public Works MonitoringPublic Works Monitoring
Public Works Monitoring
 
Extending and Customizing Open Atrium
Extending and Customizing Open AtriumExtending and Customizing Open Atrium
Extending and Customizing Open Atrium
 
Code driven development: using Features effectively in Drupal 6 and 7
Code driven development: using Features effectively in Drupal 6 and 7Code driven development: using Features effectively in Drupal 6 and 7
Code driven development: using Features effectively in Drupal 6 and 7
 
Features based development workflow
Features based development workflowFeatures based development workflow
Features based development workflow
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven Development
 

Recently uploaded

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 SoftwareJim McKeeth
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 
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 insideshinachiaurasa2
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
+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
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%+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...masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%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 Durbanmasabamasaba
 
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...SelfMade bd
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Recently uploaded (20)

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
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
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
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
+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...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%+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...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%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
 
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...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

Drupal 8 Configuration Management with Features

  • 1. From Drupal 7 to Drupal 8 Features vs. Configuration Management Fabian Bircher - fabian@nuvole.org 0
  • 3. ✈ Our Distributed Team Italy Belgium Czech Republic
  • 5. Ὃ Our Projects International organisations Institutions Fast delivery: several developers working simultaneously on the same site Frequent configuration changes: need for safe updates
  • 6.  Challenges We Face Remote collaboration on site development Keeping track of all configuration changes during development Pushing upgrades to production sites
  • 7. Chapter 1 ἱ ἴ ἳ ἲ ἱ The Evolution of Code-Driven Development in Drupal 8
  • 8. ὆ The long march to a "code-driven" Drupal Historically, Drupal has kept both configuration and content in the same database. Every time you click in the administrative interface, no record is kept. Drupal 6: Features appears, with the possibility to export configuration to PHP code Drupal 7: Features support is mature, but still relying on third parties and incomplete Drupal 8: Configuration and content are separated, configuration is text-based
  • 9.    The database-driven workflow disadvantages Default in Drupal 6 and Drupal 7 (core) Standard approach: you click, you save, Drupal saves to database and forgets Bad: Mixing configuration and content Bad: Losing track of configuration changes Theoretically still possible in Drupal 8!
  • 10.   The Features-driven workflow disadvantages A structural flaw: to package configuration into modules, you need to make it exportable to "code" Features is very good for packaging, not as good for exporting; but there's no packaging without exporting Not everything is exportable/traceable You must "whitelist" elements to be tracked: you never have the whole site under control
  • 11.   Code-driven is not just Features It’s a global technical choice For example, it includes makefiles and profiles, still applicable in D8 Keywords: text-based configuration, traceability, repeatability, reuse
  • 12. Ἲ New in Drupal 8 Configuration Management
  • 13. Ἲ A guided example of Configuration Management
  • 14. Ἲ Reference Use Case Modify the configuration of a production site: Keeping the site online all the time. Developing/testing the new configuration on a development copy. Exporting the configuration changes from development and importing them into production.
  • 15. Ἲ Step 1 of 6 Clone Site to Dev Production Install Site Full backup: Database Full Drupal tree Files Development Restore the backup (or install with config_installer)
  • 16. Ἲ Step 2 of 6 Modify Configuration Production Site operates normally: new users new content Development
  • 17. Ἲ Step 3 of 6 Export Configuration Production Site operates normally: new users new content Development
  • 18. Ἲ Step 4 of 6 Import into Staging Production Development
  • 19. Ἲ Step 5 of 6 Review Changes Production Development
  • 20. Ἲ Step 6 of 6 Apply Changes Production Development
  • 21. How this would have worked in Drupal 7 Clone site to development environment Create a feature exporting the site name variable Development: update the feature Transfer the feature to Production Production: enable/revert the feature
  • 22. drush DRUpal SHell: everybody loves! Drupal 8 ⇔ drush 7 Both not stable yet, but matching beta releases A new installation method: composer
  • 23. Ἲ Step 3 of 6 — Drush Style Export Configuration Development $ drush config-export The current contents of your export directory (sites/default/files/config_H6raw/staging) will be deleted. (y/n): y Configuration successfully exported to [success] sites/default/files/config_H6raw/staging.
  • 24. Ἲ Step 5 of 6 — Drush Style Review Changes Production $ drush config-import --preview=diff Configuration successfully exported to /tmp/drush_tmp_xy. [success] diff -u /tmp/drush_tmp_xy/system.site.yml sites/.../staging/system.site.yml --- /tmp/drush_tmp_xy/system.site.yml +++ sites/default/files/config_H6raw/staging/system.site.yml @@ -1,5 +1,5 @@ uuid: ca04efa4-51bf-4d12-8b00-e7b244b97aef -name: 'Drupal 8' +name: 'DDD 2015' mail: drupal@example.com slogan: '' page: Import the listed configuration changes? (y/n):
  • 25. Chapter 2  Inner workings of Configuration Management and Features
  • 26.  Use case Features A collection of logically related Drupal elements Packaged into PHP code, using hooks Exportability is a precondition to packaging Configuration Management Reference for the whole site configuration, development to production
  • 27. Ὄ Configuration format PHP Imperative Interpreted Can break site if corrupted Located in folders for modules Treated as modules YAML Declarative Parsed Cannot break anything if corrupted Located in specific folders for config Treated as data (like Rules' JSON in D7)
  • 28.  Support Optional Modules must offer support for Features No guarantees Mandatory Core configuration The only way to supply configuration
  • 29. ὒ Configuration and modules Drupal 7 Features are special modules Once a Feature is enabled, its configuration is tracked forever Drupal 8 Modules provide initial values In this sense, every module is a Feature Configuration is decoupled from modules after installation
  • 30.  Components selection Drupal 7 Explicitly listed in info file Rest is not tracked Drupal 8 All configuration is tracked Configuration is saved per config entity Can be individually imported/exported Config synchronisation requires all files to be present (missing = deleted)
  • 31.  Configuration staging Drupal 7 Feature states: normal, overridden, needs review Operations: features update/revert Diff available Drupal 8 Active store and staging store (multiple stores possible) Operations: import and export Diff available
  • 32.  Drush workflow Drupal 7 drush features-update drush features-revert Drupal 8 (with drush 7.x-dev) drush cex drush cim
  • 33. Ἴ ⚽ Cross-site compatibility Drupal 7 Write once, deploy anywhere A feature is ready to be deployed on multiple sites Drupal 8 Specific to multiple instances (dev, prod) of the same site This is the CMI use case Configuration Management relies on UUIDs
  • 34.  Ὁ Boundaries of configuration Drupal 7 Entities through entity api, CTools plugins Variables with Strongarm Content with features_uuid Menu links, custom and contrib modules can be problematic Drupal 8 Configuration Content State All clearly defined
  • 35. ὎ ὎ ὎ Features done right? Drupal 7 Not optimal A bit "forced" at times since it is not native in Drupal 7 Drupal 8 Clean Native Not as powerful as D7+Features yet
  • 36. Chapter 3   How to build Re-usable components
  • 37.  Use case Drupal 7: Features Package configuration Reuse configuration Focus on efficiency Drupal 8: CM Deploy configuration Tracking configuration Focus on reliability We want both, efficiency and reliability
  • 38. ⚠ Drawbacks Drupal 7: Features Not designed for deployment Used for deployment It drives people crazy Drupal 8: CM Designed for deployment Not designed for packaging Possible shortcomings when creating re-usable configuration.
  • 39.  Features 8.x-3.x Goes back to the core mission of Features: package functionality for re-use. No more project specific features! Under development, alpha available. Phase2 blog post Development module, not for production sites using CMI Announcing Features for Drupal 8 (http://www.phase2technology.com/blog/announcing- features-for-drupal-8/)
  • 42. ⇆ API import The Config namespace configuration must always be imported/exported through the API, never edit the files! The filesystem is not a good option, and this is the reason for Drupal 8 to store the active config in database by default: Performance Safety Security
  • 43. ⚙ Configurables in Drupal 8 ConfigEntityBaseclass Two entity namespaces: one for config, one for content
  • 44. ⚙ Working with configuration Reading and writing configuration // Get site name for displaying. $site_name = Drupal::config('system.site')->get('name'); // Get site name for editing. $editable_config = Drupal::configFactory()->getEditable('system.site'); $site_name = $editable_config->get('name'); // Set site name. $editable_config->set('name', 'My site')->save(); ⛼ variable_get()and variable_set()died.
  • 45. ⚙ Information about the system state instance-specific? (e.g., last cron run) → state configuration? (e.g., site mail) → config Site = filesystem + content + configuration + state
  • 46. ⚙ Working with states Reading and writing states // Get last cron run timestamp. $time = Drupal::state()->get('system.cron_last'); // Set cron run timestamp. Drupal::state()->set('system.cron_last', REQUEST_TIME);
  • 47. ⚙ Overriding "on the fly" The $confarray is still available as $config Useful in settings.local.php: Differentiate development and production environment
  • 48. Chapter 8 ⚛ A taste of Paradigm shift
  • 49. Multi developer workflow Configuration needs to be exported and imported! Version all configuration in git. (current site config state) Commit to git before synchronizing. (as a backup) Import merged configuration before continuing. ( pending)patch (https://www.drupal.org/node/2416109)
  • 50. ∆config = development Lock configuration changes on the live site. If locking is not an option: export and commit to a dedicated branch, so developers can merge it into the configuration which will be deployed. Best practices yet to be found. Join config_readonly (https://www.drupal.org/project/config_readonly) groups (https://groups.drupal.org/node/466373)
  • 51. Features workflow If you use features 8.x for deployment ⇒ you are doing it wrong. ™ Re-use configuration for other projects! Synchronize partial configuration between different sites. Use features in development environments.
  • 52. Features workflow Project A Production Staging Development       ← features → Project B Production Staging Development