Simplified version of the generator.

This commit is contained in:
Angel Borroy
2019-06-12 09:18:45 +02:00
parent 7d3556e4ff
commit 95a90d5ca4
12 changed files with 302 additions and 467 deletions
@@ -47,7 +47,7 @@ module.exports = class extends Generator {
},
type: 'confirm',
name: 'clustering',
message: 'Would you like to use a SOLR Cluster (2 nodes in master-slave)?',
message: 'Would you like to use SOLR Replication (2 nodes in master-slave)?',
default: false
},
// Enterprise only options
@@ -73,7 +73,7 @@ module.exports = class extends Generator {
{
when: function (response) {
return (response.alfrescoVersion == 'enterprise' || commandProps['alfrescoVersion'] == 'enterprise') &&
(!response.clustering || !commandProps['clustering']);
(!response.clustering && !commandProps['clustering']);
},
type: 'confirm',
name: 'sharding',
@@ -105,54 +105,94 @@ module.exports = class extends Generator {
// Generate boilerplate from "templates" folder
writing() {
// Base Docker Image for Community
if (this.props.alfrescoVersion == 'community') {
this.fs.copyTpl(
this.templatePath(this.props.acsVersion + '/docker-compose-ce.yml'),
this.destinationPath('docker-compose.yml'),
{ httpMode: this.props.httpMode,
secureComms: (this.props.httpMode == 'http' ? 'none' : 'https'),
alfrescoPort: (this.props.httpMode == 'http' ? '8080' : '8443'),
clustering: (this.props.clustering ? "true" : "false"),
searchSolrHost: (this.props.clustering ? "solr6slave" : "solr6")
}
);
// Base Docker Image for Enterprise
} else {
this.fs.copyTpl(
this.templatePath(this.props.acsVersion + '/docker-compose-ee.yml'),
this.destinationPath('docker-compose.yml'),
{ httpMode: this.props.httpMode,
secureComms: (this.props.httpMode == 'http' ? 'none' : 'https'),
alfrescoProtocol: (this.props.httpMode == 'http' ? 'http' : 'https'),
alfrescoPort: (this.props.httpMode == 'http' ? '8080' : '8443'),
searchImage: (this.props.insightEngine ?
"quay.io/alfresco/insight-engine" :
"quay.io/alfresco/search-services"
),
searchTag: (this.props.insightEngine ?
"SEARCH_TAG" :
"SEARCH_CE_TAG"
),
searchPath: (this.props.insightEngine ?
"alfresco-insight-engine" :
"alfresco-search-services"
),
zeppelin: (this.props.zeppelin ? "true" : "false"),
sharding: (this.props.sharding ? "true" : "false"),
clustering: (this.props.clustering ? "true" : "false"),
searchSolrHost: (this.props.clustering ? "solr6slave" : "solr6")
}
);
}
// Docker Compose environment variables values
this.fs.copy(
this.templatePath(this.props.acsVersion + '/.env'),
this.destinationPath('.env'),
)
// Base Docker Compose Template
const dockerComposeTemplate =
(this.props.alfrescoVersion == 'community' ?
this.props.acsVersion + '/docker-compose-ce.yml' :
this.props.acsVersion + '/docker-compose-ee.yml');
// Repository Docker Image tag
const acsImageTag =
(this.props.alfrescoVersion == 'community' ?
'alfresco/alfresco-content-repository-community' :
'alfresco/alfresco-content-repository');
// Repository Docker Image version (from environmen variable)
const acsEnvTag =
(this.props.alfrescoVersion == 'community' ?
'ALFRESCO_CE_TAG' :
'ALFRESCO_TAG');
// Search Docker Image tag
const searchImageTag =
(this.props.insightEngine ?
'quay.io/alfresco/insight-engine' :
'quay.io/alfresco/search-services');
// Search Docker Image version (from environmen variable)
const searchEnvTag =
(this.props.insightEngine ?
'SEARCH_TAG' :
'SEARCH_CE_TAG');
// Search Docker Image installation base path
const searchBasePath =
(this.props.insightEngine ?
"alfresco-insight-engine" :
"alfresco-search-services");
// Copy Docker Compose applying configuration
this.fs.copyTpl(
this.templatePath(dockerComposeTemplate),
this.destinationPath('docker-compose.yml'),
{ httpMode: this.props.httpMode,
secureComms: (this.props.httpMode == 'http' ? 'none' : 'https'),
acsTag: acsEnvTag,
alfrescoPort: (this.props.httpMode == 'http' ? '8080' : '8443'),
clustering: (this.props.clustering ? "true" : "false"),
searchSolrHost: (this.props.clustering ? "solr6secondary" : "solr6"),
searchTag: searchEnvTag,
searchPath: searchBasePath,
zeppelin: (this.props.zeppelin ? "true" : "false"),
sharding: (this.props.sharding ? "true" : "false"),
clustering: (this.props.clustering ? "true" : "false"),
}
);
// Copy Docker Image for Repository applying configuration
this.fs.copyTpl(
this.templatePath(this.props.acsVersion + '/alfresco'),
this.destinationPath('alfresco'),
{
acsImage: acsImageTag
}
);
// Copy Docker Image for Search applying configuration
this.fs.copyTpl(
this.templatePath(this.props.acsVersion + '/search'),
this.destinationPath('search'),
{
searchImage: searchImageTag,
searchTag: searchEnvTag,
searchPath: searchBasePath
}
);
// Copy Docker Image for Zeppelin applying configuration
if (this.props.zeppelin) {
this.fs.copy(
this.templatePath(this.props.acsVersion + '/zeppelin'),
this.destinationPath('zeppelin')
);
}
// Add resources for SSL configuration
if (this.props.httpMode == 'https') {
this.fs.copy(
@@ -163,36 +203,7 @@ module.exports = class extends Generator {
this.templatePath('keystores/solr'),
this.destinationPath('keystores/solr')
)
this.fs.copyTpl(
this.templatePath(this.props.acsVersion + '/alfresco-https'),
this.destinationPath('alfresco-https'),
{
acsImage: (this.props.alfrescoVersion == 'community' ?
"alfresco/alfresco-content-repository-community" :
"alfresco/alfresco-content-repository")
}
)
if (!this.props.sharding) {
this.fs.copyTpl(
this.templatePath(this.props.acsVersion + '/search-https'),
this.destinationPath('search-https'),
{
searchImage: (this.props.insightEngine ?
"quay.io/alfresco/insight-engine" :
"alfresco/alfresco-search-services"
),
searchPath: (this.props.insightEngine ?
"alfresco-insight-engine" :
"alfresco-search-services"
)
}
)
}
if (this.props.zeppelin == true) {
this.fs.copy(
this.templatePath(this.props.acsVersion + '/zeppelin-https'),
this.destinationPath('zeppelin-https')
)
this.fs.copy(
this.templatePath('keystores/zeppelin'),
this.destinationPath('keystores/zeppelin')
@@ -200,51 +211,6 @@ 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" :
"quay.io/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" :
"quay.io/alfresco/search-services"
)
}
)
}
}
}
};
@@ -15,5 +15,5 @@ SHARED_FILE_STORE_TAG=0.5.3
ACTIVE_MQ_TAG=5.15.8
DIGITAL_WORKSPACE_TAG=1.1.0
ACS_NGINX_TAG=3.0.0
SEARCH_TAG=1.1.0.1
ZEPPELIN_TAG=1.1.0.1
SEARCH_TAG=latest
ZEPPELIN_TAG=latest
@@ -1,37 +0,0 @@
ARG ALFRESCO_TAG
FROM <%=acsImage%>:${ALFRESCO_TAG}
ARG TRUSTSTORE_TYPE
ARG TRUSTSTORE_PASS
ARG KEYSTORE_TYPE
ARG KEYSTORE_PASS
ENV TRUSTSTORE_TYPE=$TRUSTSTORE_TYPE \
TRUSTSTORE_PASS=$TRUSTSTORE_PASS \
KEYSTORE_TYPE=$KEYSTORE_TYPE \
KEYSTORE_PASS=$KEYSTORE_PASS
ARG TOMCAT_DIR=/usr/local/tomcat
ARG ALF_DATA_DIR=${TOMCAT_DIR}/alf_data
# Expose keystore folder
VOLUME ["${ALF_DATA_DIR}/keystore"]
# Default value in "repository.properties" is "dir.keystore=classpath:alfresco/keystore"
RUN echo -e "\n\
dir.keystore=${ALF_DATA_DIR}/keystore\n\
alfresco.encryption.ssl.keystore.type=${TRUSTSTORE_TYPE}\n\
alfresco.encryption.ssl.truststore.type=${KEYSTORE_TYPE}\n\
" >> ${TOMCAT_DIR}/shared/classes/alfresco-global.properties
### Enable SSL by adding the proper Connector to server.xml
RUN sed -i "s/\
<\/Engine>/\n\
<\/Engine>\n\
<Connector port=\"8443\" protocol=\"org.apache.coyote.http11.Http11Protocol\"\n\
SSLEnabled=\"true\" maxThreads=\"150\" scheme=\"https\"\n\
keystoreFile=\"\/usr\/local\/tomcat\/alf_data\/keystore\/ssl.keystore\"\n\
keystorePass=\"${KEYSTORE_PASS}\" keystoreType=\"${KEYSTORE_TYPE}\" secure=\"true\" connectionTimeout=\"240000\"\n\
truststoreFile=\"\/usr\/local\/tomcat\/alf_data\/keystore\/ssl.truststore\"\n\
truststorePass=\"${TRUSTSTORE_PASS}\" truststoreType=\"${TRUSTSTORE_TYPE}\" clientAuth=\"want\" sslProtocol=\"TLS\">\n\
<\/Connector>/g" ${TOMCAT_DIR}/conf/server.xml
@@ -0,0 +1,47 @@
ARG ALFRESCO_TAG
FROM <%=acsImage%>:${ALFRESCO_TAG}
ARG TOMCAT_DIR=/usr/local/tomcat
ARG ALF_DATA_DIR=${TOMCAT_DIR}/alf_data
# COMMS
ARG SOLR_COMMS
ENV SOLR_COMMS $SOLR_COMMS
# SSL
ARG TRUSTSTORE_TYPE
ARG TRUSTSTORE_PASS
ARG KEYSTORE_TYPE
ARG KEYSTORE_PASS
ENV TRUSTSTORE_TYPE=$TRUSTSTORE_TYPE \
TRUSTSTORE_PASS=$TRUSTSTORE_PASS \
KEYSTORE_TYPE=$KEYSTORE_TYPE \
KEYSTORE_PASS=$KEYSTORE_PASS
# Expose keystore folder
# Useless for 'none'/'http' communications with SOLR
VOLUME ["${ALF_DATA_DIR}/keystore"]
# Default value in "repository.properties" is "dir.keystore=classpath:alfresco/keystore"
RUN if [ "$SOLR_COMMS" == "https" ] ; then \
echo -e "\n\
dir.keystore=${ALF_DATA_DIR}/keystore\n\
alfresco.encryption.ssl.keystore.type=${TRUSTSTORE_TYPE}\n\
alfresco.encryption.ssl.truststore.type=${KEYSTORE_TYPE}\n\
" >> ${TOMCAT_DIR}/shared/classes/alfresco-global.properties; \
fi
### Enable SSL by adding the proper Connector to server.xml
RUN if [ "$SOLR_COMMS" == "https" ] ; then \
sed -i "s/\
[[:space:]]\+<\/Engine>/\n\
<\/Engine>\n\
<Connector port=\"8443\" protocol=\"org.apache.coyote.http11.Http11Protocol\"\n\
SSLEnabled=\"true\" maxThreads=\"150\" scheme=\"https\"\n\
keystoreFile=\"\/usr\/local\/tomcat\/alf_data\/keystore\/ssl.keystore\"\n\
keystorePass=\"${KEYSTORE_PASS}\" keystoreType=\"${KEYSTORE_TYPE}\" secure=\"true\" connectionTimeout=\"240000\"\n\
truststoreFile=\"\/usr\/local\/tomcat\/alf_data\/keystore\/ssl.truststore\"\n\
truststorePass=\"${TRUSTSTORE_PASS}\" truststoreType=\"${TRUSTSTORE_TYPE}\" clientAuth=\"want\" sslProtocol=\"TLS\">\n\
<\/Connector>/g" ${TOMCAT_DIR}/conf/server.xml; \
fi
@@ -1,21 +1,14 @@
# This docker-compose file will spin up an ACS cluster on a local host or on a server and it requires a minimum of 12GB Memory to distribute among containers.
# Limit container memory and assign X percentage to JVM. There are couple of ways to allocate JVM Memory for ACS Containers
# For example: 'JAVA_OPTS: "$JAVA_OPTS -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"'
# But, as per Oracle docs (https://docs.oracle.com/javase/9/gctuning/parallel-collector1.htm#JSGCT-GUID-CAB83393-3438-44ED-98F0-D15641B43C7D)
# If container memory is not explicitly set, then the above flags will default max heap to 1/4th of container's memory which may not be ideal.
# Hence, setting up explicit Container memory and then assigning a percentage of it to the JVM for performance tuning.
# Using version 2 as 3 does not support resource constraint options (cpu_*, mem_* limits) for non swarm mode in Compose
version: "2"
services:
alfresco: <% if (httpMode == 'http') { %>
image: alfresco/alfresco-content-repository-community:${ALFRESCO_CE_TAG} <% } else { %>
alfresco:
build:
context: ./alfresco-https
context: ./alfresco
args:
ALFRESCO_TAG: ${ALFRESCO_CE_TAG}
ALFRESCO_TAG: ${<%=acsTag%>}
SOLR_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
TRUSTSTORE_TYPE: JCEKS
TRUSTSTORE_PASS: kT9X6oe68t
KEYSTORE_TYPE: JCEKS
@@ -47,16 +40,19 @@ 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 { %>
solr6:
build:
context: ./search-https
context: ./search
args:
SEARCH_TAG: ${SEARCH_CE_TAG}
SEARCH_TAG: ${<%=searchTag%>}
SOLR_HOSTNAME: solr6
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
TRUSTSTORE_TYPE: JCEKS
KEYSTORE_TYPE: JCEKS
mem_limit: 2500m <% } %>
KEYSTORE_TYPE: JCEKS <% } %> <% if (clustering == 'true') { %>
ENABLE_MASTER: "true"
ENABLE_SLAVE: "false" <% } %>
mem_limit: 2500m
environment:
#Solr needs to know how to register itself with Alfresco
SOLR_ALFRESCO_HOST: "alfresco"
@@ -81,48 +77,27 @@ services:
ports:
- 8083:8983 <% if (httpMode == 'https') { %>
volumes:
- ./keystores/solr:/opt/alfresco-search-services/keystore <% } %>
<% } %>
- ./keystores/solr:/opt/<%=searchPath%>/keystore <% } %>
<% if (clustering == 'true') { %>
solr6master:
solr6secondary:
build:
context: ./replication-<%=secureComms%>
context: ./search
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
SOLR_HOSTNAME: solr6secondary
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%>
ENABLE_MASTER: "false"
ENABLE_SLAVE: "true"
MASTER_HOST: solr6master
MASTER_HOST: solr6
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_HOST: "solr6secondary"
SOLR_SOLR_PORT: "8983"
#Create the default alfresco and archive cores
SOLR_CREATE_ALFRESCO_DEFAULTS: "alfresco,archive"
@@ -1,20 +1,13 @@
# This docker-compose file will spin up an ACS cluster on a local host or on a server and it requires a minimum of 12GB Memory to distribute among containers.
# Limit container memory and assign X percentage to JVM. There are couple of ways to allocate JVM Memory for ACS Containers
# For example: 'JAVA_OPTS: "$JAVA_OPTS -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"'
# But, as per Oracle docs (https://docs.oracle.com/javase/9/gctuning/parallel-collector1.htm#JSGCT-GUID-CAB83393-3438-44ED-98F0-D15641B43C7D)
# If container memory is not explicitly set, then the above flags will default max heap to 1/4th of container's memory which may not be ideal.
# Hence, setting up explicit Container memory and then assigning a percentage of it to the JVM for performance tuning.
# Using version 2 as 3 does not support resource constraint options (cpu_*, mem_* limits) for non swarm mode in Compose
version: "2"
services:
alfresco: <% if (httpMode == 'http') { %>
image: alfresco/alfresco-content-repository:${ALFRESCO_TAG} <% } else { %>
alfresco:
build:
context: ./alfresco-https
context: ./alfresco
args:
ALFRESCO_TAG: ${ALFRESCO_TAG}
ALFRESCO_TAG: ${<%=acsTag%>}
SOLR_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
TRUSTSTORE_TYPE: JCEKS
TRUSTSTORE_PASS: kT9X6oe68t
KEYSTORE_TYPE: JCEKS
@@ -55,15 +48,21 @@ services:
volumes:
- ./keystores/alfresco:/usr/local/tomcat/alf_data/keystore <% } %>
<% if (sharding == 'false' && clustering == 'false') { %>
solr6: <% if (httpMode == 'http') { %>
image: <%=searchImage%>:${<%=searchTag%>} <% } else { %>
solr6:
build:
context: ./search-https
context: ./search
args:
SEARCH_TAG: ${<%=searchTag%>}
SOLR_HOSTNAME: solr6
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
TRUSTSTORE_TYPE: JCEKS
KEYSTORE_TYPE: JCEKS <% } %>
KEYSTORE_TYPE: JCEKS <% } %> <% if (clustering == 'true') { %>
ENABLE_MASTER: "true"
ENABLE_SLAVE: "false" <% } %> <% if (sharding == 'true') { %>
ENABLE_SHARDING: "true"
NUM_SHARDS: "2"
SHARD_ID: "0" <% } %>
mem_limit: 2500m
environment:
#Solr needs to know how to register itself with Alfresco
@@ -81,7 +80,13 @@ services:
SOLR_SSL_KEY_STORE: "/opt/<%=searchPath%>/keystore/ssl.repo.client.keystore"
SOLR_SSL_KEY_STORE_PASSWORD: "kT9X6oe68t"
SOLR_SSL_KEY_STORE_TYPE: "JCEKS"
SOLR_SSL_NEED_CLIENT_AUTH: "true"
SOLR_SSL_NEED_CLIENT_AUTH: "true" <% if (sharding == 'true') { %>
SOLR_SSL_CLIENT_KEY_STORE: "/opt/<%=searchPath%>/keystore/ssl.repo.client.keystore"
SOLR_SSL_CLIENT_KEY_STORE_PASSWORD: "kT9X6oe68t"
SOLR_SSL_CLIENT_KEY_STORE_TYPE: "JCEKS"
SOLR_SSL_CLIENT_TRUST_STORE: "/opt/<%=searchPath%>/keystore/ssl.repo.client.keystore"
SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD: "kT9X6oe68t"
SOLR_SSL_CLIENT_TRUST_STORE_TYPE: "JCEKS" <% } %>
SOLR_OPTS: "
-Dsolr.ssl.checkPeerName=false
-Dsolr.allow.unsafe.resourceloading=true
@@ -90,65 +95,30 @@ services:
- 8083:8983 <% if (httpMode == 'https') { %>
volumes:
- ./keystores/solr:/opt/<%=searchPath%>/keystore <% } %>
<% } %>
<% if (sharding == 'true') { %>
solr6shard1:
<% if (sharding == 'true' || clustering == 'true') { %>
solr6secondary:
build:
context: ./sharding-<%=secureComms%>
context: ./search
args:
- SEARCH_TAG=${<%=searchTag%>}
- SOLR_HOSTNAME=solr6shard1
- NUM_SHARDS=2
- SHARD_ID=0
mem_limit: 2g
SEARCH_TAG: ${<%=searchTag%>}
SOLR_HOSTNAME: solr6secondary
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
TRUSTSTORE_TYPE: JCEKS
KEYSTORE_TYPE: JCEKS <% } %> <% if (clustering == 'true') { %>
ENABLE_MASTER: "true"
ENABLE_SLAVE: "false" <% } %> <% if (sharding == 'true') { %>
ENABLE_SHARDING: "true"
NUM_SHARDS: "2"
SHARD_ID: "1" <% } %>
mem_limit: 2500m
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: "solr6shard1"
SOLR_SOLR_PORT: "8983"
#Create the default alfresco and archive cores
SOLR_CREATE_ALFRESCO_DEFAULTS: "alfresco,archive"
SOLR_JAVA_MEM: "-Xms2g -Xmx2g" <% if (httpMode == 'https') { %>
SOLR_SSL_TRUST_STORE: "/opt/<%=searchPath%>/keystore/ssl.repo.client.truststore"
SOLR_SSL_TRUST_STORE_PASSWORD: "kT9X6oe68t"
SOLR_SSL_TRUST_STORE_TYPE: "JCEKS"
SOLR_SSL_KEY_STORE: "/opt/<%=searchPath%>/keystore/ssl.repo.client.keystore"
SOLR_SSL_KEY_STORE_PASSWORD: "kT9X6oe68t"
SOLR_SSL_KEY_STORE_TYPE: "JCEKS"
SOLR_SSL_NEED_CLIENT_AUTH: "true"
SOLR_SSL_CLIENT_KEY_STORE: "/opt/<%=searchPath%>/keystore/ssl.repo.client.keystore"
SOLR_SSL_CLIENT_KEY_STORE_PASSWORD: "kT9X6oe68t"
SOLR_SSL_CLIENT_KEY_STORE_TYPE: "JCEKS"
SOLR_SSL_CLIENT_TRUST_STORE: "/opt/<%=searchPath%>/keystore/ssl.repo.client.keystore"
SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD: "kT9X6oe68t"
SOLR_SSL_CLIENT_TRUST_STORE_TYPE: "JCEKS"
SOLR_OPTS: "
-Dsolr.ssl.checkPeerName=false
-Dsolr.allow.unsafe.resourceloading=true
" <% } %>
ports:
- 8083:8983 <% if (httpMode == 'https') { %>
volumes:
- ./keystores/solr:/opt/<%=searchPath%>/keystore <% } %>
solr6shard2:
build:
context: ./sharding-<%=secureComms%>
args:
- SEARCH_TAG=${<%=searchTag%>}
- SOLR_HOSTNAME=solr6shard2
- NUM_SHARDS=2
- SHARD_ID=1
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: "solr6shard2"
SOLR_SOLR_HOST: "solr6secondary"
SOLR_SOLR_PORT: "8983"
#Create the default alfresco and archive cores
SOLR_CREATE_ALFRESCO_DEFAULTS: "alfresco,archive"
@@ -176,62 +146,14 @@ services:
- ./keystores/solr:/opt/<%=searchPath%>/keystore <% } %>
<% } %>
<% 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 { %>
zeppelin:
build:
context: ./zeppelin-https
context: ./zeppelin
args:
- ZEPPELIN_TAG=${ZEPPELIN_TAG} <% } %>
- ZEPPELIN_TAG=${ZEPPELIN_TAG}
environment:
REPO_PROTOCOL: "<%=alfrescoProtocol%>"
ALFRESCO_COMMS: <%=secureComms%>
REPO_HOST: "alfresco"
REPO_PORT: "<%=alfrescoPort%>" <% if (httpMode == 'https') { %>
JAVA_OPTS: "
@@ -1,42 +0,0 @@
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
@@ -1,35 +0,0 @@
ARG SEARCH_TAG
FROM <%=searchImage%>:${SEARCH_TAG}
ARG TRUSTSTORE_TYPE
ENV TRUSTSTORE_TYPE $TRUSTSTORE_TYPE
ARG KEYSTORE_TYPE
ENV KEYSTORE_TYPE $KEYSTORE_TYPE
# Configure SOLR cores to run in HTTPs mode from template
RUN sed -i '/^bash.*/i sed -i "'"s/alfresco.secureComms=none/alfresco.secureComms=https/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties\n' \
${DIST_DIR}/solr/bin/search_config_setup.sh
# Set SSL properties
RUN sed -i '/^bash.*/i \
sed -i "'"s/alfresco.encryption.ssl.keystore.location=.*/alfresco.encryption.ssl.keystore.location=\\\/opt\\\/<%=searchPath%>\\\/keystore\\\/ssl.repo.client.keystore/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties && \
sed -i "'"s/alfresco.encryption.ssl.keystore.passwordFileLocation=.*/alfresco.encryption.ssl.keystore.passwordFileLocation=\\\/opt\\\/<%=searchPath%>\\\/keystore\\\/ssl-keystore-passwords.properties/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties && \
sed -i "'"s/alfresco.encryption.ssl.keystore.type=.*/alfresco.encryption.ssl.keystore.type=${KEYSTORE_TYPE}/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties && \
sed -i "'"s/alfresco.encryption.ssl.truststore.location=.*/alfresco.encryption.ssl.truststore.location=\\\/opt\\\/<%=searchPath%>\\\/keystore\\\/ssl.repo.client.truststore/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties && \
sed -i "'"s/alfresco.encryption.ssl.truststore.passwordFileLocation=.*/alfresco.encryption.ssl.truststore.passwordFileLocation=\\\/opt\\\/<%=searchPath%>\\\/keystore\\\/ssl-truststore-passwords.properties/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties && \
sed -i "'"s/alfresco.encryption.ssl.truststore.type=.*/alfresco.encryption.ssl.truststore.type=${TRUSTSTORE_TYPE}/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties' \
${DIST_DIR}/solr/bin/search_config_setup.sh
# Remove pre-bundled stores (just to be sure that they are not picked up)
RUN sed -i '/^bash.*/i \
rm ${DIST_DIR}/solrhome/templates/rerank/conf/ssl.repo.client.keystore && \
rm ${DIST_DIR}/solrhome/templates/rerank/conf/ssl-keystore-passwords.properties && \
rm ${DIST_DIR}/solrhome/templates/rerank/conf/ssl.repo.client.truststore && \
rm ${DIST_DIR}/solrhome/templates/rerank/conf/ssl-truststore-passwords.properties' \
${DIST_DIR}/solr/bin/search_config_setup.sh
RUN mkdir ${DIST_DIR}/keystore \
&& chown -R solr:solr ${DIST_DIR}/keystore
VOLUME ["${DIST_DIR}/keystore"]
@@ -0,0 +1,96 @@
ARG SEARCH_TAG
FROM <%=searchImage%>:${SEARCH_TAG}
# COMMON
ARG ALFRESCO_HOSTNAME
ARG SOLR_HOSTNAME
ENV ALFRESCO_HOSTNAME $ALFRESCO_HOSTNAME
ENV SOLR_HOSTNAME $SOLR_HOSTNAME
# Configure Alfresco Service Name
RUN sed -i '/^bash.*/i sed -i "'"s/alfresco.host=localhost/alfresco.host=${ALFRESCO_HOSTNAME}/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties\n' \
${DIST_DIR}/solr/bin/search_config_setup.sh && \
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
# COMMS
ARG ALFRESCO_COMMS
ENV ALFRESCO_COMMS $ALFRESCO_COMMS
# Configure SOLR cores to run in HTTPs mode from template
RUN if [ "$ALFRESCO_COMMS" == "https" ] ; then \
sed -i '/^bash.*/i sed -i "'"s/alfresco.secureComms=none/alfresco.secureComms=https/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties\n' \
${DIST_DIR}/solr/bin/search_config_setup.sh; \
else \
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; \
fi
# SSL
ARG TRUSTSTORE_TYPE
ENV TRUSTSTORE_TYPE $TRUSTSTORE_TYPE
ARG KEYSTORE_TYPE
ENV KEYSTORE_TYPE $KEYSTORE_TYPE
# Set SSL properties
RUN if [ "$ALFRESCO_COMMS" == "https" ] ; then \
sed -i '/^bash.*/i \
sed -i "'"s/alfresco.encryption.ssl.keystore.location=.*/alfresco.encryption.ssl.keystore.location=\\\/opt\\\/<%=searchPath%>\\\/keystore\\\/ssl.repo.client.keystore/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties && \
sed -i "'"s/alfresco.encryption.ssl.keystore.passwordFileLocation=.*/alfresco.encryption.ssl.keystore.passwordFileLocation=\\\/opt\\\/<%=searchPath%>\\\/keystore\\\/ssl-keystore-passwords.properties/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties && \
sed -i "'"s/alfresco.encryption.ssl.keystore.type=.*/alfresco.encryption.ssl.keystore.type=${KEYSTORE_TYPE}/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties && \
sed -i "'"s/alfresco.encryption.ssl.truststore.location=.*/alfresco.encryption.ssl.truststore.location=\\\/opt\\\/<%=searchPath%>\\\/keystore\\\/ssl.repo.client.truststore/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties && \
sed -i "'"s/alfresco.encryption.ssl.truststore.passwordFileLocation=.*/alfresco.encryption.ssl.truststore.passwordFileLocation=\\\/opt\\\/<%=searchPath%>\\\/keystore\\\/ssl-truststore-passwords.properties/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties && \
sed -i "'"s/alfresco.encryption.ssl.truststore.type=.*/alfresco.encryption.ssl.truststore.type=${TRUSTSTORE_TYPE}/g"'" ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties' \
${DIST_DIR}/solr/bin/search_config_setup.sh; \
fi
# REPLICATION
ARG ENABLE_MASTER
ARG ENABLE_SLAVE
ARG MASTER_HOST
ENV ENABLE_MASTER $ENABLE_MASTER
ENV ENABLE_SLAVE $ENABLE_SLAVE
ENV MASTER_HOST $MASTER_HOST
# Set Master / Slave configuration for this Node
RUN if [ "$ENABLE_MASTER" == "true" ] ; then \
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; \
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; \
fi
RUN if [ "$ENABLE_SLAVE" == "true" ] ; then \
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; \
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
# SHARDING
ARG ENABLE_SHARDING
ARG NUM_SHARDS
ARG SHARD_ID
ENV ENABLE_SHARDING $ENABLE_SHARDING
ENV NUM_SHARDS $NUM_SHARDS
ENV SHARD_ID $SHARD_ID
# Set Port Number and Sharding ID for this Shard Service
RUN if [ "$ENABLE_SHARDING" == "true" ] ; then \
sed -i '/^bash.*/i echo "\nsolr.port.ssl=8983\nshard.count=${NUM_SHARDS}\nshard.instance=${SHARD_ID}" >> ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties\n' \
${DIST_DIR}/solr/bin/search_config_setup.sh && \
sed -i '/^bash.*/i echo "\nalfresco.port=8080\nalfresco.port.ssl=8443\nalfresco.baseUrl=/alfresco" >> ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties\n' \
${DIST_DIR}/solr/bin/search_config_setup.sh; \
fi
# Useless for 'none'/'http' communications with Alfresco
RUN mkdir ${DIST_DIR}/keystore \
&& chown -R solr:solr ${DIST_DIR}/keystore
VOLUME ["${DIST_DIR}/keystore"]
@@ -1,39 +0,0 @@
ARG SEARCH_TAG
FROM <%=searchImage%>:${SEARCH_TAG}
ARG SOLR_HOSTNAME
ARG NUM_SHARDS
ARG SHARD_ID
ARG PORT_NUMBER
ENV SOLR_HOSTNAME $SOLR_HOSTNAME
ENV NUM_SHARDS $NUM_SHARDS
ENV SHARD_ID $SHARD_ID
ENV PORT_NUMBER $PORT_NUMBER
# Configure SOLR cores to run in HTTP mode from template
RUN sed -i '/^bash.*/i sed -i "'"s/alfresco.secureComms=none/alfresco.secureComms=https/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 Shard Service
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 Port Number and Sharding ID for this Shard Service
RUN sed -i '/^bash.*/i echo "\nsolr.port.ssl=${PORT_NUMBER}\nshard.count=${NUM_SHARDS}\nshard.instance=${SHARD_ID}" >> ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties\n' \
${DIST_DIR}/solr/bin/search_config_setup.sh
# Set Port Number and Sharding ID for this Shard Service
RUN sed -i '/^bash.*/i echo "\nalfresco.port=8080\nalfresco.port.ssl=8443\nalfresco.baseUrl=/alfresco" >> ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties\n' \
${DIST_DIR}/solr/bin/search_config_setup.sh
# Adding external keystore
RUN mkdir ${DIST_DIR}/keystore \
&& chown -R solr:solr ${DIST_DIR}/keystore
VOLUME ["${DIST_DIR}/keystore"]
@@ -1,25 +0,0 @@
ARG SEARCH_TAG
FROM <%=searchImage%>:${SEARCH_TAG}
ARG SOLR_HOSTNAME
ARG NUM_SHARDS
ARG SHARD_ID
ENV SOLR_HOSTNAME $SOLR_HOSTNAME
ENV NUM_SHARDS $NUM_SHARDS
ENV SHARD_ID $SHARD_ID
# 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 Shard Service
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 Sharding ID for this Shard Service
RUN sed -i '/^bash.*/i echo "\nshard.count=${NUM_SHARDS}\nshard.instance=${SHARD_ID}" >> ${DIST_DIR}/solrhome/templates/rerank/conf/solrcore.properties\n' \
${DIST_DIR}/solr/bin/search_config_setup.sh
@@ -1,11 +1,17 @@
ARG ZEPPELIN_TAG
FROM quay.io/alfresco/insight-zeppelin:${ZEPPELIN_TAG}
# COMMS
ARG ALFRESCO_COMMS
ENV ALFRESCO_COMMS $ALFRESCO_COMMS
# Useless when running in Alfresco Comms none mode
RUN mkdir ${ZEPPELIN_HOME}/keystore \
&& chown -R zeppelin:zeppelin ${ZEPPELIN_HOME}/keystore
### Add SSL Configuration to Zeppelin Interpreter
RUN sed -i '/"zeppelin.jdbc.principal":/i \
RUN if [ "$ALFRESCO_COMMS" == "https" ] ; then \
sed -i '/"zeppelin.jdbc.principal":/i \
"alfresco.enable.ssl": { \n\
"value": "true", \n\
"type": "string" \n\
@@ -38,4 +44,5 @@ RUN mkdir ${ZEPPELIN_HOME}/keystore \
"value": "JCEKS",\n\
"type": "string"\n\
\n},\
' ${ZEPPELIN_HOME}/conf/interpreter.json
' ${ZEPPELIN_HOME}/conf/interpreter.json; \
fi