Supporting Solr in Sitecore Instance Manager (SIM)
UPDATE: The Solr feature is now included in the production version of Sitecore Instance Manager (SIM).
Marketplace, Sitecore’s bulletin board for open source Sitecore projects, has a list of most frequent downloads, and the number one spot each month is almost always taken by the Sitecore Instance Manager, or SIM. The tool allows you to create fresh Sitecore instances, in the version of your choice, in roughly thirty seconds. It can install packages, such as PowerShell Extensions, or Launch Sitecore modules such as Web Forms for Marketers or Email Experience Manager, and perform basic maintenance operations such as opening log files, recycling app pools, publishing items, and backing up and restoring a site. It will even install MongoDB for you, or log you in to a local site as “admin”.
"SIM allows you to create fresh Sitecore instances, in the version of your choice, in roughly 30 seconds"
I have found the ability to create fresh instances of Sitecore with a click of a button to be tremendously useful in troubleshooting, since you can see what things look like before you broke them, and discovery, since spinning up a release in the latest version of Sitecore requires such little effort.
Adding Support for Solr to SIM
One feature that SIM lacks, but will soon have, is the ability to configure Sitecore to use the Solr search platform instead of Lucene. This is an important gap, as Sitecore now recommends using Solr rather than Lucene for all scaled environments, which they define as:
- two or more content delivery servers
- two or more content authoring severs
- separate servers for email, processing, reporting and publishing
Setting up Sitecore to use Solr, however, is not a straightforward operation. In addition to disabling the Lucene index configuration files and enabling their Solr equivalents, a developer needs to install Solr, make a number of customizations to support Sitecore, and create “cores” using the Solr API for each Sitecore index. In addition, if you are a developer with multiple Sitecore instances running on your desktop, you need to make additional customizations to Sitecore configuration to avoid having the indexes for the different sites collide. This is not an issue for Lucene, as each sites indexes are stored in the Data folder, but for Solr, which houses the indexes via a web-based API, there is no built-in isolation between Sitecore instances.
Almost all of these issues are addressed by a new feature that I’ve added to the Sitecore Instance Manager. The feature is currently available in the QA release of SIM, and should be coming to the main release soon. It is still necessary to set up an instance of Solr, but once this is in place, the new SIM feature will take care of the following:
- It will enable Sitecore configuration files for Solr indexes, and disable their Lucene equivalents.
- It will prefix the name of each Solr collection with the name of the Sitecore site, so that different Sitecore instances do not collide.
- It will run all necessary configuration changes, including running the “Generate Solr Schema” utility, which currently requires developers to go to the Sitecore desktop control panel.
- It will create each index on the local Solr instance.
- For Sitecore 8.1, it installs a required Castle.Windsor DLL and makes required modifications to the Global.asax file. The Solr install process for Sitecore 8.2 does not require these steps.
Since Sitecore currently requires 15 indexes to be set up, this should save Sitecore users considerable time, and will hopefully lower the barrier to exploring Sitecore with Solr.
Getting an Advance Peek
My contribution has been merged to the QA branch, but still has to go through Sitecore’s quality assurance process before it gets merged into the production branch of SIM. However, you can still try this out by doing the following:
- Download the current release of Apache Solr. You can launch this by opening a command prompt, navigating to the Solr “bin” directory, and typing “solr start”. Then you should be able to navigate to http://localhost:8983/solr to see the Solr desktop. Note that Solr requires having Java installed.
- Download the QA build of SIM. If you have SIM installed, this will show up as a separate instance, “Sitecore Instance Manager QA (SIM)”, but will use the same configuration as your main SIM instance so you will not need to repeat basic SIM set up.
- Install an instance of Sitecore 8.2 using SIM
- At the final step of the installation process, “Configuration Presets”, scroll down to select the “ContentSearch – Solr” option:
- When the installation process is done, you can go to Solr at localhost:8983, click the “Core Admin” option, and see your 15 new indexes. You can go to the Sitecore Control Panel/Indexing Manager to build the new indexes. Congratulations, you’ve configured Solr in one click!
Sitecore Tools Go Open Source
It’s great that Sitecore has decided to release SIM, along with other tools such as Sitecore Rocks, as open source modules, and that they are accepting pull requests. This puts more Sitecore developers in the driver’s seat. We can request features that we believe will add value to the Sitecore community, and we can go ahead and implement them. This project began as a tweet from a fellow MVP:
Hey @AlenPelin, how about an option to setup #Solr instead of #Lucene during and post installation in #Sitecore Instance Manager? #feedback— Vasiliy Fomichev (@VasiliyFomichev) July 27, 2015
A few more exchanges on Twitter and soon I had a Github fork running with an active discussion on the issue tracker and a backlog of next steps, which quickly became commits. Throughout the process, the author of Sitecore Instance Manager, Alen Pelin, was very helpful in offering guidance on SIM’s architecture and standards.
I now have a backlog of things I want to tackle next, such as handling deleting of Solr indexes when you delete a site, supporting Solr index backup and restoral, and allowing users to specify sharing indexes with an existing Sitecore instance (have CM2 share indexes with CM1).
Have ideas for how SIM could help you? Feel free to open an issue on my fork. Or better yet, fork the repository yourself and start trying to implement things. A good place to start are the Configuration Presets, which allows you to add options to the screen shown above. The “xml” files in that folder allow you to define steps, and the zip files allow you to store files to include in the new instance. See if you can implement CMS-Only mode as a checkbox option. Happy coding!