Cornell DrupalCamp VI camp.drupal.cornell.edu September 26-27, 2019 - - PowerPoint PPT Presentation

cornell drupalcamp vi camp drupal cornell edu
SMART_READER_LITE
LIVE PREVIEW

Cornell DrupalCamp VI camp.drupal.cornell.edu September 26-27, 2019 - - PowerPoint PPT Presentation

Cornell DrupalCamp VI camp.drupal.cornell.edu September 26-27, 2019 Cornell University Ithaca, NY be cool, and Commit! Your! Config! -- A Primer Alison Jo McCauley Drupal Developer, Cornell University Comin' atcha What is


slide-1
SLIDE 1

Cornell DrupalCamp VI

September 26-27, 2019

Cornell University Ithaca, NY

camp.drupal.cornell.edu

slide-2
SLIDE 2

be cool, and

Commit! Your! Config! -- A Primer

Alison Jo McCauley Drupal Developer, Cornell University

slide-3
SLIDE 3

Comin' atcha

♥ What is Configuration Management ("CMI") ♥ How to use CMI ♥ Using CMI with Dev > (Test > ) Live ♥ Configuration in code ♥ Pain points ♥ Still not sure?!?! -- Why you should Commit! Your! Config! ♥ Modules ♥ Brief mention of D8 migrations ♥ Questions? Lingering concerns? ♥ BONUS: Your next steps

3

slide-4
SLIDE 4

...and cute dog pics!

4

slide-5
SLIDE 5

What is Configuration Management ("CMI")

5

slide-6
SLIDE 6

First of all, have you used... 🎶 Drupal 8? 🎶 configuration management in Drupal 8? 🎶 Features in Drupal 7?

▶ Have you used “configuration management” in Drupal 7?

🎶 Think about the tools ^^ you use or want to be using. 🎶 Think about your wish list, when you came into this session.

6

PSYCH!

slide-7
SLIDE 7

What is Configuration Management ("CMI")

7

slide-8
SLIDE 8

What is Configuration Management ("CMI")

🎶 ALL site settings go in the config table of the database.

8

slide-9
SLIDE 9

🎶 ALL site settings go in the config table of the database.

What is Configuration Management ("CMI")

Obviously that’s a lie. Don’t worry, plenty of site settings are confusingly *not* in the config table.

9

slide-10
SLIDE 10

What is Configuration Management ("CMI")

🎶 ALL site settings go in the config table of the database. 🎶 Consistency 🎶 Features in Drupal 7, “ish” (but simpler)

10

slide-11
SLIDE 11

What is Configuration Management ("CMI")

🎶 ALL site settings go in the config table of the database. 🎶 Consistency 🎶 Features in Drupal 7, “ish” (but simpler) Learn more: 🎶 History of the Configuration Management Initiative 🎶 CMI 2.0 discussions -- part of effort to make Drupal easier to use #goals

11

slide-12
SLIDE 12

What is Configuration Management ("CMI")

🎶 ALL site settings go in the config table of the database. 🎶 Consistency 🎶 Features in Drupal 7, “ish” (but simpler) Learn more: 🎶 History of the Configuration Management Initiative 🎶 CMI 2.0 discussions -- part of effort to make Drupal easier to use #goals

12

If you care, chime in!

slide-13
SLIDE 13

OK but, what *is* configuration?

🎶

  • r, what are configurations?

🎶

  • r…?

🎶

Silly you --

“ALL site settings go in the config table of the database.” ← there ya go!

13

slide-14
SLIDE 14

14

slide-15
SLIDE 15

What?! ...and, How?!

15

slide-16
SLIDE 16

🌟 Individual configurations -- examples: core.extension views.settings views.view.events

What?!

16

slide-17
SLIDE 17

🌟 Config: ▶ Entity types (+ bundles): node types, vocabs, custom block types, media types… ▶ Modules enabled ▶ Views ▶ User roles and perms ▶ Misc site settings (including those from custom modules) ▶ Each menu setup ▶ Non-custom block settings ▶ Block layout settings 🌟 Not config: ▶ Entities -- nodes, terms, users, files… ▶ Menu links ▶ Custom blocks

(What?! ...and How?!)

17

slide-18
SLIDE 18

trickiness warning trickiness warning

🌟 Config: ▶ Entity types (+ bundles): node types, vocabs, custom block types, media types… ▶ Modules enabled ▶ Views ▶ User roles and perms ▶ Misc site settings (including those from custom modules) ▶ Each menu setup ▶ Non-custom block settings ▶ Block layout settings 🌟 Not config: ▶ Entities -- nodes, terms, users, files… ▶ Menu links ▶ Custom blocks

(What?! ...and How?!)

18

slide-19
SLIDE 19

🌟 Configuration is tied to one site’s unique hash_salt (in settings.php).

What?! ...and, How?!

19

slide-20
SLIDE 20

20

slide-21
SLIDE 21

🌟 “Single item” import/export 🌟 “Full archive” import/export 🌟 Config editor 🌟 Drush -- available commands:

drush | grep config-

21

How?! -- to work with config

slide-22
SLIDE 22

BUT WAIT! THERE’S MORE! *

🌟

“Import all” 🌟 “New,” “Changed,” “Removed” 🌟 Active (current setting) and Staged (to be imported) * if you commit your config 😜

22

How?! -- to work with config

slide-23
SLIDE 23

Flashback!

23

slide-24
SLIDE 24

What is Configuration Management ("CMI")

🎶 ALL site settings go in the config table of the database. 🎶 Site settings are stored in a consistent manner. 🎶 Features in Drupal 7, “ish” (but simpler). ^^ what??

24

slide-25
SLIDE 25

CMI:

Synchronize ALLLOL site settings between identical sites. ▶ i.e. between different environments of the same project

25

...similar “ish” to Features in Drupal 7

slide-26
SLIDE 26

(whereas) Features: Organize related config and/or build reusable functionality.

CMI:

Synchronize ALLLOL site settings between identical sites.

26

▶ i.e. between different environments of the same project

...similar “ish” to Features in Drupal 7

slide-27
SLIDE 27

27

How?! -- to use CMI with Dev > (Test > ) Live

slide-28
SLIDE 28

Use CMI with Dev > (Test > ) Live What’s your process for changing or creating functionality on your Drupal site?

28

How?! -- to use CMI with Dev > (Test > ) Live

slide-29
SLIDE 29

(“We'll do it live” gif)

29

slide-30
SLIDE 30

(“We'll do it live”gif, with “no” symbol on top)

Use CMI !

30

slide-31
SLIDE 31

↝ Synchronize between environments ↝ Mess with stuff (...“develop”...) in your Dev environment ↝ (Test on test/staging environment…) ↝ THEN, go live!

31

How?! -- to use CMI with Dev > (Test > ) Live

slide-32
SLIDE 32

32

How?! -- Site config in your code

slide-33
SLIDE 33

Reminder! Drupal stores *active* site settings in the config DB table. ...BUT / AND!

☔ yaml (.yml)

▶ (like so many things in Drupal 8!)

☔ Where?

▶ “Usually” sites/default/files/sync ▶ OR! (if you can) outside your project root ▶ Specify in settings.php: $settings['config_sync_directory'] ■ AND check on your hosting provider directory structure

33

How?! -- Site config in your code

slide-34
SLIDE 34

Reminder! Drupal stores *active* site settings in the config DB table. ...BUT / AND!

☔ yaml (.yml)

▶ (like so many things in Drupal 8!)

☔ Config files are... those configurations, in yaml! ☔ Remember those config names? Now as files-- core.extension.yml views.settings.yml views.view.events.yml

34

How?! -- Site config in your code

slide-35
SLIDE 35

Flashback!

35

slide-36
SLIDE 36

↝ Synchronize between environments ↝ Mess with stuff (...“develop”...) in your Dev environment ↝ (Test on test/staging environment…) ↝ THEN, go live!

↝ NOW with config that’s in your codebase! 🎊

36

How?! -- to use CMI with Dev > (Test > ) Live

slide-37
SLIDE 37

37

slide-38
SLIDE 38

lolololollolololololol #laughsob

Pain points?

What pain points?

38

slide-39
SLIDE 39

Pain points

🌟 “Import all” has no confirmation screen -- what!?

39

slide-40
SLIDE 40

🌟 Learning the errors / warnings

▶ The following items in your active configuration have changes since the last import that may be lost on the next import. ▶ ...your thing depends on cute.puppies.settings which does not exist... ▶ ...cannot delete fields.field.field_dog_rating because there’s data… ▶ UUID mismatches (not an error, just annoying) ▶ Blocks (ugh)

🌟 Learning names of configs 🌟 Everything at once, OR, tiny pieces one at a time 🌟 New/changed configs due to updates 🌟 Pain specific to committing your config…? Not really.

▶ Simplicity, compared to Features

Pain points

40

slide-41
SLIDE 41

41

slide-42
SLIDE 42

Why you should Commit! Your! Config!

42

slide-43
SLIDE 43

Why you should Commit! Your! Config!

⛄ Version control. ⛄ VERSION CONTROL!! ⛄ V E R S I O N C O N T R O L ⛄ Mini-flashback: Everything at once, OR, tiny pieces one at a time ^^ UNLESS you Commit! Your! Config!

43

slide-44
SLIDE 44

yayyy!!

44

slide-45
SLIDE 45

(If time allows)

45

slide-46
SLIDE 46

Modules

⚡ Configuration Manager in Drupal 8 core ⚡ Config ignore -- completely ignore certain configurations (examples) ⚡ Configuration split -- different settings per environment (examples) Also: ⚡ Configuration installer ⚡ Configurable Blocks ⚡ Configuration Update Manager -- not what I thought it was going to be ⚡ D8 Features

46

slide-47
SLIDE 47

Modules

⚡ Configuration Manager in Drupal 8 core ⚡ Config ignore -- completely ignore certain configurations (examples) ⚡ Configuration split -- different settings per environment (examples) Also: ⚡ Configuration installer ⚡ Configurable Blocks ⚡ Configuration Update Manager -- not what I thought it was going to be ⚡ D8 Features

47

slide-48
SLIDE 48

Modules

⚡ Configuration Manager in Drupal 8 core ⚡ Config ignore -- completely ignore certain configurations (examples) ⚡ Configuration split -- different settings per environment (examples) Also: ⚡ Configuration installer ⚡ Configurable Blocks ⚡ Configuration Update Manager -- not what I thought it was going to be ⚡ D8 Features

48

slide-49
SLIDE 49

(If time allows)

49

slide-50
SLIDE 50

Migrating to Drupal 8 (from D6/D7)

...it depends! 🎊

  • Content types, vocabularies (taxonomy), …
  • Look in module code! (core/contrib)
  • dblog settings example:

https://www.drupal.org/docs/8/api/migrate-api/migrate-destination-plug ins-examples/migrating-configuration

50

slide-51
SLIDE 51

(If time allows, mention composer re: “installing”/”enabling” things…)

  • composer require + core.extension
  • 51
slide-52
SLIDE 52

Now that I’ve convinced you...

❄ Questions? ❄ Lingering concerns?

Also, links! 🐿 D.o: Managing your site’s configuration 🐿 History of the Configuration Management Initiative 🐿 CMI 2.0 discussions -- part of effort to make Drupal easier to use #goals

@alisonjo2786 everywhere; alison@cornell.edu

If you care, chime in! Don't let the convo only be between “core developers.”

52

slide-53
SLIDE 53

Your next steps...

1. Enable “configuration manager” (core module) 2. Export your site’s configuration (admin > configuration > development > configuration synchronization > export > download the whole archive) 3. Extract those files to a location in your repo that makes sense for you (see slide 32) 4. Update settings.php with where you put those config files (see slide 32) 5. Commit those files to your repo 6. 🎊 PARTY 🎊

53

slide-54
SLIDE 54

Cornell DrupalCamp VI camp.drupal.cornell.edu

September 26-27, 2019

Cornell University Ithaca, NY