Note: this is a refresh of an old article I wrote in my previous life as a Technical Solutions Manager in Acquia. The old approach uses Drush, while the 2024 version is much faster to set up and easy to use through the Drupal UI. Read the old article in Acquia.com (Thanks Jenn Shramek, Sylvie Tse and Randy Fay to help me find this lost content)
Are you ready to bid adieu to Drupal 7 and embrace the possibilities of Drupal 10+? The transition may seem daunting, but fear not, because I'm here to guide you through the process of migrating from the aging Drupal 7 to the modern Drupal 10+.
While there are countless technical articles detailing the intricacies of migrating, I'm here to shed light on a crucial aspect often overlooked - building the infrastructure to seamlessly transition from Drupal 7 to Drupal 10+.
I´m assuming you already have a Drupal 7 site (what are you doing here if not?). The first step in this journey then is to create a new Drupal 10+ site that will serve as the destination for your migration.
Let´s create your new Drupal 10+ site
First, let’s create the Drupal 10+ site, where all the content, content types, and configurations from Drupal 7 will eventually reside. Follow these steps:
- Create a new directory for your Drupal 10+ site, for instance, alexmoreno-drupal10.
- Navigate to this directory.
- Use DDEV to configure the project, specifying the project type as Drupal 10+ and the document root as web.
- ddev config --project-type=drupal10 --docroot=web --create-docroot
Next, we’ll install Drupal 10+ using Composer. If you have questions or you get stuck here I would recommend you to visit the excellent quickstart guide at https://ddev.readthedocs.io/en/latest/users/quickstart/#drupal.
Install the modules you need to execute the migration
Now, visit http://drupal10.ddev.site/admin/modules to install the necessary modules:
- Migrate Drupal UI,
- Migrate Drupal,
- and Migrate.
Connect the machines (Drupal 7 and Drupal 10+ containers)
To connect to the Drupal 7 database from within the Drupal 10 container, you are going to need the urls of the Drupal 7 container, and in particular, the database url. While ddev status will give you those URLs and passwords, what is not telling is the url to connect from an external service, in this case, another Docker container.
The good Randy Fay pointed me in the right direction. The trick is described here: https://ddev.readthedocs.io/en/latest/users/usage/faq/#can-different-projects-communicate-with-each-other So, in order to connect from outside of the container you just need to use this as the url: ddev-projectname-db
For example, in my case my project is called alexmorenotdotnet. Then the database url will be: ddev-alexmorenotdotnet-db
Migrate
That's it, let's do it. Now simply quick off the migration and, evoilá, in a few minutes you should have a shiny brand new Drupal 10+ site.
While this migration process may seem straightforward, as the Drupal 7 site that I used was pretty simple, it lays the groundwork for more complex migrations. For those seeking advanced options, tools like Acquia Migrate Accelerate, now open-source, offer additional capabilities.
Wrapping up
Ready to take the leap? The decision has been made. You're moving on from your trusted Drupal 7 site to embrace Drupal 10+ with enthusiasm. But how do you manage two sites in parallel to test your migrations? Enter DDEV.
DDEV simplifies the process by allowing you to:
- Start one instance: Spin up your Drupal 7 and Drupal 10+ instances concurrently.
- Run the migration: Execute and test your migrations on the Drupal 10+ instance while keeping the Drupal 7 site running for reference and comparison.
With DDEV, transitioning from Drupal 7 to Drupal 10+ becomes not just manageable but efficient.
In conclusion, as you bid farewell to Drupal 7 and embark on the journey to Drupal 10+, remember that the process is not just about migrating data but also about setting up the infrastructure that supports seamless migration and testing.
This technique allows you to communicate between two containers, Drupal 7 and Drupal 10+. However this can be applied to a lot of other scenarios, like for example building a decoupled site where you need to connect two boxes with your frontend and your backend.
Are you ready to make the move? Share your thoughts in the comments below or contact me through Linkedin, Twitter or Mastodon.
Related links
Acquia Migrate Accelerate
https://www.acquia.com/products/drupal-cloud/acquia-migrate-accelerate
Acquia Migrate Accelerate tutorial
https://ddev.com/blog/drupal7-drupal9-migration-ddev-acquia-migrate-accelerate/
Retrofit
https://mglaman.dev/blog/protect-your-investment-drupal-7-retrofit-drupal