Skip to main content

Migrated: Now on Drupal 8!

Published on

My personal site is now officially migrated onto Drupal 8! I had first attempted a migration of my site back when Drupal 8.0 was released but had a few issues. With Drupal 8.3 it was nearly flawless (maybe even 8.2, but I had put the idea back burner.) I did have some interesting issues to workaround

Missing filter plugins

My migration process was halted and littered with errors due to missing plugins, specifically around my text formats. The culprits were:

  • Media 2.x and media filter
  • GitHub Gist filter
  • OEmbed filter
  • Twitter links and usernames

These plugins were missing from my code base so I had to replicate them. The Twitter module has been ported, but I didn't have a need for it anymore, so I wrote skeleton Filter plugins that had no functionality. However, I relied heavily on the others.

For the Media filter, I had tried to follow the solutions in Kalamuna's blog post. However, it did not quite work (not a custom migration.) So I opted for a custom Filter plugin which provides the same functionality as the Drupal 7 filter: convert a shortcode to an image embed.

The Gist Filter module has yet to be ported, so I quickly wrote my own version.
 

The same was true for the OEmbed module. It has a port to Drupal 8 started but was not stable. Luckily I was able to use the alb/oembed library and the OEmbed module's Filter plugin. All I needed to do was change library references. I made sure to document this https://www.drupal.org/node/2884829#comment-12203367.

A full example of my workarounds can be found in https://github.com/mglaman/glamanate.com/tree/master/web/modules/custom/

Executing the migration

Other than that, it was as simple as running the following command provided by Migrate Tools:

drush migrate-upgrade \ 
  --legacy-db-url=mysql://root:root,@mysql.dev/glamanate_d7 \
  --legacy-root=http://glamanate.com

I also found it useful to provide a custom installation profile during the trial and error process. I patched Drupal 8 to allow a profile to be installed from existing config. When you run a migration all configuration will be migrated. This allowed me to run my migrations, tweak config, export, and then re-import when the process was done.

Summary and what is next

Overall it was fairly smooth. I spent more time porting over the Media embed filter. I didn't bother to fix the actual post content but port the functionality verbatim. I'd say I spent roughly a day overall on this migration. More time was spent rewiring a new theme, which is not finished.

My main motivation was to have an improved authoring experience, thanks to Drupal 8 and CKEditor. I'd like to expand my publishing efforts to provide more tutorials and deep dives into topics.

I'm available for one-on-one consulting calls – click here to book a meeting with me 🗓️