Fix and configure Solr persistent locations and configuration

This commit is contained in:
Disassembler 2017-12-13 13:42:28 +01:00
parent 3e123a9a9c
commit 0363e6b53f
4 changed files with 66 additions and 6 deletions

13
solr.sh
View File

@ -2,8 +2,15 @@
SOURCE_DIR=$(realpath $(dirname "${0}"))/solr
# Prepare Docker mount structure
mkdir -p /srv/solr/server/solr
# Build Docker container
docker build -t solr ${SOURCE_DIR}
# Configure Solr
mkdir -p /srv/solr/data
cp ${SOURCE_DIR}/srv/solr/data/solr.xml /srv/solr/data/solr.xml
# Configure Solr service
cp ${SOURCE_DIR}/lib/systemd/system/solr.service /lib/systemd/system/solr.service
systemctl daemon-reload
systemctl enable solr
systemctl start solr

View File

@ -9,7 +9,7 @@ RUN apk --no-cache add bash lsof \
&& mv /srv/solr-6.5.1 /srv/solr \
&& rm -f /tmp/solr-6.5.1.tgz \
&& addgroup -S solr \
&& adduser -S -h /srv/solr/data -s /bin/sh -g solr -G solr solr \
&& adduser -S -h /srv/solr -H -s /bin/sh -g solr -G solr solr \
&& chown -R solr:solr /srv/solr/ \
&& ln -s /srv/solr/bin/solr /usr/local/bin/solr

View File

@ -1,10 +1,10 @@
[Unit]
Description=OpenMapKit Solr container
Description=Solr Docker container
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/docker run --rm --tmpfs /tmp --name solr -v /srv/solr/server/solr:/srv/solr/server/solr solr
ExecStart=/usr/bin/docker run --rm --tmpfs /tmp --name solr -v /srv/solr/data:/srv/solr/server/solr solr
ExecStop=/usr/bin/docker stop solr
[Install]

View File

@ -0,0 +1,53 @@
<?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>