Solr
Overview
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 can be utilized 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';
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 application.