Skip to content

Commit

Permalink
add replication support through entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
alxgomz committed Sep 30, 2024
1 parent e02450a commit aeb48c8
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions search/service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,27 @@ USER root

COPY distribution /tmp/

RUN yum install -y unzip && \
RUN yum install -y xmlstarlet unzip && \
unzip /tmp/*.zip -d $(dirname ${ALFRESCO_SOLR_DIST_DIR}) && \
mkdir -p ${ALFRESCO_SOLR_DIST_DIR}/data && \
mv ${ALFRESCO_SOLR_DIST_DIR}/solrhome/alfrescoModels ${ALFRESCO_SOLR_DIST_DIR}/data/
mv ${ALFRESCO_SOLR_DIST_DIR}/solrhome/alfrescoModels ${ALFRESCO_SOLR_DIST_DIR}/data/ && \
for i in ${ALFRESCO_SOLR_DIST_DIR}/solrhome/templates/*/conf/solrconfig.xml; do \
xmlstarlet ed -L \
-d '//comment()' \
-s '/config/requestHandler[@name="/replication"]' -t elem -n lst \
-a '/config/requestHandler[@name="/replication"]/lst[last()]' -t attr -n name -v '${solr.replication.master.role:notMaster}' \
-s '/config/requestHandler[@name="/replication"]/lst[last()]' -t elem -n str -v '${solr.replication.replicate.after:commit,startup}' \
-a '/config/requestHandler[@name="/replication"]/lst[last()]/str[last()]' -t attr -n name -v replicateAfter \
-s '/config/requestHandler[@name="/replication"]/lst[last()]' -t elem -n str -v '${solr.replication.conf.files:schema.xml,stopwords.txt}' \
-a '/config/requestHandler[@name="/replication"]/lst[last()]/str[last()]' -t attr -n name -v confFiles \
-s '/config/requestHandler[@name="/replication"]' -t elem -n 'lst' \
-a '/config/requestHandler[@name="/replication"]/lst[last()]' -t attr -n name -v '${solr.replication.slave.role:notSlave}' \
-s '/config/requestHandler[@name="/replication"]/lst[last()]' -t elem -n str -v '${solr.replication.master.url:https://primary.domain.tld/solr/corename/replication}' \
-a '/config/requestHandler[@name="/replication"]/lst[last()]/str[last()]' -t attr -n name -v masterUrl \
-s '/config/requestHandler[@name="/replication"]/lst[last()]' -t elem -n str -v '${solr.replication.poll.interval:00:00:30}' \
-a '/config/requestHandler[@name="/replication"]/lst[last()]/str[last()]' -t attr -n name -v pollInterval \
$i; \
done

FROM java_base AS solr-rhlike

Expand All @@ -23,16 +40,22 @@ ARG ALFRESCO_SOLR_GROUP_NAME
ARG ALFRESCO_SOLR_DIST_DIR

ENV ALFRESCO_SOLR_DIST_DIR=${ALFRESCO_SOLR_DIST_DIR}

COPY --chown=:${ALFRESCO_SOLR_GROUP_ID} --from=solr_build ${ALFRESCO_SOLR_DIST_DIR} ${ALFRESCO_SOLR_DIST_DIR}
ENV ALFRESCO_TEMPLATE=rerank

USER root

COPY --chown=:${ALFRESCO_SOLR_GROUP_ID} --from=solr_build ${ALFRESCO_SOLR_DIST_DIR} ${ALFRESCO_SOLR_DIST_DIR}
COPY entrypoint.sh /

WORKDIR ${ALFRESCO_SOLR_DIST_DIR}

RUN groupadd -g ${ALFRESCO_SOLR_GROUP_ID} ${ALFRESCO_SOLR_GROUP_NAME} && \
useradd -u ${ALFRESCO_SOLR_USER_ID} -g ${ALFRESCO_SOLR_GROUP_NAME} ${ALFRESCO_SOLR_USER_NAME} && \
chmod g+w -R {logs,data,solrhome}
yum install gettext -y && \
yum clean all && \
rm -rf /var/cache/yum && \
chmod g+w -R {logs,data,solrhome} && \
chmod +x /entrypoint.sh


VOLUME ["${ALFRESCO_SOLR_DIST_DIR}/data","${ALFRESCO_SOLR_DIST_DIR}/solrhome","${ALFRESCO_SOLR_DIST_DIR}/keystores"]
Expand All @@ -41,4 +64,4 @@ EXPOSE 8983

USER ${ALFRESCO_SOLR_USER_NAME}

CMD ["./solr/bin/solr","start","-f"]
CMD ["/entrypoint.sh"]

0 comments on commit aeb48c8

Please sign in to comment.