Drupal
September 5, 2022

Anirudh Mahant

Migrating from Solr 3 to Solr 8 on Pantheon

The Customer Need

Our customer runs their website on Drupal 9 and the current search is powered by Solr 3. The hosting infrastructure is Pantheon. Solr 3 reaches its end of life and so they were interested to move to the latest search powered by Solr 8, while continuing to run the website on Pantheon.

In this post, we will cover the essentials of how to move from Solr 3 to Solr 8 on Pantheon.

Enabling Solr 8 Support in Pantheon

Pantheon has out-of-the-box support for Solr 8, seamless automated workflow to manage and upgrade Drupal sites, version control management through Git – to top it all it’s feature-rich when working with multiple development environments. Similarly, repository merging or migrating database from one environment to another is just a click away.

There’s comprehensive documentation available on Pantheon support for Using Solr 8 on Drupal 9 which you should read in advance. The steps here are quite straightforward if you don’t run into any occasional issues with composer dependencies, or setting up your local dev environment. Setting up the terminus CLI shouldn’t be a compulsion either but do it anyways, to avoid credential checks every now and then.

Step 1: Clone Pantheon Repo

Best way to manage a Drupal site in Pantheon is the Git mode as opposed to sFTP. Assuming you’re logged in, copy over these details from Pantheon Dashboard and start cloning. When prompted for auth enter your Pantheon account password.

Pantheon Dashboard
Pantheon Dashboard

Step 2: Enable Apache Solr 8 Index Server

There are two ways to do this, from the Pantheon Dashboard or using the terminus CLI script, as it happens on the running instance itself.

Pantheon Solr Service
Pantheon Solr Service

Another way to do it is using the terminus CLI using: terminus solr:enable $SITE to enable Solr 8. We’ll explore some interesting facts about how Pantheon sets up Solr 8 instances later.

Solr 8 versioning is managed by the pantheon.yml configuration file which should be your next step in deploying:

Once edited and saved just commit and push your changes back and let Pantheon pickup your settings triggering the automated workflows which should take about 10-15 mins roughly.

Step 3: Install and Enable the SearchAPI Pantheon module

In case you’re wondering why doesn’t the default SearchAPI module suffice, then Pantheon has compatibility issues. Check out this Solr and module versions compatibility matrix for Drupal 8 and 9 for more information.

One last step is to install this wrapper module which addresses compatibility issues to let you work with Solr 8 on the Pantheon platform. Install the module using only Composer with: composer install && composer require drupal/search_api_pantheon:^8 --prefer-dist

This will install all Drupal and Composer dependencies which are not tracked in Git. Due to the nature of different dev environments, it just tracks changes inside composer.json and composer.lock files. Go ahead and commit/push your changes back, and let Pantheon spin up one more workflow. Behind the scenes, Pantheon picks up changes in your Composer dependencies and installs them in the environment automatically. The same workflow triggers on Git operations, or updates to pantheon.yml, composer, etc, opening up new avenues to create your own custom workflows or upstreams.

Finally enable the wrapper module either with Terminus CLI or from the Drupal admin. For Terminus CLI: terminus drush $SITE.$ENV -- pm-enable search_api_pantheon search_api_pantheon_admin

You’ll need to enable both SearchAPI Pantheon and SearchAPI Pantheon Admin modules. Head over to this article on how to configure SearchAPI and Indexing.

Troubleshooting Pantheon Solr 8

To make sure your Solr 8 instance is properly configured and running go to /admin/config/search/search-api/server/pantheon and hop over to the view tab. On this screen, you’ll find all the debug information related to the active Solr 8 instance as below:

Pantheon Solr Instance
Pantheon Solr Instance

While exploring Pantheon services like Solr 8, and Redis, it was evident that they are deployed as clusters on the Google Cloud Platform, ensuring secure and stable microservices with maximum uptime SLA.

Summary

Migrating from SolR 3 to SolR 8 can be a daunting task. In this article we've shared our insight on how to seamlessly migrate pre-existing SolR versions to the latest version 8 through Pantheon in three easy steps. If you enjoyed this post please feel free to re-share this post and drop us any queries on our social handles and join our newletter below.

No items found.

Related Insights

8 Reasons: Drupal Proves to be a Top Pick for Government Sites

Find out why most government websites prefer and should be built on Drupal

Ashwin Thapliyal

Drupal

Creating a robust TailwindCSS Pipeline for Custom Drupal Theme

Find out how to set up a TailwindCSS pipeline for a custom Drupal theme

Anirudh Mahant

Drupal

Enabling Component Based Design in Drupal

Learn the power of Drupal to create components throughout your Drupal website

Vasi Eswar

Drupal

Subscribe to our newsletter