Update generator to allow passing ACS tag.

This commit is contained in:
Tom Page
2019-06-24 11:51:30 +01:00
parent 7abcd13300
commit 6dc535acd9
9 changed files with 47 additions and 58 deletions
@@ -25,7 +25,7 @@ module.exports = class extends Generator {
type: 'input',
name: 'acsVersion',
message: 'Which Alfresco version do you want to use?',
default: '6.1'
default: 'latest'
},
{
type: 'list',
@@ -104,42 +104,38 @@ module.exports = class extends Generator {
// Generate boilerplate from "templates" folder
writing() {
// TODO: Add support for other versions of ACS.
// e.g. Using something like:
// if (this.props.acsVersion.startsWith('6.0')) {
var templateDirectory = 'latest';
// Docker Compose environment variables values
this.fs.copy(
this.templatePath(this.props.acsVersion + '/.env'),
this.fs.copyTpl(
this.templatePath(templateDirectory + '/.env'),
this.destinationPath('.env'),
{
acsTag: this.props.acsVersion
}
)
// Base Docker Compose Template
const dockerComposeTemplate =
(this.props.alfrescoVersion == 'community' ?
this.props.acsVersion + '/docker-compose-ce.yml' :
this.props.acsVersion + '/docker-compose-ee.yml');
templateDirectory + '/docker-compose-ce.yml' :
templateDirectory + '/docker-compose-ee.yml');
// Repository Docker Image tag
const acsImageTag =
// Repository Docker Image name
const acsImageName =
(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 =
// Search Docker Image
const searchImageName =
(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 ?
@@ -150,13 +146,12 @@ module.exports = class extends Generator {
this.fs.copyTpl(
this.templatePath(dockerComposeTemplate),
this.destinationPath('docker-compose.yml'),
{ httpMode: this.props.httpMode,
{
httpMode: this.props.httpMode,
secureComms: (this.props.httpMode == 'http' ? 'none' : 'https'),
acsTag: acsEnvTag,
alfrescoPort: (this.props.httpMode == 'http' ? '8080' : '8443'),
replication: (this.props.replication ? "true" : "false"),
searchSolrHost: (this.props.replication ? "solr6secondary" : "solr6"),
searchTag: searchEnvTag,
searchPath: searchBasePath,
zeppelin: (this.props.zeppelin ? "true" : "false"),
sharding: (this.props.sharding ? "true" : "false"),
@@ -166,27 +161,26 @@ module.exports = class extends Generator {
// Copy Docker Image for Repository applying configuration
this.fs.copyTpl(
this.templatePath(this.props.acsVersion + '/alfresco/Dockerfile'),
this.templatePath(templateDirectory + '/alfresco/Dockerfile'),
this.destinationPath('alfresco/Dockerfile'),
{
acsImage: acsImageTag,
acsImage: acsImageName,
sharding: (this.props.sharding ? "true" : "false")
}
);
if (this.props.sharding) {
this.fs.copy(
this.templatePath(this.props.acsVersion + '/alfresco/model'),
this.templatePath(templateDirectory + '/alfresco/model'),
this.destinationPath('alfresco/model')
)
}
// Copy Docker Image for Search applying configuration
this.fs.copyTpl(
this.templatePath(this.props.acsVersion + '/search'),
this.templatePath(templateDirectory + '/search'),
this.destinationPath('search'),
{
searchImage: searchImageTag,
searchTag: searchEnvTag,
searchImage: searchImageName,
searchPath: searchBasePath
}
);
@@ -194,7 +188,7 @@ module.exports = class extends Generator {
// Copy Docker Image for Zeppelin applying configuration
if (this.props.zeppelin) {
this.fs.copy(
this.templatePath(this.props.acsVersion + '/zeppelin'),
this.templatePath(templateDirectory + '/zeppelin'),
this.destinationPath('zeppelin')
);
}
@@ -1,9 +1,4 @@
# Community
ALFRESCO_CE_TAG=latest
SEARCH_CE_TAG=latest
# Enterprise
ALFRESCO_TAG=latest
ALFRESCO_TAG=<%=acsTag%>
SHARE_TAG=6.1.0
POSTGRES_TAG=10.1
TRANSFORM_ROUTER_TAG=1.0.1
@@ -3,11 +3,11 @@ version: "2"
services:
alfresco:
alfresco:
build:
context: ./alfresco
args:
ALFRESCO_TAG: ${<%=acsTag%>}
ALFRESCO_TAG: ${ALFRESCO_TAG}
SOLR_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
TRUSTSTORE_TYPE: JCEKS
TRUSTSTORE_PASS: kT9X6oe68t
@@ -21,7 +21,7 @@ services:
-Ddb.password=alfresco
-Ddb.url=jdbc:postgresql://postgres:5432/alfresco
-Dsolr.host=<%=searchSolrHost%>
-Dsolr.port.ssl=8983
-Dsolr.port.ssl=8983
-Dsolr.secureComms=<%=secureComms%>
-Dsolr.base.url=/solr
-Dindex.subsystem.name=solr6
@@ -35,7 +35,7 @@ services:
-Xms1500m -Xmx1500m
"
ports:
- 8082:8080 <% if (httpMode == 'https') { %>
- 8082:8080 <% if (httpMode == 'https') { %>
- 8443:8443
volumes:
- ./keystores/alfresco:/usr/local/tomcat/alf_data/keystore <% } %>
@@ -44,15 +44,15 @@ services:
build:
context: ./search
args:
SEARCH_TAG: ${<%=searchTag%>}
SEARCH_TAG: ${SEARCH_TAG}
SOLR_HOSTNAME: solr6
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
TRUSTSTORE_TYPE: JCEKS
KEYSTORE_TYPE: JCEKS <% } %> <% if (replication == 'true') { %>
ENABLE_MASTER: "true"
ENABLE_SLAVE: "false" <% } %>
mem_limit: 1200m
mem_limit: 1200m
environment:
#Solr needs to know how to register itself with Alfresco
SOLR_ALFRESCO_HOST: "alfresco"
@@ -84,10 +84,10 @@ services:
build:
context: ./search
args:
SEARCH_TAG: ${SEARCH_CE_TAG}
SEARCH_TAG: ${SEARCH_TAG}
SOLR_HOSTNAME: solr6secondary
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
TRUSTSTORE_TYPE: JCEKS
KEYSTORE_TYPE: JCEKS <% } %> <% if (replication == 'true') { %>
ENABLE_MASTER: "true"
@@ -2,11 +2,11 @@
version: "2"
services:
alfresco:
alfresco:
build:
context: ./alfresco
args:
ALFRESCO_TAG: ${<%=acsTag%>}
ALFRESCO_TAG: ${ALFRESCO_TAG}
SOLR_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
TRUSTSTORE_TYPE: JCEKS
TRUSTSTORE_PASS: kT9X6oe68t
@@ -52,10 +52,10 @@ services:
build:
context: ./search
args:
SEARCH_TAG: ${<%=searchTag%>}
SEARCH_TAG: ${SEARCH_TAG}
SOLR_HOSTNAME: solr6
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
TRUSTSTORE_TYPE: JCEKS
KEYSTORE_TYPE: JCEKS <% } %> <% if (replication == 'true') { %>
ENABLE_MASTER: "true"
@@ -64,7 +64,7 @@ services:
NUM_SHARDS: "2"
SHARD_ID: "0" <% } %> <% if (explicitRouting == 'true') { %>
EXPLICIT_ROUTING_SHARDING: "true" <% } %>
mem_limit: 1200m
mem_limit: 1200m
environment:
#Solr needs to know how to register itself with Alfresco
SOLR_ALFRESCO_HOST: "alfresco"
@@ -102,10 +102,10 @@ services:
build:
context: ./search
args:
SEARCH_TAG: ${SEARCH_CE_TAG}
SEARCH_TAG: ${SEARCH_TAG}
SOLR_HOSTNAME: solr6secondary
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
ALFRESCO_HOSTNAME: alfresco
ALFRESCO_COMMS: <%=secureComms%> <% if (httpMode == 'https') { %>
TRUSTSTORE_TYPE: JCEKS
KEYSTORE_TYPE: JCEKS <% } %> <% if (replication == 'true') { %>
ENABLE_MASTER: "true"
@@ -150,7 +150,7 @@ services:
<% } %>
<% if (zeppelin == 'true') { %>
zeppelin:
zeppelin:
build:
context: ./zeppelin
args: