You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2021/07/16 16:31:00 UTC

[solr] branch main updated: SOLR-15545: Properly source run-initdb in docker commands (#223)

This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 3cb7e94  SOLR-15545: Properly source run-initdb in docker commands (#223)
3cb7e94 is described below

commit 3cb7e94f15d5e6cd595f57385a426797c8e226ea
Author: Houston Putman <ho...@apache.org>
AuthorDate: Fri Jul 16 12:30:53 2021 -0400

    SOLR-15545: Properly source run-initdb in docker commands (#223)
    
    This allows for Environment Variables to be exported in initdb scripts.
---
 solr/docker/scripts/solr-create        | 3 ++-
 solr/docker/scripts/solr-demo          | 3 ++-
 solr/docker/scripts/solr-foreground    | 3 ++-
 solr/docker/scripts/solr-precreate     | 3 ++-
 solr/docker/tests/cases/initdb/test.sh | 6 ++++++
 5 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/solr/docker/scripts/solr-create b/solr/docker/scripts/solr-create
index e0d9c0e..41f7150 100755
--- a/solr/docker/scripts/solr-create
+++ b/solr/docker/scripts/solr-create
@@ -29,7 +29,8 @@ if [[ "${VERBOSE:-}" == "yes" ]]; then
     set -x
 fi
 
-run-initdb
+# Could set env-variables for solr-fg
+source run-initdb
 
 # solr uses "-c corename". Parse the arguments to determine the core name.
 CORE_NAME="$(
diff --git a/solr/docker/scripts/solr-demo b/solr/docker/scripts/solr-demo
index 1fe3917..8afdabe 100755
--- a/solr/docker/scripts/solr-demo
+++ b/solr/docker/scripts/solr-demo
@@ -22,7 +22,8 @@ if [[ "${VERBOSE:-}" == "yes" ]]; then
     set -x
 fi
 
-run-initdb
+# Could set env-variables for solr-fg
+source run-initdb
 
 CORE=demo
 
diff --git a/solr/docker/scripts/solr-foreground b/solr/docker/scripts/solr-foreground
index 768638b..f7b5ba2 100755
--- a/solr/docker/scripts/solr-foreground
+++ b/solr/docker/scripts/solr-foreground
@@ -21,6 +21,7 @@ if [[ "$VERBOSE" == "yes" ]]; then
     set -x
 fi
 
-run-initdb
+# Could set env-variables for solr-fg
+source run-initdb
 
 exec solr-fg "$@"
diff --git a/solr/docker/scripts/solr-precreate b/solr/docker/scripts/solr-precreate
index 7b60496..96277e1 100755
--- a/solr/docker/scripts/solr-precreate
+++ b/solr/docker/scripts/solr-precreate
@@ -31,7 +31,8 @@ if [[ "${VERBOSE:-}" == "yes" ]]; then
     set -x
 fi
 
-run-initdb
+# Could set env-variables for solr-fg
+source run-initdb
 
 precreate-core "$@"
 
diff --git a/solr/docker/tests/cases/initdb/test.sh b/solr/docker/tests/cases/initdb/test.sh
index 5ff5808..9a64244 100755
--- a/solr/docker/tests/cases/initdb/test.sh
+++ b/solr/docker/tests/cases/initdb/test.sh
@@ -24,6 +24,7 @@ prepare_dir_to_mount 8983 "$initdb"
 
 cat > "$initdb/create-was-here.sh" <<EOM
 touch /var/solr/initdb-was-here
+export SOLR_HEAP="745m"
 EOM
 cat > "$initdb/ignore-me" <<EOM
 touch /var/solr/should-not-be
@@ -45,6 +46,11 @@ if [[ -n "$data" ]]; then
   echo "Test $TEST_DIR $tag failed; should-not-be was"
   exit 1
 fi
+data=$(docker exec --user=solr "$container_name" ps -ef)
+if ! grep -q 'Xms745m' <<< "$data"; then
+  echo "Test $TEST_DIR $tag failed; environment variable in initdb script not exported correctly"
+  exit 1
+fi
 echo "Checking docker logs"
 log="${BUILD_DIR}/docker.log-$container_name"
 if ! docker logs "$container_name" >"$log" 2>&1; then