AnsweredAssumed Answered

SOLR change shared.properties in Docker image

Question asked by ajeje93 on Mar 1, 2019
Latest reply on Mar 1, 2019 by ajeje93

Hello everyone,

 

I am having trouble trying to change the SOLR 6 shared.properties file starting from the Docker image.

 

In particular I would like to enable the cross locale search, so I have my own Dockerfile where I replace the string "# alfresco.cross" with "alfresco.cross", so that it will be uncommented in the resulting file.

FROM alfresco/alfresco-search-services:1.3.0.1 
RUN mv /opt/alfresco-search-services/logs/log4j.properties /opt/alfresco-search-services/log4j.properties
RUN sed -i 's/LOG4J_PROPS=$SOLR_LOGS_DIR\/log4j.properties/LOG4J_PROPS=$SOLR_LOGS_DIR\/..\/log4j.properties/g' /opt/alfresco-search-services/solr.in.sh
RUN sed -i 's/# alfresco.cross/alfresco.cross/g' /opt/alfresco-search-services/solrhome/conf/shared.properties && cat /opt/alfresco-search-services/solrhome/conf/shared.properties 
RUN cat /opt/alfresco-search-services/solrhome/conf/shared.properties

Below the output that I get:

Sending build context to Docker daemon 2.56kB
Step 1/5 : FROM alfresco/alfresco-search-services:1.3.0.1
---> 910edf913574
Step 2/5 : RUN mv /opt/alfresco-search-services/logs/log4j.properties /opt/alfresco-search-services/log4j.properties
---> Running in 60dea36a9d5d
Removing intermediate container 60dea36a9d5d
---> f33fc3b1ba7a
Step 3/5 : RUN sed -i 's/LOG4J_PROPS=$SOLR_LOGS_DIR\/log4j.properties/LOG4J_PROPS=$SOLR_LOGS_DIR\/..\/log4j.properties/g' /opt/alfresco-search-services/solr.in.sh
---> Running in 27ff531c84e4
Removing intermediate container 27ff531c84e4
---> 4f6b7ce49037
Step 4/5 : RUN sed -i 's/# alfresco.cross/alfresco.cross/g' /opt/alfresco-search-services/solrhome/conf/shared.properties && cat /opt/alfresco-search-services/solrhome/conf/shared.properties
---> Running in 277f661cc083

# Shared Properties file

#Host details an external client would use to connect to Solr
solr.host=localhost
#If not set then solr.port will be the jetty.port
#solr.port=8983
solr.baseurl=/solr

# Properties treated as identifiers when indexed

alfresco.identifier.property.0={http://www.alfresco.org/model/content/1.0}creator
alfresco.identifier.property.1={http://www.alfresco.org/model/content/1.0}modifier
alfresco.identifier.property.2={http://www.alfresco.org/model/content/1.0}userName
alfresco.identifier.property.3={http://www.alfresco.org/model/content/1.0}authorityName
alfresco.identifier.property.4={http://www.alfresco.org/model/content/1.0}lockOwner

# Suggestable Propeties
#alfresco.suggestable.property.0={http://www.alfresco.org/model/content/1.0}name
#alfresco.suggestable.property.1={http://www.alfresco.org/model/content/1.0}title
#alfresco.suggestable.property.2={http://www.alfresco.org/model/content/1.0}description
#alfresco.suggestable.property.3={http://www.alfresco.org/model/content/1.0}content

# Data types that support cross locale/word splitting/token patterns if tokenised
alfresco.cross.locale.property.0={http://www.alfresco.org/model/content/1.0}name
alfresco.cross.locale.property.1={http://www.alfresco.org/model/content/1.0}lockOwner

# Data types that support cross locale/word splitting/token patterns if tokenised
alfresco.cross.locale.datatype.0={http://www.alfresco.org/model/dictionary/1.0}text
alfresco.cross.locale.datatype.1={http://www.alfresco.org/model/dictionary/1.0}content
alfresco.cross.locale.datatype.2={http://www.alfresco.org/model/dictionary/1.0}mltext

alfresco.model.tracker.cron=0/10 * * * * ? *Removing intermediate container 277f661cc083
---> 0fd2e2d0f296
Step 5/5 : RUN cat /opt/alfresco-search-services/solrhome/conf/shared.properties
---> Running in 9e905642f252

# Shared Properties file

#Host details an external client would use to connect to Solr
solr.host=localhost
#If not set then solr.port will be the jetty.port
#solr.port=8983
solr.baseurl=/solr

# Properties treated as identifiers when indexed

alfresco.identifier.property.0={http://www.alfresco.org/model/content/1.0}creator
alfresco.identifier.property.1={http://www.alfresco.org/model/content/1.0}modifier
alfresco.identifier.property.2={http://www.alfresco.org/model/content/1.0}userName
alfresco.identifier.property.3={http://www.alfresco.org/model/content/1.0}authorityName
alfresco.identifier.property.4={http://www.alfresco.org/model/content/1.0}lockOwner

# Suggestable Propeties
#alfresco.suggestable.property.0={http://www.alfresco.org/model/content/1.0}name
#alfresco.suggestable.property.1={http://www.alfresco.org/model/content/1.0}title
#alfresco.suggestable.property.2={http://www.alfresco.org/model/content/1.0}description
#alfresco.suggestable.property.3={http://www.alfresco.org/model/content/1.0}content

# Data types that support cross locale/word splitting/token patterns if tokenised
alfresco.cross.locale.property.0={http://www.alfresco.org/model/content/1.0}name
alfresco.cross.locale.property.1={http://www.alfresco.org/model/content/1.0}lockOwner

# Data types that support cross locale/word splitting/token patterns if tokenised
# alfresco.cross.locale.datatype.0={http://www.alfresco.org/model/dictionary/1.0}text
# alfresco.cross.locale.datatype.1={http://www.alfresco.org/model/dictionary/1.0}content
# alfresco.cross.locale.datatype.2={http://www.alfresco.org/model/dictionary/1.0}mltext

alfresco.model.tracker.cron=0/10 * * * * ? *Removing intermediate container 9e905642f252
---> 6b48062689fa
Successfully built 6b48062689fa
Successfully tagged custom-solr:1.3.0.1

As you can see when I run the "cat" the first time the properties get uncommented, but when I run it a second time the file hasn't changed.

 

What am I doing wrong? 

Can I pass these properties to the SOLR_OPTS instead, so that I can leave the shared.properties unchanged?

 

Thank you in advance.

 

Ludovico

Outcomes