Apache Solr open-source search software
SOLR-15001 Docker: require init_var_solr.sh (#2083)
David Smiley1e0ae2fb7488
diff --git a/dev-tools/scripts/addVersion.py b/dev-tools/scripts/addVersion.pyindex 72c9a0d7079..37ddd7c847f 100755--- a/dev-tools/scripts/addVersion.py+++ b/dev-tools/scripts/addVersion.py@@ -192,6 +192,7 @@ def parse_properties_file(filename):def get_solr_init_changes():return dedent('''Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.+ Docker and contrib modules have separate CHANGES.md files.''')diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex e499f03e4dd..f1eb0c07c70 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -7,6 +7,7 @@ https://github.com/apache/lucene-solr/blob/master/solr/solr-ref-guide/src/solr-u================== 9.0.0 ==================Consult the lucene/CHANGES.txt file for additional, low level, changes in this release.+Docker and contrib modules have separate CHANGES.md files.New Features---------------------@@ -144,15 +145,11 @@ Other Changes* SOLR-14944: Remove the "spins" metrics - support for detection of spinning disks has beenremoved in LUCENE-9576. (ab)-* SOLR-14957: Add Prometheus Exporter to docker PATH. Fix classpath issues. (Houston Putman)-* SOLR-14912: Clean up solr-extraction contrib to produce solr-extraction-* jar(instead of solr-cell-*). (Dawid Weiss)* SOLR-14978: Enable OOM Killer Script in Solr Foreground. Simplify getting heap dumps on OOM. (Mike Drob, Houston Putman)-* SOLR-14949: Ability to customize docker image name/base image (Houston Putman)-* SOLR-14035: Remove deprecated preferLocalShards=true support in favour of the shards.preference=replica.location:local alternative.(Alex Bulygin via Christine Poerschke)diff --git a/solr/docker/CHANGES.md b/solr/docker/CHANGES.mdnew file mode 100644index 00000000000..04a767cd794--- /dev/null+++ b/solr/docker/CHANGES.md@@ -0,0 +1,28 @@+This file lists release notes for this module.+Prior to version 9, the module existed in another repository and changes were not tracked in this manner.+You could browse the commit history here instead:+https://github.com/docker-solr/docker-solr++9.0.0+==================++Improvements+----------------------+* SOLR-14001: Removed /var/solr initialization from the Dockerfile; depend on init_var_solr.sh instead.+ This leads to more consistent behavior no matter how /var/solr is mounted.+ * init_var_solr.sh is now invoked by docker-entrypoint.sh; not in a bunch of other places.+ * as before, you can set NO_INIT_VAR_SOLR=1 to short-circuit this.+ * init_var_solr.sh no longer echo's anything. For verbosity, set VERBOSE=yes.+ (David Smiley)++* SOLR-14957: Add Prometheus Exporter to docker PATH. Fix classpath issues.+ (Houston Putman)++* SOLR-14949: Ability to customize the FROM image when building.+ (Houston Putman)++Other Changes+------------------+* SOLR-14789: Migrate docker image creation from docker-solr repo to solr/docker.+ (Houston Putman, Martijn Koster, Tim Potter, David Smiley, janhoy, Mike Drob)+diff --git a/solr/docker/Dockerfile b/solr/docker/Dockerfileindex aac6bcc71b0..92465215ae6 100644--- a/solr/docker/Dockerfile+++ b/solr/docker/Dockerfile@@ -59,11 +59,7 @@ RUN set -ex; \mv /opt/solr/bin/solr.in.cmd /opt/solr/bin/solr.in.cmd.orig; \chown root:0 /etc/default/solr.in.sh; \chmod 0664 /etc/default/solr.in.sh; \- mkdir -p /var/solr/data /var/solr/logs; \- (cd /opt/solr/server/solr; cp solr.xml zoo.cfg /var/solr/data/); \- cp /opt/solr/server/resources/log4j2.xml /var/solr/log4j2.xml; \- find /var/solr -type d -print0 | xargs -0 chmod 0770; \- find /var/solr -type f -print0 | xargs -0 chmod 0660; \+ mkdir -p -m0770 /var/solr; \sed -i -e "s/\"\$(whoami)\" == \"root\"/\$(id -u) == 0/" /opt/solr/bin/solr; \sed -i -e 's/lsof -PniTCP:/lsof -t -PniTCP:/' /opt/solr/bin/solr; \chown -R "0:0" /opt/solr-$SOLR_VERSION /docker-entrypoint-initdb.d /opt/docker-solr; \diff --git a/solr/docker/include/scripts/docker-entrypoint.sh b/solr/docker/include/scripts/docker-entrypoint.shindex 38e7c1c9743..69738a9206d 100755--- a/solr/docker/include/scripts/docker-entrypoint.sh+++ b/solr/docker/include/scripts/docker-entrypoint.sh@@ -17,6 +17,9 @@ if ! [[ ${SOLR_PORT:-} =~ ^[0-9]+$ ]]; thenexport SOLR_PORTfi+# Essential for running Solr+/opt/docker-solr/scripts/init-var-solr+# when invoked with e.g.: docker run solr -helpif [ "${1:0:1}" == '-' ]; thenset -- solr-foreground "$@"diff --git a/solr/docker/include/scripts/init-var-solr b/solr/docker/include/scripts/init-var-solrindex 8a29de109fc..d1d63255dcb 100755--- a/solr/docker/include/scripts/init-var-solr+++ b/solr/docker/include/scripts/init-var-solr@@ -31,31 +31,29 @@ function check_dir_writability {}if [ ! -d "$DIR/data" ]; then- echo "Creating $DIR/data"+ #echo "Creating $DIR/data"check_dir_writability "$DIR"- mkdir "$DIR/data"- chmod 0770 "$DIR/data"+ mkdir -m0770 "$DIR/data"fiif [ ! -d "$DIR/logs" ]; then- echo "Creating $DIR/logs"+ #echo "Creating $DIR/logs"check_dir_writability "$DIR"- mkdir "$DIR/logs"- chmod 0770 "$DIR/logs"+ mkdir -m0770 "$DIR/logs"fiif [ ! -f "$DIR/data/solr.xml" ]; then- echo "Copying solr.xml"+ #echo "Copying solr.xml"cp -a /opt/solr/server/solr/solr.xml "$DIR/data/solr.xml"fiif [ ! -f "$DIR/data/zoo.cfg" ]; then- echo "Copying zoo.cfg"+ #echo "Copying zoo.cfg"cp -a /opt/solr/server/solr/zoo.cfg "$DIR/data/zoo.cfg"fiif [ ! -f "$DIR/log4j2.xml" ]; then- echo "Copying log4j2.xml"+ #echo "Copying log4j2.xml"cp -a /opt/solr/server/resources/log4j2.xml "$DIR/log4j2.xml"fidiff --git a/solr/docker/include/scripts/solr-create b/solr/docker/include/scripts/solr-createindex e2054a19ce7..d523ce6ec56 100755--- a/solr/docker/include/scripts/solr-create+++ b/solr/docker/include/scripts/solr-create@@ -15,9 +15,6 @@ if [[ "${VERBOSE:-}" == "yes" ]]; thenset -xfi-# init script for handling an empty /var/solr-/opt/docker-solr/scripts/init-var-solr-. /opt/docker-solr/scripts/run-initdb# solr uses "-c corename". Parse the arguments to determine the core name.diff --git a/solr/docker/include/scripts/solr-foreground b/solr/docker/include/scripts/solr-foregroundindex 336104b3e33..aa9fa682908 100755--- a/solr/docker/include/scripts/solr-foreground+++ b/solr/docker/include/scripts/solr-foreground@@ -7,9 +7,6 @@ if [[ "$VERBOSE" == "yes" ]]; thenset -xfi-# init script for handling an empty /var/solr-/opt/docker-solr/scripts/init-var-solr-. /opt/docker-solr/scripts/run-initdbexec solr-fg "$@"diff --git a/solr/docker/include/scripts/solr-precreate b/solr/docker/include/scripts/solr-precreateindex 524820316c0..91d0a3dd89c 100755--- a/solr/docker/include/scripts/solr-precreate+++ b/solr/docker/include/scripts/solr-precreate@@ -17,9 +17,6 @@ if [[ "${VERBOSE:-}" == "yes" ]]; thenset -xfi-# init script for handling an empty /var/solr-/opt/docker-solr/scripts/init-var-solr-. /opt/docker-solr/scripts/run-initdb/opt/docker-solr/scripts/precreate-core "$@"diff --git a/solr/docker/tests/cases/empty-varsolr-vol-solr-nocopy/test.sh b/solr/docker/tests/cases/empty-varsolr-vol-solr-nocopy/test.shindex eaa39ac4e96..0b3bc2f1555 100755--- a/solr/docker/tests/cases/empty-varsolr-vol-solr-nocopy/test.sh+++ b/solr/docker/tests/cases/empty-varsolr-vol-solr-nocopy/test.sh@@ -17,6 +17,7 @@ docker volume create "$myvarsolr"docker run \-v "$myvarsolr:/var/solr:nocopy" \--rm \+ -e NO_INIT_VAR_SOLR=yes \-u "0:0" \"$tag" bash -c "chown 8983:8983 /var/solr"