CI/CD & Upgrading from 8.9.20 to 11.1.6

I'm enjoying a bit of time off after a 27 month mandate at Manitoba Liquor & Lotteries. I decided that I would spend time to resolve all the technical issues and blockers that stand in the way of me writing about the stuff I'm interested in.

Personally, Pantheon.io is a thing of the past, my clients that were using it in the golden age of Drupal 7 have moved on to WordPress or other platforms. Ditto with Lando which had replaced MAMP. Time never stays still. Heraclitus, the ancient Greek philosopher, once famously proclaimed:

There is nothing permanent except change.

OK, but before I can start writing fun stuff, I need a website that is functional and whose software is distraction free, i.e., easy to update and upgrade!

This is a humble attempt to document the processes that helped me get over those blockers and cancel my technical debt.

My Stack

  1. Ddev - Drupal's local web development platform of choice, going with the flow here has its advantages, there's no good reasons not to.
  2. GitLab - Until recently, I had never felt the urge or need to use CI/CD in my personal projects. This time has come.
  3. cPanel - For hosting small websites, this stack is "the" Swiss Army Knife, it is both competent and affordable. Let's make it work.

DDEV - To get a good start, the only trick is to first replicate the production environment (exact same versions of modules and themes) in order to be able to import a database from Prod. For my use case, this is what worked:

  • ddev config --project-type=drupal8 --docroot=web --php-version=7.4
  • ddev composer create "drupal/recommended-project:8.9.20" --no-install
  • ddev composer require drush/drush
  • ddev composer install
  • ddev start

Then, leapfrogging through the 252 core releases that mark out Drupal's evolution from 8.9.20 to 11.1.6 is not exactly a lame undertaking; patience is a required virtue for going through Composer dependency hell a few times. BTW, know that manually upgrading might be easier than a full-fledged migration, but it is also riskier. I got bit. More on this later.

GITLAB - That's the easy part of the workflow, no need to go into details. But if you need a quick refresher this YouTube tutorial, will do just fine.

CPANEL - That was my biggest black box, devops is not really my thing. Anyway, I found some helpful and also some slightly misleading information; sifting through it all is not exactly trivial. In those moments of doubt, when I'm outside my comfort zone and I can't quite see the light at the end of the tunnel, I'm reminded of Zork.

This video by Utshuk and the cPanel Docs helped me figure out how to create the repo on the cPanel and connect it to my private GitLab repo. My initial deploy script only partially worked. But I got some help from Claude.ai. Trial and error is also a good friend.

Between the two of them I was able to fine-tune the CI/CD workflow that now makes it easy to deploy my local changes inside a sub-directory of a cPanel's public_html where one or more websites can run.

All is well that ends well.

This website happily purrs on the latest Drupal release. And now that my technical debt is paid in full, I can freely ponder about what I might want to write next…