This project is not covered by Drupal’s security advisory policy.

The Aegir Hosting System.

Aegir Apache Solr

This tool gives Aegir the power to manage Solr servers and provision a Solr web app for any Drupal site. It includes a Tomcat implementation but can be extended to work with Jetty, etc. Patches welcome.

Provision Solr is the backend, Hosting Solr is the front-end.

Architecture

Solr is the service, Tomcat and Jetty are the servers. Just like HTTP is the service, and Apache and NGINX are the servers.

All of the Solr-specific code is in solr.service.inc and solr.config.inc. All of the tomcat code (and config template) is separated into the folder tomcat.

Same goes with the configuration. Solr home directories are in ~/config/server_SERVER/solr/SITE and the Tomcat application XML files go in ~/config/server_SERVER/tomcat/SITE.xml.

Then, once the server and site are verified, there will be a solr server available at http://SERVER_NAME:8080/SITENAME

NOTE: These Solr webapps have no security on them by default, and we don't yet have automatic security enforcement. You can still customize your Tomcat or Jetty as normal. Please use caution.

TODO: It shouldn't be too hard to build an SSL version of this ProvisionService. We modeled this on the HTTP portion of Provision, creating a provisionService_solr_public, so theoretically, a provisionService_solr_private should be possible. PATCHES ENCOURAGED!

Aegir Servers

Aegir server entities now have solr_port, solr_restart_cmd, solr_app_path, solr_war_path, and solr_homes_path properties.

When you install Tomcat and Solr, you will symlink Tomcat's Catalina/localhost to ~/config/tomcat.

Then, on verification of server_NAME, Provision symlinks ~/config/tomcat to ~/config/server_NAME/tomcat.

Everything else is Aegir Site specific.

Aegir Sites

After tons of research I've determined that the Multiple Solr Webapps method is the best and easiest way to get "many solr databases" on one server.

This has many benefits: each site gets a completely independent solr home folder, each server can use a different WAR file, enabling multiple versions of solr on one physical server. And, you could create more Solr server types, adding Jetty for instance, and easily choose which server runs what.

Each site gets it's own independent Tomcat application, defined by an XML file, which is written to ~/config/tomcat as a provisionConfig template on site verification.

Each site gets a SOLR_HOME folder of its own located at ~/config/server_SERVER/solr/SITE. So for your site mysolrpowr.com, on server_master, you get a SOLR_HOME folder at /var/aegir/config/server_master/solr/mysolrpower.com.

This Solr home directory contains solr.xml, and folders for conf and data. @TODO: We should probably move data out of there. Tomcat7 writes to this folder, and then the aegir user cannot delete that data.

Each site entity stores a new property: solr_config_path. This is the relative path within the site to the Solr conf files. For example: sites/all/modules/apachesolr/solr-conf/solr-3.x. The files in solr_config_path are copied to the SOLR_HOME/conf folder.

This allows you to store the Solrconfig.xml, schema.xml, and other Solr config files in your Drupal codebase. This means each site on your Aegir instance can manipulate Solr config however they want.

When a site is verified, the files in the Drupal tree's solr_config_path are copied to the solr_home path

Installation

You will need Aegir, a solr.war file, and Tomcat to use this tool.

Aegir + Provision Solr

We assume you have setup Aegir, but if not head to http://community.aegirproject.org/installing. I really recommend going through the Manual Installation. It is not as hard as it sounds, and you will learn the components of Aegir. Take the Plunge!

Once you've got aegir installed, get the Provision Solr drush project:

drush dl provision_solr

Solr

Next, get Apache Solr itself. Get a solr.war file from somewhere! You can download the entire apachesolr tar.gz from Apache at https://www.apache.org/dyn/closer.cgi/lucene/solr/.

All you need on your server is the solr.war file. Extract that folder someplace temporary and get the solr.war file, located at apache-solr-VERSION/example/webapps/solr.war.

Put this file on your server somewhere like /usr/share/solr-VERSION.war. We recommend naming it with the version number, because each Aegir Server Entity can utilize a specific WAR file. It doesn't matter where you put this file, as long as you configure your server to point solr_war_path to that location.

NOTE: After some testing, it is clear this setup only works with Solr 3.x. Please download a 3.x solr.war file for this. A version is available at http://mvnrepository.com/artifact/org.apache.solr/solr/3.6.2

Tomcat

Next, you need Tomcat. No other Solr server has been built as of yet, but provision_solr is ready for it.

The following instructions have been thoroughly tested on ubuntu 12.04 LTS, but tomcat is straightforward enough you should be able to adapt these instructions to any system.

Install Tomcat7. It doesn't require anything else be installed first.

sudo apt-get install tomcat7

Delete /etc/tomcat7/Catalina/localhost and replace with a symlink to /var/aegir/config/tomcat:

sudo rm -rf /etc/tomcat7/Catalina/localhost && ln -s /var/aegir/config/tomcat /etc/tomcat7/Catalina/localhost

This must happen pretty fast, as Tomcat usually replaces the Catalina/localhost folder as soon as you delete it.

Aegir will now be able to write new Tomcat XML application files on the fly when you create new Aegir Sites.

As a last step, you must add the Tomcat user to the Aegir group:

sudo adduser tomcat7 aegir

This is so tomcat7 can read and write certain folders owned by Aegir.

sudo

The aegir user needs to be able to restart Tomcat without a password. If you have already installed Aegir this was done for the Apache restart command.

Read the instructions in the Manual Installation Handbook on sudo config. In most Non-centos linux systems, you have a file at /etc/sudoers.d/aegir. Add this line to that file:

aegir ALL=NOPASSWD: /etc/init.d/tomcat7

Front End: Hosting Solr

This module is much easier to use with the AEgir Hosting front-end companion, Hosting Solr.

You can easily download and install hosting_solr with the following drush commands:

drush @hostmaster dl hosting_solr
drush @hostmaster en hosting_solr

Credits

Hosting & Provision Solr was built by the team at ThinkDrop Consulting.

It was inspired by https://github.com/EugenMayer/aegir_solr_service.

Project Information

Downloads