How Drupal 8 Changes the Development Workflow – Luis Rodriguez – Development Workflow in Drupal 7



How Drupal 8 Changes the Development Workflow – Luis Rodriguez – Development Workflow in Drupal 7

0 0


dclimerick16

Presentation for DrupalCamp Limerick 2016

On Github luisrc7 / dclimerick16

How Drupal 8 Changes the Development Workflow

by:

Luis Rodriguez

I am a Developer at iterate.

Contact Me:

Presentation Slides:

http://luisrc7.github.io/dclimerick16

At iterate we design and develop Digital Experiences.

Our key focus areas are User Experience Design and Drupal.

And we are hiring!

Contact us at hello@iterate.ie or @iterate.

How Drupal 8 Changes the Development Workflow

Drupal 7 Drupal 8 - Configuration Management Drupal 8 CM + Drush Live Demo

I will tell my development experience. Short talk.

Development Workflow in Drupal 7

What is configuration

  • System variables (e.g. Site Name)
  • Content Types, Fields or Views
  • Menus
  • Vocabularies
Drupal 7 Slide 1 Intro

Development Workflow in Drupal 7

What is NOT configuration

  • Content: Nodes or Users
  • Comments
  • Taxonomy Terms
  • Menu Items
Drupal 7 Slide 1 Intro
Image Source: http://hojtsy.hu

Different Parts

  • Drupal Core (Almost all files/folders at root)
  • Websites related Files (sites and profiles folders)
  • Filesystem (sites/default/files or sites/my-site/files)
  • Database
Again this is in my own opinion/experience. Custom or Contrib modules / themes / profiles. Files could also be in a CDN.

Any configuration change will be saved into the database

But there were some workarounds.

  • FeaturesWas meant to share packages of code to different websites
  • hook_update_N
  • Others like Export/Import functions (Views, Context, Rules)
How D7 manage configuration changes. Blocks, CT definitions, View updates, context, rules.

My bad experiences

  • Unsynchronised environments
  • Changes made by Clients or other developers
  • Doing configuration in Live!
  • Feature's conflicts, not working issues, overrides.

Development Workflow in Drupal 8

Configuration Management !!!

Is a global solution to save config into code.

Configuration Management will save Website configuration into files

CM has an interface to import/export configuration

CM uses Yaml files

Yaml files are structured files, like XML format. YAML = Yet Another Markup Language.

Yaml files from Standard Profile installation

The CMI (Configuration Manager Initiative) was the first initiative for Drupal 8 back in 2012

The UI allows Export/Import the whole site configuration

And allows you to Export/Import single configuration files

Also has a form interface to upload the code for the new configuration through the UI

We will cover all these topics and example in the Demo.

CM Dependencies

CM manage dependencies

All dependencies get deleted

This allow the UI to give better information

CM manage dependencies different types. Delete CT will delete a view for example. Cool because don't leave anything that is now working on your installation.

Custom configuration files

It's possible in custom modules

But configuration files get imported just one time

To solve this issue there is "config_update" module

config_update Allows you to update configuration of your custom modules.

Then, does Features exists in Drupal 8?

Yes

Features is focused on its original purpose

Pack configuration together to share on different websites

Features will sit under the CM path

Question the audience why Features is still available in D8.

To avoid possible issues

  • Block UI changes on configuration. Module: config_readonly
  • Old way, download/sync the Live site into development before make the changes
  • With Drush
We will see the Drush options in the next block. #>drush config-merge @live-site --git

Benefits

  • Version control your configuration
  • Rollback to previous configuration
  • Create automated workflow

Unfortunately CM is not magic

Configuration still need to be imported

Configuration needs to be in the database at run time

Won't solve issues like complicated dependencies or 2 people working on the same configuration

Drush option --partial

CM + Drush Basics

Since Drush 8.x version

Basic Drush commands

drush config-export

drush config-import

config-export: Export configuration to a directory. config-import: Import config from a config directory.

Basic Drush arguments

--push | --add | --commit

--destination | --source

--partial

--push: commit and push the config export. --commit or --add --destination/source: Saves/Load the config in a given path. --partial: Only updates and new configs will be processed. (only for import)

It's Demo Time!

1) Check out the CM interface in DEV 2) Export configuration in LIVE 3) Import configuration in DEV 4) Modify configuration in DEV 5) Push config to LIVE (git) and Import/Synchronise 6) Sync LIVE config into existing changed config in DEV

Drupal 7

  • What is and what isn't configuration
  • Parts of Drupal
  • Workaround to save config in files
Parts of Drupal from my perspective. Workarounds: Features hook_update_N or Export/Import.

Drupal 8

  • Configuration Management
  • YAML files
  • Benefits
  • CM manage Dependencies
  • CM is not Magic
Benefits: Git, Rollback, automated wf. Issues: Import the files, multiple-people.

With Drush

  • Basic Import / Export commands
  • Basic command parameters
  • Alias combinations

Sources and Resources

  • DrupalCon presentations
  • Drupal.org Documentation
  • Reveal.js

Thank you!

Luis Rodriguez

http://luisrc7.github.io/dclimerick16