- Home
- Drupal 9 Ended His Life: How To Migrate To Drupal 10
Drupal 9 ended his life: How to migrate to Drupal 10
17 July, 2024
Is your company website built in Drupal? Or do you manage Drupal websites? If so, it's crucial to understand the implications of Drupal 9's of life and how to smoothly migrate to Drupal 10.
As the countdown to Drupal 9's end of life is finished, many website owners are left wondering what this means for their online presence.
In this article, we will detail the implications of Drupal 9's end of life and provide you with a comprehensive guide on how to migrate seamlessly to Drupal 10.
Drupal 9's end of life, scheduled for November 2023, means that it will no longer receive any community support or security updates.
This can leave your website vulnerable to potential security breaches and compatibility issues.
By migrating to Drupal 10, you can ensure that your website remains secure, up-to-date, and fully optimized, receiving security updates and patches.
In this guide, we will walk you through the steps involved in migrating to Drupal 10:
- Assessing your current website
- Preparing for the migration
- Executing the migration process
Implications of Drupal 9 End of Life
The end of life for Drupal 9 also signifies a shift in focus for the Drupal community towards the latest version, Drupal 10.
The drawbacks of staying in Drupal 9 are:
- Lack of compatibility with new modules and features, as developers and contributors will prioritize Drupal 10;
- Risk of being hacked, with data breaches becoming more likely: Without regular security updates and patches, Drupal 9 sites become vulnerable to new security threats. As a result, the risk of being hacked and experiencing data breaches increases significantly, putting sensitive user information and business data at risk.
- Increased technical debt: Using an unsupported version adds to technical debt, as maintaining outdated code and systems becomes more complex and costly over time. This can hinder the ability to implement new features and integrations efficiently.
Benefits of Migrating to Drupal 10
The benefits after the upgrade will be:
- Better performance optimization and scalability for your website as Drupal 10 is built on a modern codebase,
- More protection against vulnerabilities and potential cyber threats.
Better user experience and content management for website editors and owners.
Planning Your Drupal 10 Migration
The first step is to assess your current Drupal 9 setup to identify any custom configurations, modules, or themes that may impact the migration.
Understanding your website's current state will help you develop a clear roadmap for transitioning to Drupal 10 smoothly.
Once you have assessed all your custom configurations and themes, it is time to prepare for the migration by preparing all backups of your website data, to minimize the risks.
Backup your files and database
Backing up your data is an easy task, you can enter using ssh to your server and execute:
tar -czvf site_backup.tar.gz /path/to/drupal/site.
or automatize the process using some platform like Plesk or CPanel.
If you are using MySQL or MariaDB databases, you can perform
mysqldump -u username -p database_name > database_backup.sql
If you are using PostgreSQL
pg_dump -U postgres -W -F c -b -v -f drupal.backup database_name
Check your system requirements
- Ensure PHP version is 8.1 or higher.
- Ensure the database server is MySQL 5.7.8+ or MariaDB 10.3.7+.
- Verify the server meets other Drupal 10 requirements (Apache, Nginx, etc.).
In the case your hosting doesn’t comply with all the prerequisites, you can create a new hosting environment to prevent damage to the older website in which you will copy the current website.
Prepare the upgrade with Upgrade Status
Assessing your current Drupal 9 configuration is required to process with the migration to the newer version.
It is highly recommended that all these activities must be performed in a staging, development environment outside the production, to minimize damage and avoid downtimes.
To conduct a comprehensive audit of your website’s modules, themes, and custom configurations to determine their compatibility with Drupal 10 you can use the module created ad-hoc by the community: https://www.drupal.org/project/upgrade_status
The module provides the following key features:
- Check if you are using a version of Drupal that supports an upgrade.
- Check if your system meets the next major version's system requirements.
- Integrates with the Update Status core module to inform you to update your contributed projects.
- Projects can be compatible with multiple major Drupal versions, so most projects can be updated on your existing site before doing the core major update.
- Runs phpstan checks and a whole set of other checks to find any compatibility issues with the next Drupal major version that may remain (see more details below).
- Integrates with drush.
Once the module is installed and enabled, you can run an analysis and see which modules, themes or components are ready for the core upgrade of Drupal, and which ones requires additional work to adaptation of the codebase to the newer version.
To install Upgrade Status and run the report you can execute the following commands:
1. Install the module:
composer require drupal/upgrade_status
2. Enable it:
drush en upgrade_status
3. Run the report: Visit /admin/reports/upgrade-status.
Follow the guidance provided by the Upgrade Status for each module and resolve the internal issues.
Upgrade themes and modules
Some themes and modules need to be upgraded to newer versions compatible with Drupal 10.
In this case, you should only update the version in the “composer.json” file, run "composer upgrade", and re-run an analysis using the upgrade status to check if the problem is solved.
In the case there is no update available at the moment, there are two ways:
Option A: Create a Drupal Patch
Suppose you need to edit the composer module code without losing the changes done once you execute “composer install” or “composer upgrade”. In that case, the composer offers a patch system to apply on the codebase some specific changes in the system, just using some git diffs.
In every module page, there is always a section dedicated to Drupal 10 upgrades, usually, you can find there some patches already done by other developers that you can download and install in Drupal.
Applying patches in Drupal
You can add new patches in Drupal using composer, adding the patches files in your GIT codebase keeping consistency in various environments.
To apply patches using Composer you need to install composer-patches project:
composer require cweagans/composer-patches:~1.0 --update-with-dependencies
Then you can install patches creating a local folder /patches in your project and adding your files inside and adding them in the composer.json files with the relative path.
“drupal/myproject” has to be the name of the composer library in which the patch will be applied.
You can use remote urls for patches, but it is suggested only to use local paths: download, review the code, and move into the /patches folder.
{
...
"extra": {
"patches": {
"drupal/myproject": {
"Fix-upgrade-drupal-10": "patches/myproject-a.patch"
}
},
...
}
}
Option B: Create a manual patch
Step 1: Clone the Repository
First, clone your Drupal project repository if you haven't done so already.
Open your terminal and run:
git clone <repository-url>
cd <repository-directory>
Replace <repository-url> with your actual repository URL and <repository-directory> with the directory name.
Step 2: Create a New Branch
It's a good practice to create a new branch for your changes to keep your work organized and to avoid conflicts with the main branch.
git checkout -b my-feature-branch
Replace my-feature-branch with a meaningful name for your branch.
Step 3: Make Changes to the Drupal Module
Navigate to the module directory and make the necessary changes. For example, if you are editing a custom module located in modules/custom/my_module, you would go there:
cd modules/custom/my_module
Edit the files you need using your preferred text editor or IDE.
Step 4: Stage the Changes
After making your changes, you need to stage them for commit. Run the following command to stage all changes:
git add .
Step 5: Commit the Changes
Now, commit your changes with a descriptive commit message.
git commit -m "Describe the changes you made"
Step 6: Generate the Git Diff
To generate a diff file, you can use the git diff command. This command shows the differences between your working directory and the index (staging area).
git diff > my_module_changes.patch
This will create a file named my_module_changes.patch with all the changes you've made, move to patches folder and update "composer.json".
Upgrade the codebase to Drupal 10
Edit composer.json to specify Drupal 10 to the latest version 10.3 :
"require": {
"drupal/core-recommended": "^10.3",
"drupal/core-composer-scaffold": "^10.3",
...
}
Update Composer Dependencies
Run composer update to fetch and install updated dependencies.
Run database updates:
drush updatedb
Run entity-updates to ensure all entity schema updates are applied
drush entity-updates
Clear caches to ensure new code is executed:
drush cr
Check Drupal logs: /admin/reports/dblog.
Test the Site
- Manually test key site functionality.
- Use automated tests if available (e.g., Behat, PHPUnit).
- Check for broken links, forms, and user interactions.
Deploy to Production
Back up the production site (database and files).
Apply the update steps on production.
Use maintenance mode to minimize downtime
drush sset system.maintenance_mode 1 #Enable maintenance
drush sset system.maintenance_mode 0 #Disable maintenance
You should have your Drupal 10.3 website that you can check from "/admin/reports/status"
Hiring a Drupal Migration Expert
Hiring a Drupal migration expert can be a strategic decision to perform the migration process and maximize the benefits of transitioning to Drupal 10.
A Drupal migration expert brings specialized knowledge, experience, and technical skills to the table, enabling you to navigate complex migration challenges with confidence.
With their expertise, they can assess your current Drupal 9 setup, develop a customized migration strategy, and execute the migration process efficiently and you can ensure a smooth transition to Drupal 10 while minimizing risks and optimizing your website for future growth and scalability.
Look for professionals with a proven track record of successful migrations, in-depth knowledge of Drupal architecture, and strong communication skills.
---
Congratulations on reaching the end of this comprehensive guide on Drupal 9 end of life and migrating to Drupal 10.
If you have any questions or need further assistance with your Drupal migration journey, feel free to reach out to our team of experts for personalized guidance and support.