This is an automated email from the ASF dual-hosted git repository. eamonford pushed a commit to branch custom-solr-image in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git
commit ea9ab5db74e0a8ccc00e0a3689da55542be32d14 Author: Eamon Ford <[email protected]> AuthorDate: Fri Sep 4 15:47:58 2020 -0700 new custom solr image, update create-collection.py to create geo field --- docker/.gitignore | 1 - docker/cassandra/Dockerfile | 31 -------- docker/cassandra/README.md | 0 docker/cassandra/docker-entrypoint.sh | 85 -------------------- docker/solr/Dockerfile | 23 ++---- docker/solr/cloud-init/create-collection.py | 35 ++++++++ docker/solr/cloud/Dockerfile | 31 -------- docker/solr/cloud/Readme.rst | 93 ---------------------- .../docker-entrypoint-initdb.d/0-init-home.sh | 26 ------ .../docker-entrypoint-initdb.d/1-bootstrap-zk.sh | 23 ------ docker/solr/cloud/tmp/solr.xml | 53 ------------ docker/solr/cloud/tmp/zoo.cfg | 31 -------- docker/solr/singlenode/Dockerfile | 30 ------- docker/solr/singlenode/Readme.rst | 42 ---------- docker/solr/singlenode/create-core.sh | 25 ------ 15 files changed, 40 insertions(+), 489 deletions(-) diff --git a/docker/.gitignore b/docker/.gitignore deleted file mode 100644 index bdec9b9..0000000 --- a/docker/.gitignore +++ /dev/null @@ -1 +0,0 @@ -docker-run-commands.txt diff --git a/docker/cassandra/Dockerfile b/docker/cassandra/Dockerfile deleted file mode 100644 index 60acb5a..0000000 --- a/docker/cassandra/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM cassandra:2.2 - -MAINTAINER Apache SDAP "[email protected]" - -RUN apt-get update && apt-get -y install git && rm -rf /var/lib/apt/lists/* - -RUN mkdir -p /docker-entrypoint-initdb.d && \ - chown -R cassandra:cassandra /docker-entrypoint-initdb.d && \ - chmod 777 /docker-entrypoint-initdb.d && \ - cd /tmp && \ - git clone https://github.com/apache/incubator-sdap-nexus.git && \ - cp -r /tmp/incubator-sdap-nexus/data-access/config/schemas/cassandra/nexustiles.cql /docker-entrypoint-initdb.d/nexustiles.cql && \ - rm -rf /tmp/incubator-sdap-nexus - -COPY docker-entrypoint.sh /usr/local/bin/ -ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/docker/cassandra/README.md b/docker/cassandra/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/docker/cassandra/docker-entrypoint.sh b/docker/cassandra/docker-entrypoint.sh deleted file mode 100755 index b6410ed..0000000 --- a/docker/cassandra/docker-entrypoint.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash -set -e - -# first arg is `-f` or `--some-option` -# or there are no args -if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then - set -- cassandra -f "$@" -fi - -# allow the container to be started with `--user` -if [ "$1" = 'cassandra' -a "$(id -u)" = '0' ]; then - chown -R cassandra /var/lib/cassandra /var/log/cassandra "$CASSANDRA_CONFIG" - exec gosu cassandra "$BASH_SOURCE" "$@" -fi - -_ip_address() { - # scrape the first non-localhost IP address of the container - # in Swarm Mode, we often get two IPs -- the container IP, and the (shared) VIP, and the container IP should always be first - ip address | awk ' - $1 == "inet" && $NF != "lo" { - gsub(/\/.+$/, "", $2) - print $2 - exit - } - ' -} - -if [ "$1" = 'cassandra' ]; then - : ${CASSANDRA_RPC_ADDRESS='0.0.0.0'} - - : ${CASSANDRA_LISTEN_ADDRESS='auto'} - if [ "$CASSANDRA_LISTEN_ADDRESS" = 'auto' ]; then - CASSANDRA_LISTEN_ADDRESS="$(_ip_address)" - fi - - : ${CASSANDRA_BROADCAST_ADDRESS="$CASSANDRA_LISTEN_ADDRESS"} - - if [ "$CASSANDRA_BROADCAST_ADDRESS" = 'auto' ]; then - CASSANDRA_BROADCAST_ADDRESS="$(_ip_address)" - fi - : ${CASSANDRA_BROADCAST_RPC_ADDRESS:=$CASSANDRA_BROADCAST_ADDRESS} - - if [ -n "${CASSANDRA_NAME:+1}" ]; then - : ${CASSANDRA_SEEDS:="cassandra"} - fi - : ${CASSANDRA_SEEDS:="$CASSANDRA_BROADCAST_ADDRESS"} - - sed -ri 's/(- seeds:).*/\1 "'"$CASSANDRA_SEEDS"'"/' "$CASSANDRA_CONFIG/cassandra.yaml" - - for yaml in \ - broadcast_address \ - broadcast_rpc_address \ - cluster_name \ - endpoint_snitch \ - listen_address \ - num_tokens \ - rpc_address \ - start_rpc \ - ; do - var="CASSANDRA_${yaml^^}" - val="${!var}" - if [ "$val" ]; then - sed -ri 's/^(# )?('"$yaml"':).*/\2 '"$val"'/' "$CASSANDRA_CONFIG/cassandra.yaml" - fi - done - - for rackdc in dc rack; do - var="CASSANDRA_${rackdc^^}" - val="${!var}" - if [ "$val" ]; then - sed -ri 's/^('"$rackdc"'=).*/\1 '"$val"'/' "$CASSANDRA_CONFIG/cassandra-rackdc.properties" - fi - done -fi - -for f in /docker-entrypoint-initdb.d/*; do - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *.cql) echo "$0: running $f" && until cqlsh -f "$f"; do >&2 echo "Cassandra is unavailable - sleeping"; sleep 2; done & ;; - *) echo "$0: ignoring $f" ;; - esac - echo -done - -exec "$@" diff --git a/docker/solr/Dockerfile b/docker/solr/Dockerfile index e7cd99d..edcaa7b 100644 --- a/docker/solr/Dockerfile +++ b/docker/solr/Dockerfile @@ -12,24 +12,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -FROM solr:7.4 -MAINTAINER Apache SDAP "[email protected]" +FROM solr:8.4.0 USER root -ENV SOLR_HOME=/opt/solr/server/solr - -RUN cd / && \ - apt-get update && \ - apt-get -y install git sudo && \ - rm -rf /var/lib/apt/lists/* && \ - git clone https://github.com/apache/incubator-sdap-nexus.git && \ - cp -r /incubator-sdap-nexus/data-access/config/schemas/solr/nexustiles /tmp/nexustiles && \ - rm -rf /incubator-sdap-nexus && \ - wget http://central.maven.org/maven2/org/locationtech/jts/jts-core/1.15.1/jts-core-1.15.1.jar && \ - cp jts-core-1.15.1.jar /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/jts-core-1.15.1.jar && \ - chown ${SOLR_USER}:${SOLR_GROUP} /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/jts-core-1.15.1.jar && \ - rm jts-core-1.15.1.jar - - -USER ${SOLR_USER} +RUN wget https://repo1.maven.org/maven2/org/locationtech/jts/jts-core/1.17.1/jts-core-1.17.1.jar && \ + cp jts-core-1.17.1.jar /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/jts-core-1.17.1.jar +ENTRYPOINT ["docker-entrypoint.sh"] +CMD ["solr-foreground"] \ No newline at end of file diff --git a/docker/solr/cloud-init/create-collection.py b/docker/solr/cloud-init/create-collection.py index f8f98bc..eb77d00 100755 --- a/docker/solr/cloud-init/create-collection.py +++ b/docker/solr/cloud-init/create-collection.py @@ -34,12 +34,14 @@ ZK_LOCK_GUID = os.environ["ZK_LOCK_GUID"] MINIMUM_NODES = int(os.environ["MINIMUM_NODES"]) CREATE_COLLECTION_PARAMS = os.environ["CREATE_COLLECTION_PARAMS"] + def get_cluster_status(): try: return requests.get("{}admin/collections?action=CLUSTERSTATUS".format(SDAP_SOLR_URL)).json() except (requests.exceptions.ConnectionError, json.decoder.JSONDecodeError): return False + logging.info("Attempting to aquire lock from {}".format(SDAP_ZK_SOLR)) zk_host, zk_chroot = SDAP_ZK_SOLR.split('/') zk = KazooClient(hosts=zk_host) @@ -101,6 +103,39 @@ try: else: # Some error occured while creating the collection raise RuntimeError("Could not create collection. Received response: {}".format(create_response)) + + schema_api = "{}nexustiles/schema".format(SDAP_SOLR_URL) + + field_type_payload = json.dumps({ + "add-field-type": { + "name": "geo", + "class": "solr.SpatialRecursivePrefixTreeFieldType", + "geo": "true", + "precisionModel": "fixed", + "maxDistErr": "0.000009", + "spatialContextFactory": "com.spatial4j.core.context.jts.JtsSpatialContextFactory", + "precisionScale": "1000", + "distErrPct": "0.025", + "distanceUnits": "degrees"}}) + + logging.info("Creating field-type 'geo'...") + field_type_response = requests.post(url=schema_api, data=field_type_payload) + if field_type_response.status_code < 400: + logging.info("Success.") + else: + logging.error("Error creating field type 'geo': {}".format(field_type_response.text)) + + field_payload = json.dumps({ + "add-field": { + "name": "geo", + "type": "geo"}}) + logging.info("Creating field 'geo'...") + field_response = requests.post(url=schema_api, data=field_payload) + if field_response.status_code < 400: + logging.info("Success.") + else: + logging.error("Error creating field 'geo': {}".format(field_response.text)) + finally: zk.stop() zk.close() diff --git a/docker/solr/cloud/Dockerfile b/docker/solr/cloud/Dockerfile deleted file mode 100644 index 79dfdd1..0000000 --- a/docker/solr/cloud/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -ARG tag_version=latest -FROM sdap/solr:${tag_version} -MAINTAINER Apache SDAP "[email protected]" - -ENV SDAP_ZK_SERVICE_HOST="localhost" \ - SDAP_ZK_SERVICE_PORT="2181" \ - SDAP_ZK_SOLR_CHROOT="solr" \ - SOLR_HOST="localhost" - -COPY ./cloud/docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/ -COPY ./cloud/tmp/* /tmp/ - -# This will run docker-entrypoint.sh with the value of CMD as default arguments. However, if any arguments are supplied -# to the docker run command when launching this image, the command line arguments will override these CMD arguments -ENTRYPOINT ["/bin/bash", "-c", "docker-entrypoint.sh $(eval echo $@)", "$@"] -CMD ["solr-foreground", "-c", "-z ${SDAP_ZK_SERVICE_HOST}:${SDAP_ZK_SERVICE_PORT}/${SDAP_ZK_SOLR_CHROOT}"] diff --git a/docker/solr/cloud/Readme.rst b/docker/solr/cloud/Readme.rst deleted file mode 100644 index ae71a2e..0000000 --- a/docker/solr/cloud/Readme.rst +++ /dev/null @@ -1,93 +0,0 @@ -.. _solr_cloud: - -sdap/solr-cloud --------------------- - -This image runs SolrCloud. - -How To Build -^^^^^^^^^^^^ - -This image can be built from the incubator/sdap/solr directory: - -.. code-block:: bash - - docker build -t sdap/solr-cloud:${BUILD_VERSION} -f cloud/Dockerfile --build-arg tag_version=${BUILD_VERSION} . - -How to Run -^^^^^^^^^^ - -This Docker container runs Apache Solr v7.4 in cloud mode with the nexustiles collection. It requires a running Zookeeper service in order to work. It will automatically bootstrap Zookeeper by uploading configuration and core properties to Zookeeper when it starts. - -It is necessary to decide wether or not you want data to persist when the container is stopped or if the data should be discarded. - -.. note:: - - There are multiple times that ``host.docker.internal`` is used in the example ``docker run`` commands provided below. This is a special DNS name that is known to work on Docker for Mac for `connecting from a container to a service on the host <https://docs.docker.com/docker-for-mac/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host>`_. If you are not launching the container with Docker for Mac, there is no guarantee that this DNS name will be resolvable inside the [...] - -Cloud Specific Environment Variables -"""""""""""""""""""""""""""""""""""" - -``SDAP_ZK_SERVICE_HOST`` - *default: localhost* - - This is the hostname of the Zookeeper service that Solr should use to connect. - -``SDAP_ZK_SERVICE_PORT`` - *default: 2181* - - The port Solr should try to connect to Zookeeper with. - -``SDAP_ZK_SOLR_CHROOT`` - *default: solr* - - The Zookeeper chroot under which Solr configuration will be accessed. - -``SOLR_HOST`` - *default: localhost* - - The hostname of the Solr instance that will be recored in Zookeeper. - -Zookeeper -"""""""""""" - -Zookeeper can be running on the host machine or anywhere that docker can access (e.g. a bridge network). Take note of the host where Zookeeper is running and use that value for the ``SDAP_ZK_SERVICE_HOST`` environment variable. - - -Persist Data -"""""""""""""""" - -To persist the data, we need to provide a volume mount from the host machine to the container path where the collection data is stored. By default, collection data is stored in the location indicated by the ``$SOLR_HOME`` environment variable. If you do not provide a custom ``SOLR_HOME`` location, the default is ``/opt/solr/server/solr``. - -Assuming Zookeeper is running on the host machine port 2181, the easiest way to run this image and persist data to a location on the host machine is: - -.. code-block:: bash - - docker run --name solr -v ${PWD}/solrhome:/opt/solr/server/solr -p 8983:8983 -d -e SDAP_ZK_SERVICE_HOST="host.docker.internal" -e SOLR_HOST="host.docker.internal" sdap/solr-cloud:${VERSION} - -``${PWD}/solrhome`` is the directory on host machine where ``SOLR_HOME`` will be created if it does not already exist. - -Don't Persist Data -"""""""""""""""""" - -If you do not need to persist data between runs of this image, just simply run the image without a volume mount. - -Assuming Zookeeper is running on the host machine port 2181, the easiest way to run this image without persisting data is: - -.. code-block:: bash - - docker run --name solr -p 8983:8983 -d -e SDAP_ZK_SERVICE_HOST="host.docker.internal" -e SOLR_HOST="host.docker.internal" sdap/solr-cloud:${VERSION} - -When the container is removed, the data will be lost. - -Collection Initialization -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Solr Collections must be created after at least one SolrCloud node is live. When a collection is created, by default Solr will attempt to spread the shards across all of the live nodes at the time of creation. This poses two problems - -1) The nexustiles collection can not be created during a "bootstrapping" process in this image. -2) The nexustiles collection should not be created until an appropriate amount of nodes are live. - -A helper container has been created to deal with these issues. See :ref:`solr_cloud_init` for more details. - -The other option is to create the collection manually after starting as many SolrCloud nodes as desired. This can be done through the Solr Admin UI or by utilizing the `admin collections API <http://lucene.apache.org/solr/guide/7_4/collections-api.html#collections-api>`_. diff --git a/docker/solr/cloud/docker-entrypoint-initdb.d/0-init-home.sh b/docker/solr/cloud/docker-entrypoint-initdb.d/0-init-home.sh deleted file mode 100755 index 149c660..0000000 --- a/docker/solr/cloud/docker-entrypoint-initdb.d/0-init-home.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -if [ ! -f ${SOLR_HOME}/solr.xml ]; then - cp /tmp/solr.xml ${SOLR_HOME} -fi - -if [ ! -f ${SOLR_HOME}/zoo.cfg ]; then - cp /tmp/zoo.cfg ${SOLR_HOME} -fi diff --git a/docker/solr/cloud/docker-entrypoint-initdb.d/1-bootstrap-zk.sh b/docker/solr/cloud/docker-entrypoint-initdb.d/1-bootstrap-zk.sh deleted file mode 100755 index cbabbda..0000000 --- a/docker/solr/cloud/docker-entrypoint-initdb.d/1-bootstrap-zk.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -ZK_HOST="${SDAP_ZK_SERVICE_HOST}:${SDAP_ZK_SERVICE_PORT}/${SDAP_ZK_SOLR_CHROOT}" - -./bin/solr zk upconfig -z ${ZK_HOST} -n nexustiles -d /tmp/nexustiles -./bin/solr zk cp -z ${ZK_HOST} ${SOLR_HOME}/solr.xml zk:/solr.xml diff --git a/docker/solr/cloud/tmp/solr.xml b/docker/solr/cloud/tmp/solr.xml deleted file mode 100644 index 4a79fe2..0000000 --- a/docker/solr/cloud/tmp/solr.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!-- - This is an example of a simple "solr.xml" file for configuring one or - more Solr Cores, as well as allowing Cores to be added, removed, and - reloaded via HTTP requests. - - More information about options available in this configuration file, - and Solr Core administration can be found online: - http://wiki.apache.org/solr/CoreAdmin ---> - -<solr> - - <solrcloud> - - <str name="host">${host:}</str> - <int name="hostPort">${jetty.port:8983}</int> - <str name="hostContext">${hostContext:solr}</str> - - <bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool> - - <int name="zkClientTimeout">${zkClientTimeout:30000}</int> - <int name="distribUpdateSoTimeout">${distribUpdateSoTimeout:600000}</int> - <int name="distribUpdateConnTimeout">${distribUpdateConnTimeout:60000}</int> - <str name="zkCredentialsProvider">${zkCredentialsProvider:org.apache.solr.common.cloud.DefaultZkCredentialsProvider}</str> - <str name="zkACLProvider">${zkACLProvider:org.apache.solr.common.cloud.DefaultZkACLProvider}</str> - - </solrcloud> - - <shardHandlerFactory name="shardHandlerFactory" - class="HttpShardHandlerFactory"> - <int name="socketTimeout">${socketTimeout:600000}</int> - <int name="connTimeout">${connTimeout:60000}</int> - </shardHandlerFactory> - -</solr> diff --git a/docker/solr/cloud/tmp/zoo.cfg b/docker/solr/cloud/tmp/zoo.cfg deleted file mode 100644 index 7e42d8c..0000000 --- a/docker/solr/cloud/tmp/zoo.cfg +++ /dev/null @@ -1,31 +0,0 @@ -# The number of milliseconds of each tick -tickTime=2000 -# The number of ticks that the initial -# synchronization phase can take -initLimit=10 -# The number of ticks that can pass between -# sending a request and getting an acknowledgement -syncLimit=5 - -# the directory where the snapshot is stored. -# dataDir=/opt/zookeeper/data -# NOTE: Solr defaults the dataDir to <solrHome>/zoo_data - -# the port at which the clients will connect -# clientPort=2181 -# NOTE: Solr sets this based on zkRun / zkHost params - -# the maximum number of client connections. -# increase this if you need to handle more clients -#maxClientCnxns=60 -# -# Be sure to read the maintenance section of the -# administrator guide before turning on autopurge. -# -# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance -# -# The number of snapshots to retain in dataDir -#autopurge.snapRetainCount=3 -# Purge task interval in hours -# Set to "0" to disable auto purge feature -#autopurge.purgeInterval=1 diff --git a/docker/solr/singlenode/Dockerfile b/docker/solr/singlenode/Dockerfile deleted file mode 100644 index 10021e0..0000000 --- a/docker/solr/singlenode/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -ARG tag_version=latest -FROM sdap/solr:${tag_version} -MAINTAINER Apache SDAP "[email protected]" - -USER root - -RUN echo "${SOLR_USER} ALL=(ALL) NOPASSWD: /usr/bin/cp -r /tmp/nexustiles/* ${SOLR_HOME}/nexustiles/" >> /etc/sudoers && \ - echo "${SOLR_USER} ALL=(ALL) NOPASSWD: /usr/bin/chown -R ${SOLR_USER}\:${SOLR_GROUP} ${SOLR_HOME}/nexustiles" >> /etc/sudoers - -COPY ./singlenode/create-core.sh /docker-entrypoint-initdb.d/0-create-core.sh - -USER ${SOLR_USER} -VOLUME ${SOLR_HOME}/nexustiles - -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["solr-foreground"] diff --git a/docker/solr/singlenode/Readme.rst b/docker/solr/singlenode/Readme.rst deleted file mode 100644 index 0f814f2..0000000 --- a/docker/solr/singlenode/Readme.rst +++ /dev/null @@ -1,42 +0,0 @@ -.. _solr_singlenode: - -sdap/solr-singlenode --------------------- - -This is the singlenode version of Solr. - -How To Build -^^^^^^^^^^^^ - -This image can be built from the incubator/sdap/solr directory: - -.. code-block:: bash - - docker build -t sdap/solr-singlenode:${BUILD_VERSION} -f singlenode/Dockerfile --build-arg tag_version=${BUILD_VERSION} . - -How to Run -^^^^^^^^^^ - -This Docker container runs Apache Solr v7.4 as a single node with the nexustiles collection. The main decision when running this image is wether or not you want data to persist when the container is stopped or if the data should be discarded. - -Persist Data -"""""""""""" - -To persist the data in the ``nexustiles`` collection, we need to provide a volume mount from the host machine to the container path where the collection data is stored. By default, collection data is stored in the location indicated by the ``$SOLR_HOME`` environment variable. If you do not provide a custom ``SOLR_HOME`` location, the default is ``/opt/solr/server/solr``. Therefore, the easiest way to run this image and persist data to a location on the host machine is: - -.. code-block:: bash - - docker run --name solr -v ${PWD}/solrhome/nexustiles:/opt/solr/server/solr/nexustiles -p 8083:8083 -d sdap/solr-singlenode:${BUILD_VERSION} - -``${PWD}/solrhome/nexustiles`` is the directory on host machine where the ``nexustiles`` collection will be created if it does not already exist. If you have run this container before and ``${PWD}/solrhome/nexustiles`` already contains files, those files will *not* be overwritten. In this way, it is possible to retain data on the host machine between runs of this docker image. - -Don't Persist Data -"""""""""""""""""" - -If you do not need to persist data between runs of this image, just simply run the image without a volume mount. - -.. code-block:: bash - - docker run --name solr -p 8083:8083 -d sdap/solr-singlenode:${BUILD_VERSION} - -When the container is removed, the data will be lost. diff --git a/docker/solr/singlenode/create-core.sh b/docker/solr/singlenode/create-core.sh deleted file mode 100755 index a2f6e38..0000000 --- a/docker/solr/singlenode/create-core.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -SOLR_HOME=${SOLR_HOME:=/opt/solr/server/solr/} -mkdir -p ${SOLR_HOME}/nexustiles -sudo cp -r /tmp/nexustiles/* ${SOLR_HOME}/nexustiles/ -sudo chown -R ${SOLR_USER}:${SOLR_GROUP} ${SOLR_HOME}/nexustiles - -set +x
