From 8a7c9c296c5e83c0df01b0f5b831ff5773e96950 Mon Sep 17 00:00:00 2001 From: Nic Rodgers Date: Thu, 4 Apr 2024 12:03:32 +0100 Subject: [PATCH 1/2] Added instructions on using multiple cores --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index bd407dc..7357fbd 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,38 @@ services: You can delete the "dev" core from `http://.ddev.site:8983/solr/#/~cores/dev` by clicking "Unload". +## Multiple Solr Cores + +If you would like to use more than one Solr core, you'll need to edit the file [`.ddev/docker-compose.solr.yaml`](docker-compose.solr.yaml) + +1. Define a mount point for each core you require. By default, a mount point is created mounting the config in .ddev/solr into the container as solr-conf. Find the section under volumes, and add new mount points for each core, for example: +```yml +services: + solr: + volumes: + - ./solr:/solr-conf + - ./core2:/core2-conf + - ./core3:/core3-conf +``` + +2. Create the directories for your new cores' config, and copy the desired solr config in to it, eg: + `cp -R .ddev/solr .ddev/core2` + + `cp -R .ddev/solr .ddev/core3` + + `cp -R path/to/core2-config/* .ddev/core2/conf/` + + `cp -R path/to/core3-config/* .ddev/core3/conf/` + +4. Change the 'entrypoint' value to use `precreate-core` instead of `solr-precreate` and add the additional cores, along with a command to start solr afterwards: +```yml +services: + solr: + entrypoint: 'bash -c "VERBOSE=yes docker-entrypoint.sh precreate-core solrconf /solr-conf ; precreate-core core2 /core2-conf ; precreate-core core3 /core3-conf ; exec solr -f "' +``` + +5. Finally, `ddev restart` to pick up the changes and create the new cores. + ## Caveats * This recipe won't work with versions of Solr before `solr:8`, and Acquia's hosting [requires Solr 7](https://docs.acquia.com/acquia-search/). You'll want to see the [contributed recipes](https://github.com/ddev/ddev-contrib) for older versions of Solr. From 4948cc43c445fc40d32082efe27b59d883cf7320 Mon Sep 17 00:00:00 2001 From: Nic Rodgers Date: Fri, 5 Apr 2024 10:22:05 +0100 Subject: [PATCH 2/2] Rewrote instructions on multiple cores to use solr_extra.yaml --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7357fbd..acb6d66 100644 --- a/README.md +++ b/README.md @@ -72,9 +72,9 @@ You can delete the "dev" core from `http://.ddev.site:8983/solr/#/~ ## Multiple Solr Cores -If you would like to use more than one Solr core, you'll need to edit the file [`.ddev/docker-compose.solr.yaml`](docker-compose.solr.yaml) +If you would like to use more than one Solr core, add a `.ddev/docker-compose.solr_extra.yaml` to override some of the default configuration. -1. Define a mount point for each core you require. By default, a mount point is created mounting the config in .ddev/solr into the container as solr-conf. Find the section under volumes, and add new mount points for each core, for example: +1. Define a mount point for each core you require. Add new mount points for each core, for example: ```yml services: solr: @@ -85,6 +85,7 @@ services: ``` 2. Create the directories for your new cores' config, and copy the desired solr config in to it, eg: + `cp -R .ddev/solr .ddev/core2` `cp -R .ddev/solr .ddev/core3` @@ -93,13 +94,23 @@ services: `cp -R path/to/core3-config/* .ddev/core3/conf/` -4. Change the 'entrypoint' value to use `precreate-core` instead of `solr-precreate` and add the additional cores, along with a command to start solr afterwards: +4. Set the 'entrypoint' value to use `precreate-core` instead of `solr-precreate` and add the additional cores, along with a command to start solr afterwards: ```yml services: solr: entrypoint: 'bash -c "VERBOSE=yes docker-entrypoint.sh precreate-core solrconf /solr-conf ; precreate-core core2 /core2-conf ; precreate-core core3 /core3-conf ; exec solr -f "' ``` +5. Your finished [`.ddev/docker-compose.solr_extra.yaml`](docker-compose.solr_extra.yaml) file should now look something like this: +```yml + services: + solr: + volumes: + - ./solr:/solr-conf + - ./core2:/core2-conf + - ./core3:/core3-conf + entrypoint: 'bash -c "VERBOSE=yes docker-entrypoint.sh precreate-core solrconf /solr-conf ; precreate-core core2 /core2-conf ; precreate-core core3 /core3-conf ; exec solr -f "' +``` 5. Finally, `ddev restart` to pick up the changes and create the new cores. ## Caveats