From 3576885b4b238a32d4470c713ae99ec605e67887 Mon Sep 17 00:00:00 2001 From: Martin Knoller Stocker Date: Thu, 27 Jan 2022 08:56:40 +0100 Subject: [PATCH 1/4] docker start linux: use more portable bash shebang --- docker.sh | 2 +- index.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker.sh b/docker.sh index 0a8c49d..d125c1a 100755 --- a/docker.sh +++ b/docker.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash docker run -p 8983:8983 -v $(PWD)/solr_home:/opt/mysolrhome -e SOLR_HOME=/opt/mysolrhome -e INIT_SOLR_HOME=yes solr:8.4.1 diff --git a/index.sh b/index.sh index 54ae880..b5c90f8 100755 --- a/index.sh +++ b/index.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [ ! -f ./tmdb_solr.json ]; then unzip tmdb_solr.json.zip fi From 334b97e1195370f84a7e0a55ac05352265f79ce8 Mon Sep 17 00:00:00 2001 From: Martin Knoller Stocker Date: Thu, 27 Jan 2022 08:57:22 +0100 Subject: [PATCH 2/4] docker start linux: chown solrhome according to solr docker documentation to solve permission issues --- docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker.sh b/docker.sh index d125c1a..b30a613 100755 --- a/docker.sh +++ b/docker.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash - +sudo chown -R 8983:8983 solr_home # necessary on Linux, not Mac according to https://github.com/docker-solr/docker-solr/blob/master/README.md docker run -p 8983:8983 -v $(PWD)/solr_home:/opt/mysolrhome -e SOLR_HOME=/opt/mysolrhome -e INIT_SOLR_HOME=yes solr:8.4.1 From 5cd7f7f09f753cdd11f2c0e9160502eb8b9d51f8 Mon Sep 17 00:00:00 2001 From: Martin Knoller Stocker Date: Thu, 27 Jan 2022 08:57:58 +0100 Subject: [PATCH 3/4] docker start linux: fix volume mount, use PWD variable, not command --- docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker.sh b/docker.sh index b30a613..2be0aef 100755 --- a/docker.sh +++ b/docker.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash sudo chown -R 8983:8983 solr_home # necessary on Linux, not Mac according to https://github.com/docker-solr/docker-solr/blob/master/README.md -docker run -p 8983:8983 -v $(PWD)/solr_home:/opt/mysolrhome -e SOLR_HOME=/opt/mysolrhome -e INIT_SOLR_HOME=yes solr:8.4.1 +docker run -p 8983:8983 -v ${PWD}/solr_home:/opt/mysolrhome -e SOLR_HOME=/opt/mysolrhome -e INIT_SOLR_HOME=yes solr:8.4.1 From 5bda75308cdf79e33910ebf14737f512a0498647 Mon Sep 17 00:00:00 2001 From: Martin Knoller Stocker Date: Thu, 27 Jan 2022 21:36:36 +0100 Subject: [PATCH 4/4] docker start linux: execute chown step only on linux; avoid globbing/word-splitting of $PWD --- docker.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docker.sh b/docker.sh index 2be0aef..ff42d34 100755 --- a/docker.sh +++ b/docker.sh @@ -1,3 +1,9 @@ #!/usr/bin/env bash -sudo chown -R 8983:8983 solr_home # necessary on Linux, not Mac according to https://github.com/docker-solr/docker-solr/blob/master/README.md -docker run -p 8983:8983 -v ${PWD}/solr_home:/opt/mysolrhome -e SOLR_HOME=/opt/mysolrhome -e INIT_SOLR_HOME=yes solr:8.4.1 + +if [ "$(uname -s)" == 'Linux' ]; then + # necessary on Linux according to https://github.com/docker-solr/docker-solr/blob/master/README.md + # docker does volume mount as solr user, which has usually no permissions on the host system + sudo chown -R 8983:8983 solr_home +fi + +docker run -p 8983:8983 -v "${PWD}/solr_home:/opt/mysolrhome" -e SOLR_HOME=/opt/mysolrhome -e INIT_SOLR_HOME=yes solr:8.4.1