Enable custom model deployments for repository and custom forms deployments to Share.

This commit is contained in:
Angel Borroy
2019-08-06 16:57:26 +02:00
parent 968909f6e4
commit d130d05252
12 changed files with 126 additions and 13 deletions

View File

@@ -27,20 +27,32 @@ generators/app/templates/
│   ├── alfresco │   ├── alfresco
│   │   ├── Dockerfile │   │   ├── Dockerfile
│   │   └── model │   │   └── model
│   │   ├── empty
│   │   ├── sharding-content-model-context.xml │   │   ├── sharding-content-model-context.xml
│   │   └── sharding-content-model.xml │   │   └── sharding-content-model.xml
│   ├── search │   ├── search
│   │   └── Dockerfile │   │   └── Dockerfile
│   ├── share
│   │   ├── Dockerfile
│   │   └── model
│   │   ├── empty.xml
│   │   └── sharding-share-config-custom.xml
│   └── zeppelin │   └── zeppelin
│   └── Dockerfile │   └── Dockerfile
└── keystores └── keystores
├── alfresco
├── client
├── solr
└── zeppelin
``` ```
* `.env` includes default values for Docker Compose environment variables * `.env` includes default values for Docker Compose environment variables
* `docker-compose-ce.yml` is the base Docker Compose Template for Alfresco Community deployment (for ACS 6.2 and ACS 6.1) * `docker-compose-ce.yml` is the base Docker Compose Template for Alfresco Community deployment (for ACS 6.2 and ACS 6.1)
* `docker-compose-ee.yml` is the base Docker Compose Template for Alfresco Enterprise deployment (for ACS 6.2 and ACS 6.1) * `docker-compose-ee.yml` is the base Docker Compose Template for Alfresco Enterprise deployment (for ACS 6.2 and ACS 6.1)
* `alfresco` includes a Dockerfile template to start Alfresco Repository * `alfresco` includes a Dockerfile template to start Alfresco Repository
* `model` includes a default content model for Sharding Explicit Routing * `model` includes a default content model (Sharding Explicit Routing or empty)
* `share` includes a Dockerfile template to start Share Web Application
* `model` includes a default forms model (Sharding Explicit Routing or empty)
* `search` includes a Dockerfile template to start Search Services and Insight Engine * `search` includes a Dockerfile template to start Search Services and Insight Engine
* `zeppelin` includes a Dockerfile template to start Zeppelin with SSL * `zeppelin` includes a Dockerfile template to start Zeppelin with SSL
* `keystores` includes every truststore and keystore required for SSL configuration * `keystores` includes every truststore and keystore required for SSL configuration
@@ -136,6 +148,30 @@ Custom content model is deployed to provide a property, named `shard:shardId`, h
This default configuration can be changed in the generated `docker-compose.yml` template. This default configuration can be changed in the generated `docker-compose.yml` template.
## Deploying custom content models and forms
Custom content models and Share Form configurations can be added to deployment folders.
**Content models**
Custom content models can be copied to Repository deployment folder by using bootstrap approach.
Following XML files must be created in `alfresco/model/` folder in the Docker Compose template generated:
* `content-model.xml` including an XML Alfresco Content Model file. Sample model is available in [images/alfresco/model/sharding-content-model.xml](generators/app/templates/images/alfresco/model/sharding-content-model.xml)
* `content-model-context.xml` including an XML Spring Bean file with the `dictionaryBootstrap` bean. Sample Spring Bean declaration is available in [images/alfresco/model/sharding-content-model-context.xml](generators/app/templates/images/alfresco/model/sharding-content-model-context.xml)
If *Sharding* is selected, these files will be available in deployment folder.
**Share forms**
Custom content forms can be added to Share configuration by modifying `share/model/share-config-custom-dev.xml` file in the Docker Compose template generated.
Sample configuration is available in [images/share/model/sharding-share-config-custom.xml](generators/app/templates/images/share/model/sharding-share-config-custom.xml)
If *Sharding* is selected, a default `share-config-custom-dev.xml` file with required forms configuration for Sharding custom model will be available in deployment folder. Add your configuration to this file.
## Configuration catalog ## Configuration catalog
| Version | Comms | Replication | Sharding | Explicit | Insight | Zeppelin | | Version | Comms | Replication | Sharding | Explicit | Insight | Zeppelin |

View File

@@ -193,8 +193,7 @@ module.exports = class extends Generator {
searchPath: searchBasePath, searchPath: searchBasePath,
zeppelin: (this.props.zeppelin ? "true" : "false"), zeppelin: (this.props.zeppelin ? "true" : "false"),
sharding: (this.props.sharding ? "true" : "false"), sharding: (this.props.sharding ? "true" : "false"),
shardingMethod: (this.props.shardingMethod), shardingMethod: (this.props.shardingMethod)
shareImage: shareImageName
} }
); );
@@ -209,10 +208,37 @@ module.exports = class extends Generator {
sharding: (this.props.sharding ? "true" : "false") sharding: (this.props.sharding ? "true" : "false")
} }
); );
// Copy Sharding Content Model or an empty file to allow model deployments
if (this.props.sharding) { if (this.props.sharding) {
this.fs.copy( this.fs.copy(
this.templatePath(imagesDirectory + '/alfresco/model'), this.templatePath(imagesDirectory + '/alfresco/model/*.xml'),
this.destinationPath('alfresco/model') this.destinationPath('alfresco/model/')
)
} else {
this.fs.copy(
this.templatePath(imagesDirectory + '/alfresco/model/empty'),
this.destinationPath('alfresco/model/empty')
)
}
// Copy Docker Image for Share applying configuration
this.fs.copyTpl(
this.templatePath(imagesDirectory + '/share/Dockerfile'),
this.destinationPath('share/Dockerfile'),
{
shareImage: shareImageName
}
);
// Copy Sharding Content Forms or an empty file to allow forms deployments
if (this.props.sharding) {
this.fs.copy(
this.templatePath(imagesDirectory + '/share/model/sharding-share-config-custom.xml'),
this.destinationPath('share/model/share-config-custom-dev.xml')
)
} else {
this.fs.copy(
this.templatePath(imagesDirectory + '/share/model/empty.xml'),
this.destinationPath('share/model/share-config-custom-dev.xml')
) )
} }

View File

@@ -124,7 +124,10 @@ services:
<% } %> <% } %>
share: share:
image: <%=shareImage%>:${SHARE_TAG} build:
context: ./share
args:
SHARE_TAG: ${SHARE_TAG}
mem_limit: 1g mem_limit: 1g
environment: environment:
REPO_HOST: "alfresco" REPO_HOST: "alfresco"

View File

@@ -264,7 +264,10 @@ services:
- shared-file-store-volume:/tmp/Alfresco/sfs - shared-file-store-volume:/tmp/Alfresco/sfs
share: share:
image: <%=shareImage%>:${SHARE_TAG} build:
context: ./share
args:
SHARE_TAG: ${SHARE_TAG}
mem_limit: 1g mem_limit: 1g
environment: environment:
REPO_HOST: "alfresco" REPO_HOST: "alfresco"

View File

@@ -178,7 +178,10 @@ services:
- 8094:8090 - 8094:8090
share: share:
image: alfresco/alfresco-share:${SHARE_TAG} build:
context: ./share
args:
SHARE_TAG: ${SHARE_TAG}
mem_limit: 1g mem_limit: 1g
environment: environment:
REPO_HOST: "alfresco" REPO_HOST: "alfresco"

View File

@@ -287,7 +287,10 @@ services:
- shared-file-store-volume:/tmp/Alfresco/sfs - shared-file-store-volume:/tmp/Alfresco/sfs
share: share:
image: alfresco/alfresco-share:${SHARE_TAG} build:
context: ./share
args:
SHARE_TAG: ${SHARE_TAG}
mem_limit: 1g mem_limit: 1g
environment: environment:
REPO_HOST: "alfresco" REPO_HOST: "alfresco"

View File

@@ -48,7 +48,5 @@ RUN if [ "$SOLR_COMMS" == "https" ] ; then \
<\/Connector>/g" ${TOMCAT_DIR}/conf/server.xml; \ <\/Connector>/g" ${TOMCAT_DIR}/conf/server.xml; \
fi fi
<% if (sharding == 'true') { %> # Copy custom content model to deployment folder
# Explicit Routing Sharding content model (useless when not using this feature) COPY model/* $TOMCAT_DIR/shared/classes/alfresco/extension/
COPY model/sharding-content-model*.xml $TOMCAT_DIR/shared/classes/alfresco/extension/
<% } %>

View File

@@ -13,9 +13,11 @@
<aspects> <aspects>
<aspect name="shard:sharding"> <aspect name="shard:sharding">
<title>Sharding</title>
<properties> <properties>
<!-- Shard number to index this content --> <!-- Shard number to index this content -->
<property name="shard:shardId"> <property name="shard:shardId">
<title>Shard Id</title>
<type>d:text</type> <type>d:text</type>
</property> </property>
</properties> </properties>

View File

@@ -0,0 +1,7 @@
ARG SHARE_TAG
FROM <%=shareImage%>:${SHARE_TAG}
ARG TOMCAT_DIR=/usr/local/tomcat
# Copy custom content forms to deployment folder
COPY model/* $TOMCAT_DIR/shared/classes/alfresco/web-extension/

View File

@@ -0,0 +1,5 @@
<alfresco-config>
<!-- Add custom configuration -->
</alfresco-config>

View File

@@ -0,0 +1,27 @@
<alfresco-config>
<!-- Add custom configuration -->
<config evaluator="string-compare" condition="DocumentLibrary">
<aspects>
<visible>
<aspect name="shard:sharding"/>
</visible>
<addable>
</addable>
<removeable>
</removeable>
</aspects>
</config>
<config evaluator="aspect" condition="shard:sharding">
<forms>
<form>
<field-visibility>
<show id="shard:shardId" />
</field-visibility>
</form>
</forms>
</config>
</alfresco-config>