This repository allows you to quickly install Apache Solr for Drupal 9+ into a Ddev project using just ddev get ddev/ddev-drupal9-solr
. It follows the Setting up Solr (single core) - the classic way recipe.
-
ddev get ddev/ddev-drupal9-solr && ddev restart
-
You may need to install the relevant Drupal requirements:
ddev composer require drush/drush drupal/search_api_solr
-
Enable the
search_api_solr
module either using the web interface orddev drush en -y search_api_solr
-
Create a Search API server at
admin/config/search/search-api
-> "Add server" -
Create a server with the following settings
- Set "Server name" to anything you want. Maybe
ddev-solr-server
. - Set "Backend" to
Solr
- Configure Solr backend
- Set "Solr Connector" to
Standard
- Set "Solr host" to
solr
- Set "solr core" to
dev
- Under "Advanced server configuration" set the "solr.install.dir" to
/opt/solr
.
- Set "Solr Connector" to
- Set "Server name" to anything you want. Maybe
-
ddev restart
If you get a message about Solr having outdated config files, you need to update the included Solr config files.
- Click "Get config.zip" on the server page
- Unzip the files, and put the config files into
.ddev/solr/conf/
- Run
ddev restart
See the documentation in the doc
folder
This is the classic Drupal solr:8
image recipe used for a long time by Drupal users and compatible with search_api_solr
.
- It installs a
.ddev/docker-compose.solr.yaml
using the solr:8 docker image. - A standard Drupal 9+ Solr configuration is included in .ddev/solr/conf.
- A .ddev/docker-entrypoint-initdb.d/solr-configupdate.sh is included and mounted into the Solr container so that you can change Solr config in
.ddev/solr/conf
with just addev restart
.
- The Solr admin interface will be accessible at:
http://<projectname>.ddev.site:8983/solr/
For example, if the project is namedmyproject
the hostname will be:http://myproject.ddev.site:8983/solr/
. - To access the Solr container from inside the web container use:
http://solr:8983/solr/
- A Solr core is automatically created by default with the name "dev"; it can be accessed (from inside the web container) at the URL:
http://solr:8983/solr/dev
or from the host athttp://<projectname>.ddev.site:8983/solr/#/~cores/dev
. You can obviously create other cores to meet your needs.
If you want to use a core name other than the default "dev", add a .ddev/docker-compose.solr-env.yaml
with these contents, using the core name you want to use:
services:
solr:
environment:
- SOLR_CORENAME=somecorename
- Change SOLR_CORENAME environment variable in the
environment:
section. - Change your Drupal configuration to use the new core.
You can delete the "dev" core from http://<projectname>.ddev.site:8983/solr/#/~cores/dev
by clicking "Unload".
- This recipe won't work with versions of Solr before
solr:8
, and Acquia's hosting requires Solr 7. You'll want to see the contributed recipes for older versions of Solr.