mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Adding SOLR Replication option for Enterprise and Community
This commit is contained in:
@@ -9,6 +9,7 @@ var banner = require('./banner')
|
||||
* - Plain HTTP communications
|
||||
* - TLS/SSL Mutual Authentication communications
|
||||
* - Sharding (dynamic)
|
||||
* - Clustering (master-slave)
|
||||
*/
|
||||
module.exports = class extends Generator {
|
||||
|
||||
@@ -40,6 +41,15 @@ module.exports = class extends Generator {
|
||||
choices: [ "http", "https" ],
|
||||
default: 'http'
|
||||
},
|
||||
{
|
||||
when: function (response) {
|
||||
return response.httpMode == 'http';
|
||||
},
|
||||
type: 'confirm',
|
||||
name: 'clustering',
|
||||
message: 'Would you like to use a SOLR Cluster (2 nodes in master-slave)?',
|
||||
default: false
|
||||
},
|
||||
// Enterprise only options
|
||||
{
|
||||
when: function (response) {
|
||||
@@ -62,7 +72,8 @@ module.exports = class extends Generator {
|
||||
},
|
||||
{
|
||||
when: function (response) {
|
||||
return response.alfrescoVersion == 'enterprise';
|
||||
return response.alfrescoVersion == 'enterprise' &&
|
||||
!response.clustering;
|
||||
},
|
||||
type: 'confirm',
|
||||
name: 'sharding',
|
||||
@@ -86,7 +97,9 @@ module.exports = class extends Generator {
|
||||
this.destinationPath('docker-compose.yml'),
|
||||
{ httpMode: this.props.httpMode,
|
||||
secureComms: (this.props.httpMode == 'http' ? 'none' : 'https'),
|
||||
alfrescoPort: (this.props.httpMode == 'http' ? '8080' : '8443')
|
||||
alfrescoPort: (this.props.httpMode == 'http' ? '8080' : '8443'),
|
||||
clustering: (this.props.clustering ? "true" : "false"),
|
||||
searchSolrHost: (this.props.clustering ? "solr6slave" : "solr6")
|
||||
}
|
||||
);
|
||||
|
||||
@@ -112,7 +125,9 @@ module.exports = class extends Generator {
|
||||
"alfresco-search-services"
|
||||
),
|
||||
zeppelin: (this.props.zeppelin ? "true" : "false"),
|
||||
sharding: (this.props.sharding ? "true" : "false")
|
||||
sharding: (this.props.sharding ? "true" : "false"),
|
||||
clustering: (this.props.clustering ? "true" : "false"),
|
||||
searchSolrHost: (this.props.clustering ? "solr6slave" : "solr6")
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -168,31 +183,36 @@ module.exports = class extends Generator {
|
||||
}
|
||||
}
|
||||
|
||||
// Copy replication configuration
|
||||
if (this.props.clustering) {
|
||||
this.fs.copyTpl(
|
||||
this.templatePath(this.props.acsVersion + '/replication-none'),
|
||||
this.destinationPath('replication-none'),
|
||||
{
|
||||
searchImage: (this.props.insightEngine ?
|
||||
"quay.io/alfresco/insight-engine" :
|
||||
"alfresco/alfresco-search-services"
|
||||
),
|
||||
searchPath: (this.props.insightEngine ?
|
||||
"alfresco-insight-engine" :
|
||||
"alfresco-search-services"
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// Copy sharding configuration
|
||||
if (this.props.sharding) {
|
||||
if (this.props.httpMode == 'https') {
|
||||
this.fs.copyTpl(
|
||||
this.templatePath(this.props.acsVersion + '/sharding-https'),
|
||||
this.destinationPath('sharding-https'),
|
||||
{
|
||||
searchImage: (this.props.insightEngine ?
|
||||
"quay.io/alfresco/insight-engine" :
|
||||
"alfresco/alfresco-search-services"
|
||||
)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
this.fs.copyTpl(
|
||||
this.templatePath(this.props.acsVersion + '/sharding-none'),
|
||||
this.destinationPath('sharding-none'),
|
||||
{
|
||||
searchImage: (this.props.insightEngine ?
|
||||
"quay.io/alfresco/insight-engine" :
|
||||
"alfresco/alfresco-search-services"
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
this.fs.copyTpl(
|
||||
this.templatePath(this.props.acsVersion + '/sharding-' + this.props.httpMode),
|
||||
this.destinationPath('sharding-' + this.props.httpMode),
|
||||
{
|
||||
searchImage: (this.props.insightEngine ?
|
||||
"quay.io/alfresco/insight-engine" :
|
||||
"alfresco/alfresco-search-services"
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+50
-1
@@ -27,7 +27,7 @@ services:
|
||||
-Ddb.username=alfresco
|
||||
-Ddb.password=alfresco
|
||||
-Ddb.url=jdbc:postgresql://postgres:5432/alfresco
|
||||
-Dsolr.host=solr6
|
||||
-Dsolr.host=<%=searchSolrHost%>
|
||||
-Dsolr.port.ssl=8983
|
||||
-Dsolr.secureComms=<%=secureComms%>
|
||||
-Dsolr.base.url=/solr
|
||||
@@ -47,6 +47,7 @@ services:
|
||||
volumes:
|
||||
- ./keystores/alfresco:/usr/local/tomcat/alf_data/keystore <% } %>
|
||||
|
||||
<% if (clustering == 'false') { %>
|
||||
solr6: <% if (httpMode == 'http') { %>
|
||||
image: alfresco/alfresco-search-services:${SEARCH_CE_TAG} <% } else { %>
|
||||
build:
|
||||
@@ -81,6 +82,54 @@ services:
|
||||
- 8083:8983 <% if (httpMode == 'https') { %>
|
||||
volumes:
|
||||
- ./keystores/solr:/opt/alfresco-search-services/keystore <% } %>
|
||||
<% } %>
|
||||
|
||||
<% if (clustering == 'true') { %>
|
||||
solr6master:
|
||||
build:
|
||||
context: ./replication-<%=secureComms%>
|
||||
args:
|
||||
SEARCH_TAG: ${SEARCH_CE_TAG}
|
||||
SOLR_HOSTNAME: solr6master
|
||||
ENABLE_MASTER: "true"
|
||||
ENABLE_SLAVE: "false"
|
||||
mem_limit: 2g
|
||||
environment:
|
||||
#Solr needs to know how to register itself with Alfresco
|
||||
SOLR_ALFRESCO_HOST: "alfresco"
|
||||
SOLR_ALFRESCO_PORT: "<%=alfrescoPort%>"
|
||||
#Alfresco needs to know how to call solr
|
||||
SOLR_SOLR_HOST: "solr6master"
|
||||
SOLR_SOLR_PORT: "8983"
|
||||
#Create the default alfresco and archive cores
|
||||
SOLR_CREATE_ALFRESCO_DEFAULTS: "alfresco,archive"
|
||||
SOLR_JAVA_MEM: "-Xms2g -Xmx2g"
|
||||
ports:
|
||||
- 8083:8983
|
||||
|
||||
solr6slave:
|
||||
build:
|
||||
context: ./replication-<%=secureComms%>
|
||||
args:
|
||||
SEARCH_TAG: ${SEARCH_CE_TAG}
|
||||
SOLR_HOSTNAME: solr6slave
|
||||
ENABLE_MASTER: "false"
|
||||
ENABLE_SLAVE: "true"
|
||||
MASTER_HOST: solr6master
|
||||
mem_limit: 2g
|
||||
environment:
|
||||
#Solr needs to know how to register itself with Alfresco
|
||||
SOLR_ALFRESCO_HOST: "alfresco"
|
||||
SOLR_ALFRESCO_PORT: "<%=alfrescoPort%>"
|
||||
#Alfresco needs to know how to call solr
|
||||
SOLR_SOLR_HOST: "solr6slave"
|
||||
SOLR_SOLR_PORT: "8983"
|
||||
#Create the default alfresco and archive cores
|
||||
SOLR_CREATE_ALFRESCO_DEFAULTS: "alfresco,archive"
|
||||
SOLR_JAVA_MEM: "-Xms2g -Xmx2g"
|
||||
ports:
|
||||
- 8084:8983
|
||||
<% } %>
|
||||
|
||||
share:
|
||||
image: alfresco/alfresco-share:${SHARE_TAG}
|
||||
|
||||
+49
-2
@@ -26,7 +26,7 @@ services:
|
||||
-Ddb.username=alfresco
|
||||
-Ddb.password=alfresco
|
||||
-Ddb.url=jdbc:postgresql://postgres:5432/alfresco
|
||||
-Dsolr.host=solr6
|
||||
-Dsolr.host=<%=searchSolrHost%>
|
||||
-Dsolr.port.ssl=8983
|
||||
-Dsolr.secureComms=<%=secureComms%>
|
||||
-Dsolr.base.url=/solr <% if (sharding == 'true') { %>
|
||||
@@ -55,7 +55,7 @@ services:
|
||||
volumes:
|
||||
- ./keystores/alfresco:/usr/local/tomcat/alf_data/keystore <% } %>
|
||||
|
||||
<% if (sharding == 'false') { %>
|
||||
<% if (sharding == 'false' && clustering == 'false') { %>
|
||||
solr6: <% if (httpMode == 'http') { %>
|
||||
image: <%=searchImage%>:${<%=searchTag%>} <% } else { %>
|
||||
build:
|
||||
@@ -138,6 +138,53 @@ services:
|
||||
- 8084:8983 #Browser port
|
||||
<% } %>
|
||||
|
||||
<% if (clustering == 'true') { %>
|
||||
solr6master:
|
||||
build:
|
||||
context: ./replication-<%=secureComms%>
|
||||
args:
|
||||
SEARCH_TAG: ${<%=searchTag%>}
|
||||
SOLR_HOSTNAME: solr6master
|
||||
ENABLE_MASTER: "true"
|
||||
ENABLE_SLAVE: "false"
|
||||
mem_limit: 2g
|
||||
environment:
|
||||
#Solr needs to know how to register itself with Alfresco
|
||||
SOLR_ALFRESCO_HOST: "alfresco"
|
||||
SOLR_ALFRESCO_PORT: "<%=alfrescoPort%>"
|
||||
#Alfresco needs to know how to call solr
|
||||
SOLR_SOLR_HOST: "solr6master"
|
||||
SOLR_SOLR_PORT: "8983"
|
||||
#Create the default alfresco and archive cores
|
||||
SOLR_CREATE_ALFRESCO_DEFAULTS: "alfresco,archive"
|
||||
SOLR_JAVA_MEM: "-Xms2g -Xmx2g"
|
||||
ports:
|
||||
- 8083:8983
|
||||
|
||||
solr6slave:
|
||||
build:
|
||||
context: ./replication-<%=secureComms%>
|
||||
args:
|
||||
SEARCH_TAG: ${<%=searchTag%>}
|
||||
SOLR_HOSTNAME: solr6slave
|
||||
ENABLE_MASTER: "false"
|
||||
ENABLE_SLAVE: "true"
|
||||
MASTER_HOST: solr6master
|
||||
mem_limit: 2g
|
||||
environment:
|
||||
#Solr needs to know how to register itself with Alfresco
|
||||
SOLR_ALFRESCO_HOST: "alfresco"
|
||||
SOLR_ALFRESCO_PORT: "<%=alfrescoPort%>"
|
||||
#Alfresco needs to know how to call solr
|
||||
SOLR_SOLR_HOST: "solr6slave"
|
||||
SOLR_SOLR_PORT: "8983"
|
||||
#Create the default alfresco and archive cores
|
||||
SOLR_CREATE_ALFRESCO_DEFAULTS: "alfresco,archive"
|
||||
SOLR_JAVA_MEM: "-Xms2g -Xmx2g"
|
||||
ports:
|
||||
- 8084:8983
|
||||
<% } %>
|
||||
|
||||
<% if (zeppelin == 'true') { %>
|
||||
zeppelin: <% if (httpMode == 'http') { %>
|
||||
image: quay.io/alfresco/insight-zeppelin:${ZEPPELIN_TAG} <% } else { %>
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
ARG SEARCH_TAG
|
||||
FROM <%=searchImage%>:${SEARCH_TAG}
|
||||
|
||||
ARG SOLR_HOSTNAME
|
||||
ARG ENABLE_MASTER
|
||||
ARG ENABLE_SLAVE
|
||||
ARG MASTER_HOST
|
||||
ENV SOLR_HOSTNAME $SOLR_HOSTNAME
|
||||
ENV ENABLE_MASTER $ENABLE_MASTER
|
||||
ENV ENABLE_SLAVE $ENABLE_SLAVE
|
||||
ENV MASTER_HOST $MASTER_HOST
|
||||
|
||||
# Configure SOLR cores to run in HTTP mode from template
|
||||
RUN sed -i '/^bash.*/i sed -i "'"s/alfresco.secureComms=https/alfresco.secureComms=none/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties\n' \
|
||||
${DIST_DIR}/solr/bin/search_config_setup.sh
|
||||
|
||||
# Configure Alfresco Service Name
|
||||
RUN sed -i '/^bash.*/i sed -i "'"s/alfresco.host=localhost/alfresco.host=alfresco/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties\n' \
|
||||
${DIST_DIR}/solr/bin/search_config_setup.sh
|
||||
|
||||
# Set Hostname for this Node
|
||||
RUN sed -i '/^bash.*/i sed -i "'"s/solr.host=localhost/solr.host=${SOLR_HOSTNAME}/g"'" ${DIST_DIR}/solrhome/conf/shared.properties\n' \
|
||||
${DIST_DIR}/solr/bin/search_config_setup.sh
|
||||
|
||||
# Set Master / Slave configuration for this Node
|
||||
RUN sed -i '/^bash.*/i echo "\nenable.master=${ENABLE_MASTER}\nenable.slave=${ENABLE_SLAVE}" >> ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties\n' \
|
||||
${DIST_DIR}/solr/bin/search_config_setup.sh
|
||||
|
||||
RUN if [ "$ENABLE_MASTER" = "true" ] ; then \
|
||||
sed -i "/^bash.*/i sed -i '/^\\\\\s*<requestHandler name=\"\\\\/replication\".*/a \
|
||||
<lst name=\"master\">\
|
||||
<str name=\"replicateAfter\">commit</str>\
|
||||
<str name=\"replicateAfter\">startup</str>\
|
||||
<str name=\"confFiles\">schema.xml,stopwords.txt</str>\
|
||||
</lst>' ${DIST_DIR}/solrhome/templates/rerank/conf/solrconfig.xml\n" ${DIST_DIR}/solr/bin/search_config_setup.sh; \
|
||||
else \
|
||||
sed -i "/^bash.*/i sed -i '/^\\\\\s*<requestHandler name=\"\\\\/replication\".*/a \
|
||||
<lst name=\"slave\">\
|
||||
<str name=\"masterUrl\">http://${MASTER_HOST}:8983/solr/alfresco</str>\
|
||||
<str name=\"pollInterval\">00:00:60</str>\
|
||||
</lst>' ${DIST_DIR}/solrhome/templates/rerank/conf/solrconfig.xml\n" ${DIST_DIR}/solr/bin/search_config_setup.sh; \
|
||||
fi
|
||||
Reference in New Issue
Block a user