geerlingguy / jeffgeerling-com

Drupal Codebase for JeffGeerling.com
https://www.jeffgeerling.com
GNU General Public License v2.0
41 stars 2 forks source link

Upgrade to Drupal 10 #151

Closed geerlingguy closed 11 months ago

geerlingguy commented 1 year ago

Drupal 10 will be released soon (Dec 14). Upgrade would be good. Have to also upgrade the server to PHP 8.1 or later (right now it's still on a 7.4 lts release from the distro).

darkcactus1957 commented 1 year ago

looking forward to this, thank you for the update!

geerlingguy commented 11 months ago

I'm running PHP 8.1 now, and MySQL 5.7.x, and the server is ready for the upgrade...

This document has an outline of all the things I need to do: https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-from-drupal-9-to-drupal-10/overview

bmartinez287 commented 11 months ago

Are you planning to do the upgrade on a live stream like last time? That was pretty cool.

geerlingguy commented 11 months ago

Some things I've already noted:

  1. Install the Upgrade Status module locally to check on status of everything: composer require --dev drupal/upgrade_status (then enable in the UI and visit /admin/reports/upgrade-status).
  2. Classy and Stable are no longer in core, run composer require drupal/stable to install the Stable contrib module. See how to do Classy stuff with https://www.drupal.org/project/classy ? Or maybe look up the change records.
geerlingguy commented 11 months ago

@bmartinez287 - Probably not, the tough thing is I don't have as much time to work on it, so it'll probably be hacking away at things late night some night once Drupal 9.x is completely unsupported.

It kinda makes me sad I didn't just keep the site on Drupal 7 lol. Drupal upgrades are the death of a small site like this!

geerlingguy commented 11 months ago

Things to clean up before pushing live:

geerlingguy commented 11 months ago

Released Simple Mail 2.0.1, compatible with Drupal 10: https://www.drupal.org/project/simple_mail/issues/3289635

geerlingguy commented 11 months ago

Chicken-and-egg problem... I need to upgrade Insert to https://www.drupal.org/project/insert/releases/3.0.0-beta2 — but if I try doing that it says it requires Drupal 10.

But I can't upgrade to Drupal 10 until Insert is upgraded. What to do?

geerlingguy commented 11 months ago

Ah... so first:

composer require drupal/core-recommended:"^10.0" --no-update

Then upgrade everything:

composer update

That throws some error messages though, all stemming seemingly from Insert. So upgrade Insert now without update:

composer require 'drupal/insert:^3.0@beta' --no-update

Then again:

composer update

Now seeing Root composer.json requires drush/drush ^10 -> satisfiable by drush/drush[10.0.0-alpha1, ..., 10.x-dev]., so next:

composer require 'drush/drush:^12' --no-update'

Then again...

composer update

And finally it's doing all the things!

This page was very helpful: Upgrading to Drupal 10 (And Beyond) With Composer

geerlingguy commented 11 months ago

Hmm... Drush doesn't work anymore:

root@c93dd0c9b598:/var/www/html# drush
The Drush launcher could not find a local Drush in your Drupal site.
Please add Drush with Composer to your project.
Run 'cd "/var/www/html" && composer require drush/drush'

I updated to the latest Drush 12 and Drush Launcher, but that didn't help. It seems like Drush 12 broke compatibility and Drush Launcher was recently archived.

See: https://github.com/drush-ops/drush-launcher/ (it's archived), and https://www.drush.org/12.x/install/ for a few options if you want to still just type drush and not vendor/bin/drush.

For my own purposes I'll just type the explicit path. Annoying but automatable.

geerlingguy commented 11 months ago

Pushing the code up now. What are the chances it 'just works'?

geerlingguy commented 11 months ago
TASK [Ensure Drupal 8 codebase is present and updated.] ****************************************************************
changed: [sshjg.jeffgeerling.com]

TASK [Make sure 'default' directory is writeable.] *********************************************************************
ok: [sshjg.jeffgeerling.com]

TASK [Make sure all Drupal 8 composer dependencies are installed.] *****************************************************
changed: [sshjg.jeffgeerling.com]

TASK [Run post-deployment tasks after codebase is updated.] ************************************************************
changed: [sshjg.jeffgeerling.com] => (item=drush cache:clear drush)
changed: [sshjg.jeffgeerling.com] => (item=drush cache:rebuild)
changed: [sshjg.jeffgeerling.com] => (item=drush config:import -y)
changed: [sshjg.jeffgeerling.com] => (item=drush updatedb -y)

And moment of truth...

Screenshot 2023-11-02 at 10 40 01 PM
geerlingguy commented 11 months ago

Well that's odd...

Warning: include_once(/home/geerlingguy/domains/drupal8/web/core/themes/classy/classy.theme): Failed to open stream: No such file or directory in include_once() (line 153 of /home/geerlingguy/domains/drupal8/web/core/lib/Drupal/Core/Extension/Extension.php)

Why is classy not there?

Ah.

geerlingguy@www:~/domains/drupal8/web/themes/contrib$ ls
classy  gin  stable

It's not parsing out the contrib maybe?

geerlingguy commented 11 months ago

It seems like the site is just not generating any CSS or JS files right now. Drupal's rendering things okay at least.

File permissions? They are looking okay...

geerlingguy commented 11 months ago

It even has:

File system
Writable (public download method)

Not seeing anything that would be messing up css/js generation :/

geerlingguy commented 11 months ago

I mean... it all works locally. Maybe something in composer is getting cached? Might wipe out vendor dir and reinstall composer deps.

geerlingguy commented 11 months ago

Ran:

rm -rf vendor
composer install

Zero difference.

geerlingguy commented 11 months ago

Okay... so temporary fix, went to /admin/config/development/performance and disabled CSS/JS aggregation.

geerlingguy commented 11 months ago

One possibility (however small)—I override the .htaccess file Drupal provides. Maybe there's some important change in there for Drupal 10?

Noticed after seeing https://stackoverflow.com/a/20946969/100134

geerlingguy commented 11 months ago

I'll try rebooting it, that's a good trick!

spinning-anakin-3337132316

geerlingguy commented 11 months ago

Nope. Drupal just refuses to generate CSS/JS, and shows no errors while doing so.

Going to check into my tmp dir and see if there's anything funky there.

geerlingguy commented 11 months ago

Otherwise the upgrade is looking okay. Opened https://github.com/geerlingguy/jeffgeerling-com/issues/157 to track more bugs.

Greg-Boggs commented 11 months ago

Hrm. looks good from production while logged out. Ahh I see you turned CSS agg off. Core rewrote CSS agg to try and replace advanced agg. It's been non functional in 10.1 for me. I just leave CSS agg off.

geerlingguy commented 11 months ago

@Greg-Boggs - Yeah, got it to look okay by disabling CSS/JS aggregation, and I'm going to track that bug and the one other major bug (Insert not working) in #157. Thanks for checking!