54
Cornell DrupalCamp VI September 26-27, 2019 Cornell University Ithaca, NY camp.drupal.cornell.edu

camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

Cornell DrupalCamp VI

September 26-27, 2019Cornell University

Ithaca, NY

camp.drupal.cornell.edu

Page 2: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

be cool, and

Commit! Your! Config! -- A Primer

Alison Jo McCauleyDrupal Developer, Cornell University

Page 3: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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 steps3

Page 4: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

...and cute dog pics!4

Page 5: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

What is Configuration Management ("CMI")

5

Page 6: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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!

Page 7: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

What is Configuration Management ("CMI")

7

Page 8: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

What is Configuration Management ("CMI")

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

8

Page 9: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

🎵 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

Page 10: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Page 11: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Page 12: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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!

Page 13: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

OK but, what *is* configuration?

🎵 or, what are configurations?🎵 or…?

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

13

Page 14: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

14

Page 15: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

What?! ...and, How?!

15

Page 16: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

🌞 Individual configurations -- examples:

core.extension

views.settings

views.view.events

What?!

16

Page 17: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

🌞 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

Page 18: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Page 19: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

What?! ...and, How?!

19

Page 20: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

20

Page 21: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

drush | grep config-

21

How?! -- to work with config

Page 22: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Page 23: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

Flashback!

23

Page 24: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Page 25: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Page 26: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

(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

Page 27: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

27

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

Page 28: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Page 29: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

(“We'll do it live” gif)

29

Page 30: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Use CMI !

30

Page 31: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

↝ 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

Page 32: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

32

How?! -- Site config in your code

Page 33: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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 structure33

How?! -- Site config in your code

Page 34: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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.yml34

How?! -- Site config in your code

Page 35: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

Flashback!

35

Page 36: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

↝ 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

Page 37: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

37

Page 38: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

lolololollolololololol

#laughsob

Pain points?

What pain points?

38

Page 39: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

Pain points

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

39

Page 40: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

🌞 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

Page 41: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

41

Page 42: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

Why you should Commit! Your! Config!

42

Page 43: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Page 44: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

yayyy!!

44

Page 45: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

(If time allows)

45

Page 46: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Page 47: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Page 48: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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

Page 49: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

(If time allows)

49

Page 50: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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-plugins-examples/migrating-configuration

50

Page 51: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

(If time allows, mention composer re: “installing”/”enabling” things…)- composer require + core.extension-

51

Page 52: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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; [email protected] you care, chime in! Don't let

the convo only be between

“core developers.”

52

Page 53: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

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 repo6. 🎉 PARTY 🎉

53

Page 54: camp.drupal.cornell - drupalgovcon.org … · Organize related config and/or build reusable functionality. CMI: Synchronize ALLLOL site settings between identical sites. 26 i.e. between

Cornell DrupalCamp VIcamp.drupal.cornell.edu

September 26-27, 2019Cornell University

Ithaca, NY