Skip to content

Instantly share code, notes, and snippets.

@stborchert
Created December 15, 2020 08:05
Show Gist options
  • Save stborchert/54509077d96eafbc12e69db80caa537f to your computer and use it in GitHub Desktop.
Save stborchert/54509077d96eafbc12e69db80caa537f to your computer and use it in GitHub Desktop.
DDEV recipe for Solr 4
# DDev Apache Solr recipe file for Solr 4.
#
# To access Solr after it is installed:
# - The Solr admin interface will be accessible at:
# http://<projectname>.ddev.site:8983/solr/
# For example, if the project is named "myproject" the hostname will be:
# http://myproject.ddev.site:8983/solr/
# - To access the Solr container from the web container use:
# http://solr:8983/solr/
version: '3.6'
services:
solr:
# Name of container using standard ddev convention.
container_name: ddev-${DDEV_SITENAME}-solr
# Grab an image from https://hub.docker.com/r/geerlingguy/solr since older
# versions are not available on https://hub.docker.com/_/solr.
image: geerlingguy/solr:4.10.4
restart: "always"
# Solr is served from this port inside the container.
ports:
- 8983
# These labels ensure the service is discoverable by ddev.
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
environment:
# This defines the host name the service should be accessible from. This
# will be sitename.ddev.site.
- VIRTUAL_HOST=$DDEV_HOSTNAME
# This defines the port the service should be accessible from at
# sitename.ddev.site.
- HTTP_EXPOSE=8983
volumes:
# solr core *data* is stored on the 'solr' docker volume
# This mount is optional; without it your search index disappears
# each time the ddev project is stopped and started.
- solr:/var/solr
# This mounts the conf in .ddev/solr into the container where
# the solr-precreate command in the entrypoint uses it as a one-time
# configuration to copy config into the newly-created core. It is not
# used if the core has previously been created.
- ./solr/default:/opt/solr/example/solr/default
# This mounts the .ddev directory into the container so we can use it
# if necessary.
- ".:/mnt/ddev_config"
# This command is executed after the services has been started.
command: ["/opt/solr/bin/solr", "start", "-p", "8983", "-f"]
external_links:
- "ddev-router:${DDEV_SITENAME}.${DDEV_TLD}"
# This links the Solr service to the web service defined in the main
# docker-compose.yml, allowing applications running inside the web container to
# access the Solr service at http://solr:8983
web:
links:
- solr:solr
volumes:
# solr is a persistent Docker volume for solr data
# The persistent volume should have the same name as the service so it can be deleted
# when the project is deleted.
solr:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment