updating drupal’s minor or patch version - june 7-10, 2018updating drupal’s minor or patch...

115
Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date Amber Himes Matz Twin Cities Drupal Camp June 2018

Upload: others

Post on 27-Jun-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Updating Drupal’s Minor or Patch Version

Keeping Drupal up-to-date

Amber Himes MatzTwin Cities Drupal Camp

June 2018

Page 2: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Amber Himes Matz Production Manager and Trainer

twitter.com/amberhimesmatz

Page 3: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

In this session

Terms and assumptions

Standard update procedure

Tips for using Drush and Composer

Related issues and resources

Page 4: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Terminology

Page 5: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Update

Update

To update Drupal core’s minor or patch version, e.g. 8.4.0 to 8.5.4 or 8.5.2 to 8.5.4

Page 6: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Upgrade

Upgrade (see also “Migrate”)

To upgrade Drupal core from one major version to a higher one, e.g. 7.59 to 8.5.4 or 6.38 to 8.5.4

Page 7: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Today we’re

talking about

updating

(not upgrading)

Page 8: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Semantic versioning

Drupal 8 uses semantic versioning

Alias “semver”

Composer uses it, too!

Page 9: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Semantic Versioning

x.y.z

x = Major version

y = Minor version

z = Patch version

Page 10: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Semantic Versioning

x.y.z

x = Major: Breaking change. Not backwards compatible.

y = Minor: New feature(s), no breaking changes

z = Patch: bug fix, security patch, no breaking change

Page 11: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Semantic Versioning

x.y.z

x = Major: Breaking change. Not backwards compatible.

y = Minor: New feature(s), no breaking changes

z = Patch: bug fix, security patch, no breaking change

Page 12: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Release schedule

Drupal releases a minor update every 6 months

Patch releases occur as needed and may contain bug or security fixes

Page 13: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Evaluate the

release

Page 14: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

release notes

Minor release? x.y.z

What new features does it have?

Patch release? x.y.z

Security release? Critical? Time-sensitive?

Bug fix?

Page 15: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Assumptions &

prerequisites

Page 16: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Assumptions

Drupal 8

Page 17: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Prereqs

You have:

Administer software updates permission, admin access, and file access

Page 18: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Assumptions

You know:

Command line basics and/or the ability to look up commands

(But these are mostly shortcuts.)

Page 19: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Assumptions

You know how to use:

Version control with Git

And you have a process for getting files to the ‘live’ site

Page 20: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Assumptions

Composer commands:

Replace command composer with PATH/TO/composer

See getcomposer.org/download

Page 21: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Assumptions

Your process may be different if:

Your hosting provider has proprietary tools for updating Drupal core

But it still helps to understand various processes and their pros and cons

Page 22: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

The problem

You may have used Composer to install a new module with a dependency but you didn’t install Drupal with Composer and you’re wondering why this is so hard.

Page 23: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

there are 3 parts

to a drupal site

Page 24: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

3 parts of drupal

Code

Database

Files

Page 25: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Code

core and vendor directories

Scaffolding files (individual files one level above core directory or in sites)

Example files

Page 26: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Core

Core Dependencies (Composer)

Possibly customized

Possibly customizedCustom! Do not overwrite.

Custom! Do not overwrite.

Custom! Do not overwrite.

Drupal Code

@am

berh

imes

mat

z

Page 27: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Database

The database used to store a Drupal site’s content, configuration, state, and logging information.

Page 28: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Files

public and private files directories

Uploaded files, config, image derivatives, various caches, translations, etc.

Not under version control, but needs to be backed-up

Page 29: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Project files

Your project may have other special files and directories

Build scripts, backups, etc.

Page 30: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Backup

Page 31: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

3 areas to Backup

Code

Database

Files

Page 32: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Backup code

Code

Should be version controlled. If it’s not, do it!

Check the site’s .gitignore to see what’s not backed up by version control

Backup custom .htaccess, robots.txt, etc.

Page 33: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

drush sql-dump

Database backup with Drush

drush sql-dump > ../backups/

YYYY-MM-DD-filename.sql

Page 34: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

drush sql-dump

Database backup with Drush

See options for sql-dump at drushcommands.com

Page 35: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

drush sql-dump

Configure sql-dump with drush.yml

See https://github.com/drush-ops/drush/blob/master/examples/example.drush.yml

Page 36: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

mysqldump

Database backup with mysqldump

mysqldump -u [username] -p

[dbname] | gzip -9 > ../

backups/YYYY-MM-DD-

filename.sql.gz

Page 37: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

phpmyadmin

Database

PHPMyAdmin

Select database > Export

Page 38: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

tools from host

See hosting provider’s dashboard for database backup buttons or tools

See also https://www.lullabot.com/articles/importexport-large-mysql-databases

Page 39: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Backup files

Files (public and private files)

sites directory <== do not overwrite!

settings.php!

sites/*/files

Page 40: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Backup files

Files

Drupal-friendly hosts will have dashboard tools for backing up “Files”

Page 41: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

tar w/ gzip

tar

With gzip compression

tar -czvf ../backups/YYYY-MM-DD-files.tar.gz sites/

Page 42: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

tar w/ bzip2

tar

With bzip2 compression

tar -cjvf ../backups/YYYY-MM-DD-sitename.tar.bz2 sites/

Page 43: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

backup and migrate

Recommended module:

Backup and Migrate

https://www.drupal.org/project/backup_migrate

Page 44: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Standard update

procedure

Page 45: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard Update

Step 1. Log in as user with ‘Administer software updates’ permission.

Page 46: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard update

Step 2: Put your site in maintenance mode.

Administration > Configuration > Development > Maintenance mode

admin/config/development/maintenance

Page 47: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

standard update

Enable this checkbox!

Page 48: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Do yourself a

favor and keep the

maintenance mode

page open in a tab

Page 49: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Step 3.

Determine if your

site was installed

with composer

Page 50: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Managed w/ Composer?

Run composer info drupal/core

Success? Your project is managed with Composer. Failure? It’s not.

Page 51: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Managed w/ Composer?

Look at composer.json in root directory.

Is drupal/core listed under ‘require’?

YES. Managed w/ Composer

NO. Not. (Even if listed under ‘replace’.)

Page 52: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

If project is not

managed with

composer

Page 53: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Not composer-managed

Step 4: Remove old code

Should be done on local development or staging site and deployed to live site as usual.

Page 54: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Not composer-managed

Step 4: Remove old code

Remove core and vendor directories

rm -rf core vendor

rm -f *.* .*

Page 55: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

not composer-managed

Step 5a: Download the update from drupal.org/project/drupal

wget https://www.drupal.org/files/

projects/drupal-x.y.z.tar.gz

Page 56: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

not composer-managed

Step 5b. Extract the archive file.

tar -zxvf drupal-x.y.z.tar.gz

Page 57: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Warning! Do not overwrite

your modules,

themes, profiles, or

sites directories.

Page 58: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

not composer-managed

Step 6. Apply new code.

Copy all files and directories except modules, themes, profiles, and sites from the update to your site.

Page 59: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Core

Core Dependencies (Composer)

Possibly customized

Possibly customizedCustom! Do not overwrite.

Custom! Do not overwrite.

Custom! Do not overwrite.

Drupal Code

@am

berh

imes

mat

z

Page 60: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

If site is managed

with composer

Page 61: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Managed w/ Composer

Run composer update drupal/core --with-dependencies

replaces steps 4-6!

Page 62: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard update

Step 7. Check release notes for changes to default.settings.php

Page 63: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard update

If default.settings.php was changed:

1. Locate default.settings.php

2. Duplicate your settings.php with new name

3. Copy new default.settings.php to settings.php

4. Re-apply customizations from previous one

Page 64: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard update

Step 8. Reapply customizations to .htacess and robots.txt

(Because you backed up your original ones already, right?)

Page 65: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard update

Step 9. Upload new code (including vendor directory) to “live” environment using your regular deployment method.

Page 66: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard update

Step 10a: Open ‘live’ settings.php in text editor.

By default, access to update.php is blocked. In settings.php, find

update_free_access and set to TRUE

Page 67: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard update

Step 10b: Run database update(s)

Access example.com/update.php in a browser

Follow instructions

Page 68: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard Update

Page 69: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard Update

Page 70: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard update

Step 10c: Edit ‘live’ settings.php again.

Lock down update.php. Find

update_free_access and set to

FALSE

Page 71: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard update

Step 11. Verify site is working as expected.

Go to admin/reports/status

Page 72: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Standard Update

Step 12: Turn off maintenance mode

Go to admin/config/development/maintenance

Disable checkbox

Page 73: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Ta-Da!

YOu’ve updated

your drupal site!

No tears! Take a walk!

Ice cream time!

Page 74: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Tips for using

drush to update

Page 75: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Drush

NOTE:

For updating sites <= 8.4 use Drush 8

Drush 9 (> D8.4) assumes Composer-based methods to update core and contrib

Page 76: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Drush 8 (only)

Backup codebase, database, and files

drush archive-dump

https://drushcommands.com/drush-8x/core/archive-dump/

Page 77: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Drush

To put your site in maintenance mode:

drush sset system.maintenance_mode 1

drush cache-rebuild

Page 78: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Why?

Drupal core AND its

dependencies (vendor)

both need updating

Page 79: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Warning! Do not use

drush up

or drush pm-update!

No!Bad!

Don’t do it!

Page 80: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Drush

To update the database

drush updatedb

Page 81: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Drush

To take site off maintenance mode

drush sset system.maintenance_mode 0

drush cache-rebuild

Page 82: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Tips: updating a

site Installed w/

Drupal composer

template

Page 83: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Didn’t I just say this?

NOTE:

Do not attempt to use drush

pm-update to update a site that was created with Composer.

Page 84: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer template

Drupal Composer Template

https://github.com/drupal-composer/drupal-project

Page 85: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer template

Step 0: Put your site in maintenance mode.

cd web

drush sset system.maintenance_mode 1

drush cache-rebuild

cd ../

Page 86: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer template

Step 0: Check your composer.json for version constraints and update if needed.

“require”: { ...

“drupal/core”: “^8.5.3”,

...}

Page 87: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer Template

Step 1: Update core and its dependencies

composer update drupal/core

webflo/drupal-core-require-dev

symfony/* --with-dependencies

Page 88: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer template

Step 2: Determine if any scaffolding files have changed

git diff

Page 89: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer template

Step 3: Restore any customizations to .htaccess or robots.txt

Page 90: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer template

Consult the README of the project to verify instructions or troubleshoot.

But, understand that Composer docs might be a better place for some questions.

Page 91: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer Template

Gotcha!

Version constraints in composer.json only allow updates within a minor version. i.e. 8.3.7 -> 8.3.9 (not to 8.5.3).

Page 92: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer Template

Gotcha!

Incompatible dependencies in your composer.json

Page 93: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer Template

Important! Do not deploy development dependencies to your live site.

Run composer install --no-dev and commit changes to version control before deploying to production.

Page 94: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer template

Step 5. Update the database

drush updatedb

Page 95: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer template

big bullet

Huge bullet

super-important bullet

Step 6. Take site off maintenance mode

drush sset system.maintenance_mode 0

drush cache-rebuild

Page 96: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Related

drupal.org

Issues

Page 97: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer support

Proposal: Composer Support in Core Initiative

https://www.drupal.org/project/ideas/issues/2958021

Page 98: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Issues

Improve instructions to core/UPDATE.txt

https://www.drupal.org/project/drupal/issues/2867757

Page 99: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

using composer to

manage your

drupal site

Page 100: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

composerize Drupal

Comperize Drupal Composer plugin

Convert a non-Composer-managed Drupal project to a Composer-managed one!

https://github.com/grasmash/composerize-drupal

Page 102: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composerize module

Composerize Module

“Not ready for prime time.”

https://www.drupal.org/project/composerize

Page 103: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

DIY Composerize

Free tutorial on Drupalize.Me

Use Composer with Your Drupal Project by Matthew Grasmick

https://drupalize.me/tutorial/use-composer-your-drupal-project

Page 104: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Keeping Track of

Updates

Page 105: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

keeping track of updates

On your site:

Reports > Available updates > Settings

Enter email addresses to be notified daily or weekly

Page 106: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

keeping track of updates

Subscribe to security announcements mailing list

Log in to drupal.org

On your account page: Edit > My newsletters tab

Page 107: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

keeping track of updates

On Twitter:

Follow @drupalsecurity

Page 108: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

keeping track of updates

Subscribe to RSS Feeds:

core security updateshttps://www.drupal.org/security/rss.xml

contributed project updates https://www.drupal.org/security/contrib/rss.xml

public service announcementshttps://www.drupal.org/security/psa/rss.xml

Page 109: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

keeping track of updates

On Drupal Slack:

https://www.drupal.org/slack

Join #announcements channel

Page 110: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

More resources

Page 111: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Security and maintenance

Drupal 8 User Guide

Chapter 13: Security and Maintenance

https://drupalize.me/series/user-guide/security-chapter

Page 112: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Tutorial

Update Drupal’s Minor Version

https://drupalize.me/tutorial/update-drupals-minor-version

Page 113: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer

Introduction to Composer for Drupal Users

Drupalize.Me tutorial series

https://drupalize.me/series/introduction-composer-drupal-users

Page 114: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

@amberhimesmatz

Composer

Official Composer Site

https://getcomposer.org

Page 115: Updating Drupal’s Minor or Patch Version - June 7-10, 2018Updating Drupal’s Minor or Patch Version Keeping Drupal up-to-date ... Semantic versioning Drupal 8 uses semantic versioning

Happy updating!