SOLR change shared.properties in Docker image

cancel
Showing results for 
Search instead for 
Did you mean: 
ajeje93
Active Member II

SOLR change shared.properties in Docker image

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

3 Replies
ajeje93
Active Member II

Re: SOLR change shared.properties in Docker image

In the end I created a configmap in Kubernetes and mounted it as a volume to override the configuration. Howevere, I would like to know anyways how to perform this operation because it can be useful when starting Alfresco using Docker Compose.

jelenajjovanosk
Active Member

Re: SOLR change shared.properties in Docker image

Hi, 

I want to configure alfresco.cron SOLR property in my docker-compose.yml file within SOLR_OPTS. And I try to do that, like this:

ng-office-ass:
image: alfresco/alfresco-search-services:2.0.1
environment:
SOLR_ALFRESCO_HOST: ng-office-acs
SOLR_ALFRESCO_PORT: 8080
SOLR_SOLR_HOST: ng-office-ass
SOLR_SOLR_PORT: 8983
SOLR_CREATE_ALFRESCO_DEFAULTS: alfresco,archive
ALFRESCO_SECURE_COMMS: none
SOLR_OPTS: "$SOLR_OPTS -Dalfresco.cron=0/2 * * * * ? *"
ports:
- "8983:8983"
volumes:
- ng-office-ass-volume:/opt/alfresco-search-services/contentstore
- ng-office-ass-volume:/opt/alfresco-search-services/data
depends_on:
- ng-office-acs

 But the result is the next error: 

ng-office-ass_1 | Error: Could not find or load main class contentstore
ng-office-ass_1 | Caused by: java.lang.ClassNotFoundException: contentstore

 

A also tried to add this property as a new "JAVA_OPTS" entry. I didn't get any error message, but after I checked solrcore. properties file in my ass container I can see that alfresco.cron property is the same.

 

I read all the documentation, and I cannot found how to configure solr properties(https://docs.alfresco.com/search-services/latest/config/properties/#solr-core-configuration-properti...) in the docker-comose.yml file.

angelborroy
Alfresco Employee

Re: SOLR change shared.properties in Docker image

You need to extend default Search Services Docker Image in order to add/modify the properties. Java Envs are not supported.

This is a sample on how to do that:

https://github.com/aborroy/alfresco-solr-docker-mtls/blob/master/search/Dockerfile#L17

Hyland Developer Evangelist