Skip to content

Solr

Overview

Blog post coming soon...

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

  • 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)

The container images for this Solr service can be found here:

https://github.com/skpr/containers/tree/master/solr

Configuring your Application

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

Solr connection details 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';

Roadmap

Skpr is currently roadmapping the ability for projects to add their own custom configuration to the Solr service.

This is most likely going to be integrated into the same skpr package process that builds and deploys your applicaiton.

Back to top