Configuration Management: True Life Stories

A presentation at Drupal Providence Meetup in October 2018 in Providence, RI, USA by John Picozzi

Slide 1

Slide 1

Configuration Management A True Life Story Page 1 | Configuration Management: A True Life Story

Slide 2

Slide 2

John E. Picozzi Senior Drupal Architect Drupal Providence 401-228-7660 oomphinc.com 72 Clifford Street, oomph.is/jpicozzi Providence, RI 02903 jpicozzi@oomphinc.com Page 2 | Configuration Management: A True Life Story

Slide 3

Slide 3

Nathan Dentzau PHP Application Developer @nathandentzau /nathandentzau Drupal Providence chromatichq.com chromatichq.com/users/nathan-dentzau nate@chromatichq.com Page 3 | Configuration Management: A True Life Story

Slide 4

Slide 4

What is configuration? September 1, 2016 Page 4 | Configuration Management: A True Life Story

Slide 5

Slide 5

” In Drupal, configuration is the collection of admin settings that determine how the site functions, as opposed to the content of the site. https://www.drupal.org/docs/8/configuration-management Page 5 | Configuration Management: A True Life Story

Slide 6

Slide 6

Configuration vs. Content Configuration Content Content types Nodes Taxonomy vocabulary Taxonomy terms Menus Menu links Blocks Block content Media types Media Page 6 | Configuration Management: A True Life Story

Slide 7

Slide 7

Pantheon Workflow https://pantheon.io/docs/pantheon-workflow/#code-moves-up-content-moves-down Page 7 | Configuration Management: A True Life Story

Slide 8

Slide 8

Other types of configuration ● Fields ● Language settings ● Views ● System settings ● Display modes ● User roles ● Image styles ● Module settings Page 8 | Configuration Management: A True Life Story

Slide 9

Slide 9

Where is configuration stored? Page 9 | Configuration Management: A True Life Story

Slide 10

Slide 10

Configuration Storage: Database ● Active configuration ● Stored in a relational database ● Changes applied immediately ● Benefits: ○ Performance ○ Security Page 10 | Configuration Management: A True Life Story

Slide 11

Slide 11

Configuration Storage: Filesystem ● Staged configuration ● Stored on the filesystem as YAML files ● Changes applied by export or import ● Benefits: ○ Portability ○ Security Page 11 | Configuration Management: A True Life Story

Slide 12

Slide 12

Configuration Manager September 1, 2016 Page 12 | Configuration Management: A True Life Story

Slide 13

Slide 13

Configuration Manager ● ● ● Core module Import and export a single set of configuration to the filesystem ○ User Interface ○ Drush Install configuration from modules, profiles and themes ○ Required config ○ Optional config Page 13 | Configuration Management: A True Life Story

Slide 14

Slide 14

View Differences Page 14 | Configuration Management: A True Life Story

Slide 15

Slide 15

Configuration Manager: Workflow The Configuration Management module offers a linear workflow where each environment shares the same set of configuration. COMMON CONFIG LOCAL Page 15 | Configuration Management: A True Life Story DEV STAGE PROD

Slide 16

Slide 16

Configuration Split September 1, 2016 Page 16 | Configuration Management: A True Life Story

Slide 17

Slide 17

Configuration Split ● ● ● ● Contributed module Import and export multiple sets (splits) of configuration to the filesystem ○ User Interface ○ Drush Enable/disable modules or themes for different environments Store different configuration values for different environments ○ Complete Split / Blacklist ○ Conditional Split / Graylist Page 17 | Configuration Management: A True Life Story

Slide 18

Slide 18

Configuration Split: Workflow The Configuration Split module offers a distributed workflow where each environment has an independent set of configuration built on top of a common config. COMMON CONFIG LOCAL Page 18 | Configuration Management: A True Life Story DEV STAGE PROD

Slide 19

Slide 19

Why is config split helpful? Page 19 | Configuration Management: A True Life Story

Slide 20

Slide 20

Complete Split Page 20 | Configuration Management: A True Life Story

Slide 21

Slide 21

Conditional Split Page 21 | Configuration Management: A True Life Story

Slide 22

Slide 22

Configuration Readonly September 1, 2016 Page 22 | Configuration Management: A True Life Story

Slide 23

Slide 23

Configuration Readonly ● ● ● ● Contributed module Prevents administrators from editing active configuration through the User Interface Module can be enabled per environment with Configuration Split Warning: Have a solid continuous integration pipeline and testing procedures in place before enabling in a production environment. Page 23 | Configuration Management: A True Life Story

Slide 24

Slide 24

Configuration Installer September 1, 2016 Page 24 | Configuration Management: A True Life Story

Slide 25

Slide 25

Configuration Installer ● ● Contributed install profile Install a new instance of Drupal from an existing set of configuration ● Note: Not compatible with Configuration Split. Manually importing configuration after install works Page 25 | Configuration Management: A True Life Story

Slide 26

Slide 26

Configuration & Continuous Integration September 1, 2016 Page 26 | Configuration Management: A True Life Story

Slide 27

Slide 27

What is Continuous Integration? ● ● ● The process of automating the build and testing of code in a shared code repository Developers can focus on code and less on environment management Developers can confidently merge in code changes to a project while working on a team Repository Test / Build Code Website Page 27 | Configuration Management: A True Life Story

Slide 28

Slide 28

Continuous Integration: Code ● ● ● Developers can use the Configuration Manager module to export Drupal configuration to version control and easily share configuration changes with other team members Developers can use the Configuration Split module to test configuration changes locally for different environments Code syntax validators can be executed with git hooks or manual invocation locally Page 28 | Configuration Management: A True Life Story

Slide 29

Slide 29

Continuous Integration: Repository ● ● ● ● Developers push and pull code from a central code repository like Github Pull requests are created by the developer making the change and reviewed by other team members Automated build and tests are triggered when new commits are pushed Results are posted in the pull request and prevent developers from merging changes until tests pass Page 29 | Configuration Management: A True Life Story

Slide 30

Slide 30

Continuous Integration: Test / Build ● ● ● Continuous integration services like Travis-CI can run code syntax validators, automated tests, and deployments in a CI pipeline The Configuration Installer profile can be used to install a new instance of Drupal testing the validity of configuration changes and to run automated functional tests If a failure occurs in any step in the pipeline, the build is halted Page 30 | Configuration Management: A True Life Story

Slide 31

Slide 31

Continuous Integration: Website ● ● ● Importing configuration changes, database updates and entity updates handled automatically during the deployment process Developers can enable the Configuration Readonly module in Production Improved site reliability and uptime Page 31 | Configuration Management: A True Life Story

Slide 32

Slide 32

Thank You! Thank you for listening. If you have any questions feel free to contact us. nathandenzau /in/johnpicozzi @nathandentzau @JohnPicozzi nathandentzau johnpicozzi chromatichq.com @chromatichq /users/nathan-dentzau 401-228-7660 oomph.is/jpicozzi Oomphinc.com jpicozzi@oomphinc.com @oomphinc