Upgrading the Dransible project to Drupal 9
Warning: This post is over a year old. I don't always update old posts with new information, so some of this information may be out of date.
This week I gave a new talk on upgrading to Drupal 9 for the Drupal NYC meetup. Whilst preparing for that, I decided to upgrade my Dransible example project that I use for my Ansible and Ansistrano talk to Drupal 9 and document the process.
Whilst the steps taken are in the slides for that talk, here is the full list of steps that I took including the Composer commands.
Updating from Drupal 8.8 to 8.9
To begin with, let's update to the latest version of Drupal 8 so that we can do some testing and see all of the latest deprecation notices before moving to Drupal 9.
- Remove Drush temporarily using
composer remove drush/drushas it will cause us being stuck on Drupal 8.9.0-beta2 rather than a newer, stable 8.9 version.
^8.9in composer.json for
drupal/core-composer-scaffold, and run
composer update drupal/core-* --with-dependenciesto update core to 8.9.5.
- Re-add Drush so that it's present for the deployment by running
composer require drush/drush:^9.
Preparing for Drupal 9
- Add the Upgrade Status module by running
composer require drupal/upgrade_status.
- Upgrade to Drush 10 by running
composer require drush/drush:^10.
- Remove the Config Installer module by running
composer remove drupal/config_installer. This is no longer needed since Drupal 8.6, and there will be no Drupal 9 version.
- Update the Admin Toolbar module to 2.3, a Drupal 9 compatible version, by running
composer update drupal/admin_toolbar.
As I'd previously updated the Simple Message custom module to be Drupal 9 compatible (adding the
core_version_requirement key to the info.yml file, and removing usages of deprecated code), no changes needed to be made to that.
Upgrading to Drupal 9
^9.0for the core packages in composer.json, and run
composer update drupal/core-* --with-dependenciesto update to 9.0.5.
- Re-add Drush by running
composer require drush/drush. This will install Drush 10 by default.
Although everything seemed to have updated OK locally, there were some errors when running a deployment to the Vagrant virtual machine that needed to be addressed, as well as some post-upgrade housekeeping steps to perform.
- Fix the deployment error by adding the Symfony Configuration component as a dependency by running
composer require symfony/config:^4.
simple_message.services.ymlto fix the autowiring error.
settings["config_sync_directory"]to settings file variables (this will be added automatically in the next version of the Drupal settings Ansible role).
- Remove the Upgrade Status module by running
composer remove drupal/upgrade_status, as it's no longer needed.
And that's it! The Dransible demo project is upgraded, and if you see my Ansible deployments talk in the future, the demo site will be running on Drupal 9.
If you want to see the original pull request, it's at https://github.com/opdavies/dransible/pull/7.