Drupal 8: Composer and Configuration Management

bjlewis2

This session will cover practical uses of Composer and Configuration Management in a typical Drupal 8 project.

This is a session I gave at DrupalCon New Orleans, DrupalCorn Camp 2016 and DrupalCamp Colorado 2016. There have been a number of changes to the "proper" way to use composer, and I've learned a lot along the way, so I'm excited to have the chance to present this again with an updated slide deck/demo reel!

Basically, the session will focus on building and maintaining a site with Composer, as well as how to use Configuration Management to push changes from a local environment up to a production one.

We'll use Composer, Drush, Git and Configuration Management and see how they all work together to make your Drupal 8 site development and management process faster, more efficient, and less error prone.

This session has also been updated to use the new official drupal.org packagist repo since the Drupal Packagist repo is set to be deprecated in January.

Slides: https://docs.google.com/presentation/d/1gxcxT6o47xVrfsZ7ZSQKjBRT-gfE54A1Z9kjvvGHwCo/edit#slide=id.p

Video Series: https://modulesunraveled.com/drupal-8-composer-and-configuration-management/

Outline

This is a session all about the advanced site-building tools and techniques available to Drupal 8 site-builders.

This session will cover Composer, Drush, Git, Configuration Management and how they all work together to make Drupal 8 site development and management process faster, more efficient, and less error prone.

Install Drupal 8 with Composer

Commiting with Git Using Composer to Manage Project Dependencies

  • Finding Packages on packagist.drupal-composer.org
  • Install, Uninstall and Update Modules/Themes/etc. with Composer
  •  Installing a Package From a Git Repository
  • How to Decide Which Version Pattern to Use

Overriding Settings in Code with settings.local.php

  • Create settings.local.php
  • Enable settings.local.php
  • Where to Find Configuration Settings That Can Be Overridden
  • Commit settings.php, but not settings.local.php

Configuration Management Through the UI and with Drush

  • Workaround For Sites That Were Installed Without Importing the Database
  • Syncing Configuration Through the UI
    • Exporting Configuration
    • Importing Configuration
  • Syncing Configuration Using Drush
    • Exporting Configuration
    • Importing Configuration

How to use Composer, Git, Drush and Configuration Management to Push Changes from Development to Production

  • Managing Configuration with Git
    • Pushing Code and Configuration to the Repo
    • Pulling Code and Configuration to Another Site Instance
    • Import the Original Site's Database into the Production Environment
    • Composer Install the New Site
    • Make Sure the Files Directories are Correct
    • Importing Configuration

Putting it all Together

  • Install a new module with Composer
  • Install a new theme with Composer
  • Enable Admin Toolbar and Admin Toolbar Extra Tools and Pathauto
  • Change the temp path on our local site to "/tmp"
  • Add a few blocks to various regions
  • Save a Google Analytics account to configuration through the UI
  • Override the GA account with an empty string on development
  • Export the configuration with Drush
  • Commit it to Git
  • Push it to the remote repo
  • Pull it to production
  • Import the configuration to the production server
  • And have an exact replica of our development configuration on our production server!

Session Track

Site Building

Experience Level

Intermediate

Drupal Version