[Solr] Change default configset before bootstrapping
[Solr] Bootstrap cannot be omitted and must occur before mounting the data directorymaster
parent
884c7fade1
commit
fc63661fbd
|
@ -1,8 +1,12 @@
|
||||||
FROM solr:7.7-alpine
|
FROM solr:7.7-alpine
|
||||||
USER root
|
USER root
|
||||||
COPY docker-entrypoint.sh /
|
COPY docker-entrypoint.sh /
|
||||||
|
COPY solr-config-7.7.0.xml /
|
||||||
|
COPY solr-schema-7.7.0.xml /
|
||||||
|
|
||||||
|
|
||||||
RUN apk --no-cache add su-exec curl tzdata \
|
RUN apk --no-cache add su-exec curl tzdata \
|
||||||
&& chmod +x /docker-entrypoint.sh
|
&& chmod +x /docker-entrypoint.sh \
|
||||||
|
&& bash /docker-entrypoint.sh --bootstrap
|
||||||
|
|
||||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
|
|
@ -18,16 +18,10 @@ fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# allow easier debugging with `docker run -e VERBOSE=yes`
|
|
||||||
if [[ "$VERBOSE" = "yes" ]]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
|
|
||||||
# run the optional initdb
|
# run the optional initdb
|
||||||
. /opt/docker-solr/scripts/run-initdb
|
. /opt/docker-solr/scripts/run-initdb
|
||||||
|
|
||||||
# fixing volume permission
|
# fixing volume permission
|
||||||
|
|
||||||
[[ -d /opt/solr/server/solr/dovecot-fts/data ]] && chown -R solr:solr /opt/solr/server/solr/dovecot-fts/data
|
[[ -d /opt/solr/server/solr/dovecot-fts/data ]] && chown -R solr:solr /opt/solr/server/solr/dovecot-fts/data
|
||||||
if [[ "${1}" != "--bootstrap" ]]; then
|
if [[ "${1}" != "--bootstrap" ]]; then
|
||||||
sed -i '/SOLR_HEAP=/c\SOLR_HEAP="'${SOLR_HEAP:-1024}'m"' /opt/solr/bin/solr.in.sh
|
sed -i '/SOLR_HEAP=/c\SOLR_HEAP="'${SOLR_HEAP:-1024}'m"' /opt/solr/bin/solr.in.sh
|
||||||
|
@ -35,15 +29,13 @@ else
|
||||||
sed -i '/SOLR_HEAP=/c\SOLR_HEAP="256m"' /opt/solr/bin/solr.in.sh
|
sed -i '/SOLR_HEAP=/c\SOLR_HEAP="256m"' /opt/solr/bin/solr.in.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# keep a sentinel file so we don't try to create the core a second time
|
if [[ "${1}" == "--bootstrap" ]]; then
|
||||||
# for example when we restart a container.
|
echo "Creating initial configuration"
|
||||||
# todo: check if a core exists without sentinel file
|
echo "Modifying default config set"
|
||||||
|
cp /solr-config-7.7.0.xml /opt/solr/server/solr/configsets/_default/conf/solrconfig.xml
|
||||||
|
cp /solr-schema-7.7.0.xml /opt/solr/server/solr/configsets/_default/conf/schema.xml
|
||||||
|
rm /opt/solr/server/solr/configsets/_default/conf/managed-schema
|
||||||
|
|
||||||
SENTINEL=/opt/docker-solr/fts_core_created
|
|
||||||
|
|
||||||
if [[ -f ${SENTINEL} ]]; then
|
|
||||||
echo "skipping core creation"
|
|
||||||
else
|
|
||||||
echo "Starting local Solr instance to setup configuration"
|
echo "Starting local Solr instance to setup configuration"
|
||||||
su-exec solr start-local-solr
|
su-exec solr start-local-solr
|
||||||
|
|
||||||
|
@ -58,19 +50,12 @@ else
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Created core \"dovecot-fts\""
|
echo "Created core \"dovecot-fts\""
|
||||||
touch ${SENTINEL}
|
|
||||||
|
|
||||||
echo "Stopping local Solr"
|
echo "Stopping local Solr"
|
||||||
su-exec solr stop-local-solr
|
su-exec solr stop-local-solr
|
||||||
|
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f /opt/solr/server/solr/dovecot-fts/conf/schema.xml
|
|
||||||
rm -f /opt/solr/server/solr/dovecot-fts/conf/managed-schema
|
|
||||||
rm -f /opt/solr/server/solr/dovecot-fts/conf/solrconfig.xml
|
|
||||||
|
|
||||||
cp /etc/solr/solr-config-7.7.0.xml /opt/solr/server/solr/dovecot-fts/conf/solrconfig.xml
|
|
||||||
cp /etc/solr/solr-schema-7.7.0.xml /opt/solr/server/solr/dovecot-fts/conf/schema.xml
|
|
||||||
|
|
||||||
chown -R solr:solr /opt/solr/server/solr/dovecot-fts/conf/{schema.xml,solrconfig.xml}
|
|
||||||
|
|
||||||
exec su-exec solr solr-foreground
|
exec su-exec solr solr-foreground
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<schema name="dovecot" version="2.0">
|
<schema name="dovecot-fts" version="2.0">
|
||||||
<fieldType name="string" class="solr.StrField" omitNorms="true" sortMissingLast="true"/>
|
<fieldType name="string" class="solr.StrField" omitNorms="true" sortMissingLast="true"/>
|
||||||
<fieldType name="long" class="solr.LongPointField" positionIncrementGap="0"/>
|
<fieldType name="long" class="solr.LongPointField" positionIncrementGap="0"/>
|
||||||
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
|
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
|
||||||
|
@ -18,6 +18,7 @@
|
||||||
</analyzer>
|
</analyzer>
|
||||||
<analyzer type="query">
|
<analyzer type="query">
|
||||||
<tokenizer class="solr.StandardTokenizerFactory"/>
|
<tokenizer class="solr.StandardTokenizerFactory"/>
|
||||||
|
<filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="20"/>
|
||||||
<filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
|
<filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
|
||||||
<filter class="solr.FlattenGraphFilterFactory"/>
|
<filter class="solr.FlattenGraphFilterFactory"/>
|
||||||
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
|
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
|
Loading…
Reference in New Issue