Skip to main content

Solr

Overview

Skpr provides managed Solr search instances that are tightly integrated into the platform configuration system. Solr connection details are automatically injected into your application as config key/value pairs, keeping your application code environment-agnostic.

Enabling Solr Integration

To enable Solr for all environments add the following to your .skpr/defaults.yml Skpr project config file and deploy. It's that simple.

The following example deploys a Solr 7.x instance with a standard Drupal Search API Solr 3.x configuration.

services:
solr:
default:
version: 7.x-3.x

Available Versions

Supported Solr versions are available through the Skpr v2 containers and are rebuilt and published to Docker Hub every night.

If you require one of the supported legacy API versions which we no longer provide updates for, you can refer to our Skpr v1 images on Docker Hub.

  • 5.x-1.x (Legacy)
  • 7.x-3.x (Solr 7.x / Search API Solr 3.x)
  • 7.x-4.x (Solr 7.x / Search API Solr 4.x)

Configuring your Application

Now that the application is deployed, we can now connect to the newly provisioned Solr instance.

Solr connection details are exposed using the Skpr config system, the same system which is used to wire up connectivity to databases, filesystems, APIs etc.

Below shows the config key/value pairs which are set by Skpr for the newly provisioned Solr service.

$ skpr config list prod | grep solr
solr.default.core default
solr.default.host 1.2.3.4
solr.default.port 8983

NOTE: Not a real IP listen above.

Applications can automatically detect these configuration values using the recipes below.

Recipes

Drupal 8+

For Drupal 8+ we have found the following configuration to work, however, it will vary based on:

  • Search API Server Name, in this example it is set to "solr".
  • Solr Service Name, in this example it is set to "default".

Add the following to your applications settings.php file.

$config['search_api.server.solr']['backend_config']['connector_config']['host'] = $skpr->get('solr.default.host') ?: '127.0.0.1';
$config['search_api.server.solr']['backend_config']['connector_config']['port'] = $skpr->get('solr.default.port') ?: '8983';
$config['search_api.server.solr']['backend_config']['connector_config']['core'] = $skpr->get('solr.default.core') ?: 'drupal';