|
| 1 | +# DDEV Apache Solr recipe file. |
| 2 | +#ddev-generated |
| 3 | +# |
| 4 | +# |
| 5 | +# To use this in your own project: |
| 6 | +# 1. Copy this file to your project's ".ddev" directory. |
| 7 | +# 2. Create the folder path ".ddev/solr/conf". |
| 8 | +# 3. Copy the Solr configuration files for the appropriate plugin/module to |
| 9 | +# ".ddev/solr/conf". For example, using Drupal 8's Search API Solr module, |
| 10 | +# you'll get the config files as a file config.zip from |
| 11 | +# /admin/config/search/search-api/server/solr and unzip it into .ddev/solr/conf |
| 12 | +# so that a file exists with the path ".ddev/solr/conf/solrconfig.xml". |
| 13 | +# |
| 14 | +# To access Solr after it is installed: |
| 15 | +# - The Solr admin interface will be accessible at: |
| 16 | +# http://<projectname>.ddev.site:8983/solr/ |
| 17 | +# For example, if the project is named "myproject" the hostname will be: |
| 18 | +# http://myproject.ddev.site:8983/solr/ |
| 19 | +# - To access the Solr container from the web container use: |
| 20 | +# http://solr:8983/solr/ |
| 21 | +# - A Solr core is automatically created with the name "dev" unless you |
| 22 | +# change that usage throughout. It can be |
| 23 | +# accessed at the URL: http://solr:8983/solr/dev (inside web container) |
| 24 | +# or at http://myproject.ddev.site:8983/solr/dev (on the host) |
| 25 | + |
| 26 | +services: |
| 27 | + solr: |
| 28 | + # Name of container using standard ddev convention |
| 29 | + container_name: ddev-${DDEV_SITENAME}-solr |
| 30 | + # The solr docker image is at https://hub.docker.com/_/solr/ |
| 31 | + # and code at https://github.com/docker-solr/docker-solr |
| 32 | + # README: https://github.com/docker-solr/docker-solr/blob/master/README.md |
| 33 | + # It's almost impossible to work with it if you don't read the docs there |
| 34 | + image: solr:8 |
| 35 | + restart: "no" |
| 36 | + # Solr is served from this port inside the container. |
| 37 | + expose: |
| 38 | + - 8983 |
| 39 | + # These labels ensure this service is discoverable by ddev. |
| 40 | + labels: |
| 41 | + com.ddev.site-name: ${DDEV_SITENAME} |
| 42 | + com.ddev.approot: $DDEV_APPROOT |
| 43 | + environment: |
| 44 | + # This defines the host name the service should be accessible from. This |
| 45 | + # will be sitename.ddev.site. |
| 46 | + - VIRTUAL_HOST=$DDEV_HOSTNAME |
| 47 | + # HTTP_EXPOSE exposes http traffic from the container port 8983 |
| 48 | + # to the host port 8983 vid ddev-router reverse proxy. |
| 49 | + - HTTP_EXPOSE=8983:8983 |
| 50 | + volumes: |
| 51 | + # solr core *data* is stored on the 'solr' docker volume |
| 52 | + # This mount is optional; without it your search index disappears |
| 53 | + # each time the ddev project is stopped and started. |
| 54 | + - solr:/var/solr |
| 55 | + |
| 56 | + # This mounts the conf in .ddev/solr into the container where |
| 57 | + # the solr-precreate command in the entrypoint uses it as a one-time |
| 58 | + # configuration to copy config into the newly-created core. It is not |
| 59 | + # used if the core has previously been created. |
| 60 | + - ./solr:/solr-conf |
| 61 | + |
| 62 | + - ".:/mnt/ddev_config" |
| 63 | + |
| 64 | + # solr-configupdate.sh copies fresh configuration files into the |
| 65 | + # solr container on each |
| 66 | + # startup, so if you change the config in .ddev/solr/conf |
| 67 | + # it will be refreshed on `ddev start`. It must be executable, |
| 68 | + # `chmod +x solr |
| 69 | + - "./solr/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d" |
| 70 | + |
| 71 | + # The odd need to use $$SOLR_CORENAME here is explained in |
| 72 | + # https://stackoverflow.com/a/48189916/215713 |
| 73 | + entrypoint: 'bash -c "VERBOSE=yes docker-entrypoint.sh solr-precreate $${SOLR_CORENAME:-dev} /solr-conf"' |
| 74 | + |
| 75 | + external_links: |
| 76 | + - "ddev-router:${DDEV_SITENAME}.${DDEV_TLD}" |
| 77 | + healthcheck: |
| 78 | + test: ["CMD-SHELL", "curl --fail -s localhost:8983/solr/"] |
| 79 | + |
| 80 | +volumes: |
| 81 | + # solr is a persistent Docker volume for solr data |
| 82 | + solr: |
| 83 | + name: "ddev-${DDEV_SITENAME}_solr" |
0 commit comments