Created
December 17, 2020 17:53
-
-
Save stborchert/9e36ce024ab3b3e0657e5bf31a06bd5e to your computer and use it in GitHub Desktop.
DDEV recipe for Solr 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name=solr_content | |
config=solrconfig.xml | |
schema=schema.xml | |
dataDir=/var/solr/data/solr_content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DDev Apache Solr recipe file for Solr 5. | |
# | |
# 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 | |
image: geerlingguy/solr:5.5.5 | |
restart: "always" | |
# Solr is served from this port inside the container. | |
ports: | |
- 8983 | |
# These labels ensure this 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 config of the solr cores in .ddev/solr into the container. | |
- ./solr/solr_content:/solr-conf-solr_content | |
- ./solr/solr_user:/solr-conf-solr_user | |
# Mount the script to update the configuration on startup into the container. | |
- "./solr/solr-configupdate.sh:/solr-configupdate.sh" | |
# This mounts the .ddev directory into the container so we can use it | |
# if necessary. | |
- ".:/mnt/ddev_config" | |
command: ["sh", "-c", "/solr-configupdate.sh && /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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# Define core names. | |
CORENAMES=( "solr_content" "solr_user" ) | |
for CORENAME in "${CORENAMES[@]}" | |
do | |
mkdir -p /opt/solr/server/solr/${CORENAME} | |
cp -n /solr-conf-${CORENAME}/core.properties /opt/solr/server/solr/${CORENAME}/core.properties | |
if [ -d /opt/solr/server/solr/${CORENAME}/conf ]; then | |
# Remove old configuration. | |
rm -rf /opt/solr/server/solr/${CORENAME}/conf/* | |
else | |
mkdir /opt/solr/server/solr/${CORENAME}/conf | |
fi | |
# Copy new configuration. | |
cp /solr-conf-${CORENAME}/conf/* /opt/solr/server/solr/${CORENAME}/conf | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment