Updating Drupal 8 to 8.4.x

Seth Berrier's picture

I have been playing with the TKL Drupal 8 appliance.  As of version 14.2, it comes with Drupal 8.3.x (don't remember the patch version) but there's already been a minor version tick to 8.4 (latest as of writing is 8.4.4) with important security updates.  Unfortunately, the update to 8.4 is a bit of a mess for drupal (there are complicated dependency problems involving certin PHP modules that are used by composer or drush, it's a mess).  You can find lots about this drama around the web but there appear to be a few well known workaround.

I've tried a couple of workarounds but so far none have worked:

  • Update drush to version 8.1.15 then use that to update drupal/core (the update of drush suceeds but it fails to update drupal core)
  • Update using composer (composer continually runs out of memory as it tries to download and install the latest drupal/core)

I've tried a few other random things and nothing seems to be working.  Has anyone does this successfully with the Drupal8 appliance?  Any pointers?  I'm a total newb with Drupal and with PHP for anything other than web pages, but I can't imagine this should be this hard so hopeing someone has an obvious suggestion here I'm just missing.

Cheers!

Seth B.

Seth Berrier's picture

I found a way to update using drush! I think the key idea I was missing was exactly how and where drush was installed on this appliance.  I deduced two things:

  1. drush lives in /usr/local/src/drush on this appliance
  2. It appears to just be cloned from the drush git repository and set to track the 8.x branch

With this bit of info, I was able to update drush first CORRECTLY, and then use the latest drush to upgrade basically in the manner suggested in the official drupal 8 upgrade docs.

I wrote a bash script to do this with a couple of tweeks to hopefully make the process smooth. A few things to note about this script:

  • It will update your drush by pulling from github and checking out the 8.1.15 branch
  • It does a two stage core update, first to 8.4.0 then to the latest 8.4.x (currently 8.4.4)
    • This was suggested as a safer path in a few places on the web if you aren't coming from 8.3.7
    • In the 14.2 version of this appliance, it is running 8.3.1
  • It updates the composer vendors (I don't think this is necessary but I figured it was a good idea)
    • To disable this, just remove the 'composer update --with-dependencies' line
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root"
   exit 1
fi

read -p "First we will update drush [enter to continue]"
cd /usr/local/src/drush
git pull
git checkout 8.1.15

read -p "Ready to archive and enter maintenance mode [enter to continue]"
cd /var/www/drupal8
drush archive-dump
drush ups
drush sset system.maintenance_mode 1
drush cr

read -p "Ready to download and apply core 8.4.0 update [enter to continue]"
drush up drupal-8.4.0
drush updb
drush entup

echo "********************************************************"
echo "* The setDispatcher() error can be ignored             *"
echo "* [see https://github.com/drush-ops/drush/issues/2933] *"
echo "********************************************************"

read -p "Ready to proceed to install latest 8.4.x core [enter to continue]"
drush up drupal
composer update --with-dependencies
drush updb
drush entup

read -p "Ready to finish, check your site for any problems first [enter to continue]"
drush sset system.maintenance_mode 0
drush cr
Jeremy Davis's picture

Sorry I didn't get back to you sooner, this week has just been crazy!

Whilst I couldn't have answered your question as comprehensively as you have yourself, I possibly could have pointed you in the right direction and saved you some time. So sorry about that, but thanks tons for posting back with your insight!

As you've discovered, we install drush from source. FWIW, our build code is on GitHub (Drupal8 appliance is here). Please note that we are currently in the process of updating appliances for v15.0 so the current build code doesn't reflect the currently available appliance. To get the buildcode that relates to your appliance, you'd need to look at the relevant tag (e.g. v14.2).

If you are interested in all the gory details, then I suggest that you download TKLDev docs. But as a super brief overview:

  • the common components are included via the Makefile
  • the Debian packages installed specifically for the Drupal8 appliance are in the plan
  • files that are overlayed on the installed system (relative to `/`) are within the overlay
  • the install scripts which are run at build time can be found in the conf.d directory, in the case of Drupal8, there is just one, called main

    Whilst the update for v15.0 has been done (see the master branch), we are still a fair way away from release I reckon (we still have some fundamental OS issues we need to resolve). In the meantime, if you have any feedback on what we could do to improve the v15.0 D8 appliance, I'd love to hear.

    I'd be particularly interested in your opinion on the modules which we include by default. As Drupal8 is a bit more "all in one" type set up, additional modules aren't as important as they have been in previous Drupal versions (in my limited opinion anyway).

    For our last release of WordPress, we actually stripped out all the additional modules, and provide it fairly vanilla now. That was following significant feedback that whilst in some scenarios some of the additional modules were useful, they almost never all applied to every project. So whilst TurnKey was a reasonable place to start, many users complained that our appliance was harder to get started with because many of the additional modules needed to be uninstalled! Whilst we haven't had that sort of feedback regarding Druapl8, I wonder if it might not still be a bit of an issue? What do you think?

  • Jeremy Davis's picture

    Also, perhaps we should consider including your update script? Or at least something similar? That could be a pretty cool addition!

    At the very least we should probably at least document the update process better!

    Post new comment