SlideShare a Scribd company logo
Gestione della configurazioneGestione della configurazione
in Drupal 8in Drupal 8
Andrea Pescetti – NuvoleAndrea Pescetti – Nuvole
Nuvole
Parma – Brussels – Prague
Pioneers of
Code Driven Development:
configuration management
for Drupal 6 and Drupal 7.
Successfully used in projects for
many international organizations.
#DrupalDaysIT
Configuration Management
An overview and practical introduction for site builders.
#DrupalDaysIT
Configuration Management Initiative
“Site configuration information in D8 is stored
in files in your library’s directory, making it
much simpler to transport configuration
changes such as new content types, fields, or
views from development to production.”
The initial goal, with some implementation differences,
was reached. CMI already works in the Drupal 8 branch.
#DrupalDaysIT
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 in production.
#DrupalDaysIT
Step 1 of 6: Clone Site to Dev
PRODUCTION
Copy:
• Database
• Full Drupal tree
• Files
DEVELOPMENT
Restore the copy
#DrupalDaysIT
Step 2 of 6: Modify Configuration
PRODUCTION
Site operates
normally: new users,
new content.
DEVELOPMENT
#DrupalDaysIT
Step 3 of 6: Export Configuration
PRODUCTION
Site operates
normally: new users,
new content.
DEVELOPMENT
#DrupalDaysIT
Step 4 of 6: Import in Staging
PRODUCTION DEVELOPMENT
#DrupalDaysIT
Step 5 of 6: Review Changes
PRODUCTION DEVELOPMENT
#DrupalDaysIT
Step 6 of 6: Apply Changes
PRODUCTION DEVELOPMENT
#DrupalDaysIT
There's Much More...
• This is only the site builder's user experience.
• CMI is still under active development.
• Significant changes can still occur before Drupal 8 is
released.
#DrupalDaysIT
From Drupal 7 to Drupal 8
What changed. What improved. What's still missing.
#DrupalDaysIT
87
D7 to D8: Configuration is defined
Are vocabularies
configuration?
Are taxonomy terms
configuration?
If it's in the config,
it's configuration!
#DrupalDaysIT
87
D7 to D8: Configuration Storage
Database
Text files
(well... text files
stored in DB by
default)
#DrupalDaysIT
87
D7 to D8: Uniform Approach
Variables
DB Tables
CTools
Features
Black magic...
Text files in YAML
format
#DrupalDaysIT
87
D7 to D8: Staging Configuration
Through Features,
revert to apply
Native
#DrupalDaysIT
87
D7 to D8: Interface to Developers
“Exportables”
from CTools and bag
of (incompatible)
tricks
“Configurables”
as PHP classes
(entities)
#DrupalDaysIT
D7 to D8: Comparison 1/2
D7 Core
D7 Core+
Features
D8 Core
Export full site config
(no content)
NO NO YES
Export selected
config items
NO YES YES
Track config changes
(full site)
NO NO YES
Track config changes
(selected items)
NO YES YES
#DrupalDaysIT
D7 to D8: Comparison 2/2
D7 Core
D7 Core+
Features
D8 Core
Stage configuration NO YES YES
Package
configuration
NO YES NO
Reuse configuration
in other projects
NO YES NO
Collaborate on the
same project
NO YES NO
#DrupalDaysIT
Is CMI “Features Done Right”?
No.
It is a nice way to replace and improve one use
case for Features: making configuration
exportable into text files.
#DrupalDaysIT
Is CMI “Features Done Wrong”?
No.
It is a huge step forward to developers and it paves
the way for additional modules that could offer
the same functionality of Drupal 7 + Features in a
much cleaner and more reliable way.
#DrupalDaysIT
A Closer Look at CMI
Under the hood. Caveats and pending developments.
#DrupalDaysIT
Two Levels of Configuration
Active store
The real site configuration. If you only configure
“D7-style”, you'll use this one and never see CMI.
Staging store
Temporary area for configuration files that are to
be reviewed and imported.
#DrupalDaysIT
Configuration in settings.php
$config_directories['active'] =
'sites/default/files/config_al6ppw6/active';
$config_directories['staging'] =
'sites/default/files/config_al6ppw6/staging';
The random string is for extra security.
The two directories can be out of the Drupal root.
#DrupalDaysIT
A Look at the Active Store
$ ls sites/default/files/config_al6ppw6/active
$
Empty?
#DrupalDaysIT
Files are in Database
MySQL> select name FROM config;
+---------------------------------+
| name |
+---------------------------------+
| bartik.settings |
| ... |
| views.view.who_s_new |
| views.view.who_s_online |
+---------------------------------+
166 rows in set
Files are binary blobs in DB (backend pluggable)
#DrupalDaysIT
Why the Database?
Performance
It's faster than reading/parsing files.
Safety
No temptation to edit files “because you can”.
Security
Less likely to leave read access accidentally open.
#DrupalDaysIT
YAML Example: in Drupal
#DrupalDaysIT
YAML Example: in Exported Config
$ cat image.style.large.yml
name: large
label: 'Large (480x480)'
status: true
uuid: 15dda024-4160-40e2-b305
langcode: en
dependencies: { }
effects:
ddd73aa7-4bd6-4c85-b600:
uuid: ddd73aa7-4bd6-4c85-b600
id: image_scale ...
#DrupalDaysIT
YAML Example: in Default Config
$ pwd
.../core/modules/system/config/install
$ cat system.site.yml
uuid: ''
name: Drupal
mail: ''
slogan: ''
page:
403: ''
404: ''
front: user
admin_compact_mode: false
#DrupalDaysIT
YAML Example: After Install
#DrupalDaysIT
UUIDs Everywhere
Good
Prevent any possible conflicts.
Bad
“Universally Unique” clashes with “Reusable”
(especially with relations).
#DrupalDaysIT
Caveat: CMI is for the Same Site
No portability, by design
The export/import cycle is assumed to be between
multiple version (dev, production) of the same
Drupal project.
#DrupalDaysIT
Caveat: CMI is not Atomic
$ cat user.role.authenticated.yml
id: authenticated
label: 'Authenticated user'
weight: 1
permissions:
- 'use text format plain_text'
- 'access content'
- 'use text format basic_html'
- 'access comments'
Can't package a “feature” reusing whole files.
Need for an intermediate layer.
#DrupalDaysIT
Caveat: Import Can Break Things
$ [export config]
$ rm node.type.page.yml
$ [import config]
Existing pages are orphaned and unusable; always
make a backup dump or review changes carefully!
#DrupalDaysIT
Caveat: No Consistency Check
$ [export config]
$ vim system.theme.yml
$ cat system.theme.yml # Typo in name!
admin: seven
default: barTtik
$ [import config]
An invalid configuration is imported and applied;
style is broken.
#DrupalDaysIT
Pending: Install from Existing Config
Issue 1613424
Idea: create a clean copy (all config, no content) of
a production site.
Theoretically, possible by providing an “install fom
existing config” choice as if it were an installation
profile (see issue for discussion).
#DrupalDaysIT
Pending: Robust Synchronization
Issue 2121751
Idea: Synchronize sites in a stable way, handling
possible conflicts.
Use case: handle gracefully the case where the
same View was created independently on
production and development (see issue for
discussion).
#DrupalDaysIT
CMI for Developers
Configurables. How to work with configuration.
#DrupalDaysIT
Configurables
As everything in Drupal 8, object-oriented
interface:
abstract class ConfigEntityBase
Namespace
DrupalCoreConfigEntity
#DrupalDaysIT
Configurables are Entities
class ConfigEntityBase extends Entity { ...
}
DrupalCoreEntityEntity
|- DrupalCoreConfigEntityConfigEntityBase
- DrupalCoreEntityContentEntityBase
Two namespaces: one for config, one for content.
#DrupalDaysIT
Retrieving Configuration Objects
Drupal::config($name)
Where $name is the configuration object (filename of
the YAML file, without the .yml extension).
Example:
$site_name = Drupal::config('system.site')
->get('name');
#DrupalDaysIT
Modifying Configuration Objects
Drupal::config('system.site')
->set('name', 'Drupal 8 test')
->save();
The active store is immediately modified. The
staging store is not used.
#DrupalDaysIT
Drush 7.x Integration
config-list (cli)
List config names by prefix.
config-export (cex)
Export config from the active store.
config-import (cim)
Import config from a config dir.
config-get (cget)
Display a config value, or a whole
configuration object.
config-set (cset)
Set a config value directly in
the active configuration.
Nuvole
Andrea Pescetti
http://nuvole.org
info@nuvole.org
@nuvoleweb

More Related Content

PDF
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
PDF
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
PDF
Drupal 8 Configuration Management with Features
KEY
Automating Drupal Development: Makefiles, features and beyond
PDF
Drupal 8 Configuration Management
PDF
Drupal 8 CMI on a Managed Workflow
PPTX
ExtBase workshop
PDF
How HarperDB Works
Configuration Management in Drupal 8: A preview (DrupalDays Milano 2014)
Configuration Management in Drupal 8: A preview (DrupalCamp Alpe Adria 2014)
Drupal 8 Configuration Management with Features
Automating Drupal Development: Makefiles, features and beyond
Drupal 8 Configuration Management
Drupal 8 CMI on a Managed Workflow
ExtBase workshop
How HarperDB Works

What's hot (20)

PDF
Drupal 8 - Corso frontend development
PDF
Non-Relational Postgres
 
PPTX
Drupal 8 Configuration Management
PPTX
PiBase Updates
PDF
Postgres.foreign.data.wrappers.2015
 
PPT
Adding Value to HBase with IBM InfoSphere BigInsights and BigSQL
PDF
Overview of Postgres 9.5
 
PPT
Introduction to Module Development (Drupal 7)
PDF
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
PDF
Big Data: Big SQL and HBase
PDF
Using Search API, Search API Solr and Facets in Drupal 8
PDF
Hands-on-Lab: Adding Value to HBase with IBM InfoSphere BigInsights and BigSQL
PDF
Working with Hive Analytics
PPT
Hbase in action - Chapter 09: Deploying HBase
ZIP
What's new in the Drupal 7 API?
PPTX
Logical Replication in PostgreSQL
 
PDF
Oracle 12.2 sharded database management
PDF
Big Data: HBase and Big SQL self-study lab
PPTX
Big file tablespaces
PDF
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Drupal 8 - Corso frontend development
Non-Relational Postgres
 
Drupal 8 Configuration Management
PiBase Updates
Postgres.foreign.data.wrappers.2015
 
Adding Value to HBase with IBM InfoSphere BigInsights and BigSQL
Overview of Postgres 9.5
 
Introduction to Module Development (Drupal 7)
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
Big Data: Big SQL and HBase
Using Search API, Search API Solr and Facets in Drupal 8
Hands-on-Lab: Adding Value to HBase with IBM InfoSphere BigInsights and BigSQL
Working with Hive Analytics
Hbase in action - Chapter 09: Deploying HBase
What's new in the Drupal 7 API?
Logical Replication in PostgreSQL
 
Oracle 12.2 sharded database management
Big Data: HBase and Big SQL self-study lab
Big file tablespaces
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Ad

Similar to Gestione della configurazione in Drupal 8 (20)

PDF
Building and Maintaining a Distribution in Drupal 7 with Features
PDF
DDAY2014 - Features per Drupal 8
PDF
Building a Custom Theme in Drupal 8
PDF
Drupal 8: frontend development
PDF
Drupal 8 Configuration Management for you and your team
PDF
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
PDF
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
ZIP
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
PDF
Config management
PDF
Introduction to Drupal - Installation, Anatomy, Terminologies
PDF
Improving your Drupal 8 development workflow DrupalCampLA
DOCX
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview
PPT
Into to drupal8
PPTX
Top 8 Improvements in Drupal 8
PDF
Staging Drupal 8 31 09 1 3
PPTX
Display Suite: A Themers Perspective
PDF
Getting Into Drupal 8 Configuration
PPTX
Manage Deployments with Install Profiles and Git
PPTX
R sharing 101
Building and Maintaining a Distribution in Drupal 7 with Features
DDAY2014 - Features per Drupal 8
Building a Custom Theme in Drupal 8
Drupal 8: frontend development
Drupal 8 Configuration Management for you and your team
Configuration as Dependency: Managing Drupal 8 Configuration with git and Com...
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
Config management
Introduction to Drupal - Installation, Anatomy, Terminologies
Improving your Drupal 8 development workflow DrupalCampLA
13th Sep - Drupal Global Training Day by TCS - Drupal core advanced overview
Into to drupal8
Top 8 Improvements in Drupal 8
Staging Drupal 8 31 09 1 3
Display Suite: A Themers Perspective
Getting Into Drupal 8 Configuration
Manage Deployments with Install Profiles and Git
R sharing 101
Ad

More from Eugenio Minardi (20)

PDF
Delphi and ExtJS (26 ottobre 2017)
PDF
ExtJS: La piattaforma vincente (tools)
PDF
ExtJS: La piattaforma vincente (multiple screens)
PDF
ExtJS: La piattaforma vincente (rich UI)
PDF
ExtJS: La piattaforma vincente (class system)
PDF
ExtJS: La piattaforma vincente
PDF
Distributed Team Management: 
Pitfall, Challenges and Advantages
PDF
A Practical Introduction to Symfony (European Drupal Days 2015)
PDF
UN World Food Programme Standards & Best Practises (European Drupal Days 2015)
PDF
Drupal theming - a practical approach (European Drupal Days 2015)
PDF
Optimizing MariaDB for Web Applications (European Drupal Days 2015)
PDF
PhpStorm for Drupal Development (European Drupal Days 2015)
PDF
Drupal Continuous Integration (European Drupal Days 2015)
PDF
Deploying an Open Source DAM in SAAS Mode (European Drupal Days 2015)
PDF
The multilingual Drupal 8 experience (European Drupal Days 2015)
PDF
Another Copernican Revolution: maintenance first, projects second (European D...
PDF
Drupal Security: How to survive Drupalgeddon and prepare for future (European...
PDF
The benefits of an elastic infrastructure on a Drupal e-commerce (European Dr...
PDF
Verifying Drupal modules with OWASP ASVS 2014 (European Drupal Days 2015)
PDF
Secure Drupal, from start to finish (European Drupal Days 2015)
Delphi and ExtJS (26 ottobre 2017)
ExtJS: La piattaforma vincente (tools)
ExtJS: La piattaforma vincente (multiple screens)
ExtJS: La piattaforma vincente (rich UI)
ExtJS: La piattaforma vincente (class system)
ExtJS: La piattaforma vincente
Distributed Team Management: 
Pitfall, Challenges and Advantages
A Practical Introduction to Symfony (European Drupal Days 2015)
UN World Food Programme Standards & Best Practises (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)
Optimizing MariaDB for Web Applications (European Drupal Days 2015)
PhpStorm for Drupal Development (European Drupal Days 2015)
Drupal Continuous Integration (European Drupal Days 2015)
Deploying an Open Source DAM in SAAS Mode (European Drupal Days 2015)
The multilingual Drupal 8 experience (European Drupal Days 2015)
Another Copernican Revolution: maintenance first, projects second (European D...
Drupal Security: How to survive Drupalgeddon and prepare for future (European...
The benefits of an elastic infrastructure on a Drupal e-commerce (European Dr...
Verifying Drupal modules with OWASP ASVS 2014 (European Drupal Days 2015)
Secure Drupal, from start to finish (European Drupal Days 2015)

Recently uploaded (20)

PDF
Uptota Investor Deck - Where Africa Meets Blockchain
PDF
BIOCHEM CH2 OVERVIEW OF MICROBIOLOGY.pdf
PDF
Understand the Gitlab_presentation_task.pdf
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PPTX
newyork.pptxirantrafgshenepalchinachinane
PPTX
APNIC Report, presented at APAN 60 by Thy Boskovic
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PDF
Introduction to the IoT system, how the IoT system works
PDF
The Evolution of Traditional to New Media .pdf
PDF
📍 LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1 TERPOPULER DI INDONESIA ! 🌟
PPTX
Database Information System - Management Information System
PDF
simpleintnettestmetiaerl for the simple testint
PDF
Session 1 (Week 1)fghjmgfdsfgthyjkhfdsadfghjkhgfdsa
PPTX
Slides PPTX: World Game (s): Eco Economic Epochs.pptx
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PDF
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
PPTX
Internet Safety for Seniors presentation
PPT
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
PPTX
Cyber Hygine IN organizations in MSME or
PPTX
artificialintelligenceai1-copy-210604123353.pptx
Uptota Investor Deck - Where Africa Meets Blockchain
BIOCHEM CH2 OVERVIEW OF MICROBIOLOGY.pdf
Understand the Gitlab_presentation_task.pdf
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
newyork.pptxirantrafgshenepalchinachinane
APNIC Report, presented at APAN 60 by Thy Boskovic
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
Introduction to the IoT system, how the IoT system works
The Evolution of Traditional to New Media .pdf
📍 LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1 TERPOPULER DI INDONESIA ! 🌟
Database Information System - Management Information System
simpleintnettestmetiaerl for the simple testint
Session 1 (Week 1)fghjmgfdsfgthyjkhfdsadfghjkhgfdsa
Slides PPTX: World Game (s): Eco Economic Epochs.pptx
Power Point - Lesson 3_2.pptx grad school presentation
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
Internet Safety for Seniors presentation
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
Cyber Hygine IN organizations in MSME or
artificialintelligenceai1-copy-210604123353.pptx

Gestione della configurazione in Drupal 8