From 355a88afb3075a19c0fa4cd6768c8fb245c6b982 Mon Sep 17 00:00:00 2001 From: Harald von Waldow Date: Thu, 29 Aug 2019 17:25:11 +0200 Subject: [PATCH 1/6] mount whole ../data directory as named volume --- docker-compose.dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 3a3e7bbe..5818a3f6 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -44,7 +44,7 @@ services: ports: - "8983:8983" volumes: - - solr_data:/opt/solr/server/solr/ckan/data/index + - solr_data:/opt/solr/server/solr/ckan/data/ redis: container_name: redis From 94a26a0df10f5b518f5960802d931a5b3df15f2b Mon Sep 17 00:00:00 2001 From: Harald von Waldow Date: Thu, 29 Aug 2019 17:30:20 +0200 Subject: [PATCH 2/6] Update to Solr 6.6.6, sanitized Dockerfile, build image with Java Topology Suite --- solr/Dockerfile | 49 ++++++++++++++++++++++++--------------------- solr/solrconfig.xml | 4 +++- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/solr/Dockerfile b/solr/Dockerfile index 5105c7f1..277d0c90 100644 --- a/solr/Dockerfile +++ b/solr/Dockerfile @@ -1,29 +1,32 @@ -FROM solr:6.2-alpine -MAINTAINER Open Knowledge +FROM debian:buster-slim AS jts -# Enviroment -ENV SOLR_CORE ckan -ENV CKAN_VERSION dev-v2.7 +RUN apt-get update && apt-get install -qq -y libjts-java + +FROM solr:6.6-slim + +MAINTAINER Open Knowledge International + +# Environment +ARG SOLR_CORE=ckan +ENV SOLR_HOME=/opt/solr/server/solr -# User USER root -# Create Directories -RUN mkdir -p /opt/solr/server/solr/$SOLR_CORE/conf -RUN mkdir -p /opt/solr/server/solr/$SOLR_CORE/data +# Install JTS Topology Suite +COPY --from=jts /usr/share/java/jts-core.jar /opt/solr/server/solr-webapp/webapp/WEB-INF/lib -# Adding Files +WORKDIR $SOLR_HOME +# Create core and deafult config +RUN precreate-core $SOLR_CORE $SOLR_HOME/configsets/basic_configs && \ + rm $SOLR_CORE/conf/managed-schema && \ + mkdir $SOLR_CORE/data + +# Add CKAN custom config ADD solrconfig.xml \ -https://raw.githubusercontent.com/ckan/ckan/$CKAN_VERSION/ckan/config/solr/schema.xml \ -https://raw.githubusercontent.com/apache/lucene-solr/releases/lucene-solr/6.0.0/solr/server/solr/configsets/basic_configs/conf/currency.xml \ -https://raw.githubusercontent.com/apache/lucene-solr/releases/lucene-solr/6.0.0/solr/server/solr/configsets/basic_configs/conf/synonyms.txt \ -https://raw.githubusercontent.com/apache/lucene-solr/releases/lucene-solr/6.0.0/solr/server/solr/configsets/basic_configs/conf/stopwords.txt \ -https://raw.githubusercontent.com/apache/lucene-solr/releases/lucene-solr/6.0.0/solr/server/solr/configsets/basic_configs/conf/protwords.txt \ -https://raw.githubusercontent.com/apache/lucene-solr/releases/lucene-solr/6.0.0/solr/server/solr/configsets/data_driven_schema_configs/conf/elevate.xml \ -/opt/solr/server/solr/$SOLR_CORE/conf/ - -# Create Core.properties -RUN echo name=$SOLR_CORE > /opt/solr/server/solr/$SOLR_CORE/core.properties - -# Giving ownership to Solr -RUN chown -R $SOLR_USER:$SOLR_USER /opt/solr/server/solr/$SOLR_CORE + schema.xml \ + $SOLR_CORE/conf/ + +# Give ownership to Solr +RUN chown -R $SOLR_USER:$SOLR_USER $SOLR_CORE + +USER solr:solr diff --git a/solr/solrconfig.xml b/solr/solrconfig.xml index 9ac620c2..a7905c5a 100644 --- a/solr/solrconfig.xml +++ b/solr/solrconfig.xml @@ -3,7 +3,7 @@ - 6.0.0 + 6.6.6 @@ -110,6 +110,7 @@ + From b1fc837f346874a24473b08e2b7c5a0686d603f5 Mon Sep 17 00:00:00 2001 From: Harald von Waldow Date: Thu, 29 Aug 2019 17:32:43 +0200 Subject: [PATCH 3/6] added modified (for Solr 6.6 compatibility) schema.xml derived from schema.xml in CKAN 2.8 --- solr/schema.xml | 190 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 solr/schema.xml diff --git a/solr/schema.xml b/solr/schema.xml new file mode 100644 index 00000000..6817e382 --- /dev/null +++ b/solr/schema.xml @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +index_id + + + + + + + + + + + + + + + + + + + + + + + + + From d543dad0d21da9d2fd7de88b998501ceb9f7a027 Mon Sep 17 00:00:00 2001 From: Harald von Waldow Date: Fri, 30 Aug 2019 14:56:43 +0200 Subject: [PATCH 4/6] Install proper JTS - jar, deal with permission issue --- solr/Dockerfile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/solr/Dockerfile b/solr/Dockerfile index 277d0c90..6b54417a 100644 --- a/solr/Dockerfile +++ b/solr/Dockerfile @@ -1,7 +1,3 @@ -FROM debian:buster-slim AS jts - -RUN apt-get update && apt-get install -qq -y libjts-java - FROM solr:6.6-slim MAINTAINER Open Knowledge International @@ -10,10 +6,9 @@ MAINTAINER Open Knowledge International ARG SOLR_CORE=ckan ENV SOLR_HOME=/opt/solr/server/solr -USER root - # Install JTS Topology Suite -COPY --from=jts /usr/share/java/jts-core.jar /opt/solr/server/solr-webapp/webapp/WEB-INF/lib +ADD --chown=solr:solr https://repo1.maven.org/maven2/com/vividsolutions/jts-core/1.14.0/jts-core-1.14.0.jar \ + /opt/solr/server/solr-webapp/webapp/WEB-INF/lib WORKDIR $SOLR_HOME # Create core and deafult config @@ -27,6 +22,7 @@ ADD solrconfig.xml \ $SOLR_CORE/conf/ # Give ownership to Solr +USER root RUN chown -R $SOLR_USER:$SOLR_USER $SOLR_CORE -USER solr:solr +USER $SOLR_USER:$SOLR_USER From 5f17e8a34e045353a5850d0d869455698ef00cab Mon Sep 17 00:00:00 2001 From: Harald von Waldow Date: Fri, 30 Aug 2019 15:00:42 +0200 Subject: [PATCH 5/6] Added FieldType and Field for ckanext-spatial backend 'solr-spatial-field' --- solr/schema.xml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/solr/schema.xml b/solr/schema.xml index 6817e382..2f12e64b 100644 --- a/solr/schema.xml +++ b/solr/schema.xml @@ -83,8 +83,17 @@ schema. In this case the version should be set to the next CKAN version number. - + + + + @@ -113,6 +122,9 @@ schema. In this case the version should be set to the next CKAN version number. + + + @@ -163,6 +175,8 @@ schema. In this case the version should be set to the next CKAN version number. index_id + + From 3f9ebc9bb181e57892207dc0998ade8b8399e05b Mon Sep 17 00:00:00 2001 From: Harald von Waldow Date: Fri, 30 Aug 2019 16:44:58 +0200 Subject: [PATCH 6/6] added default-operator and -field --- solr/solrconfig.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/solr/solrconfig.xml b/solr/solrconfig.xml index a7905c5a..960dd750 100644 --- a/solr/solrconfig.xml +++ b/solr/solrconfig.xml @@ -80,6 +80,8 @@ explicit 10 + text + AND @@ -90,6 +92,8 @@ explicit json true + text + AND