Platform archetype - Switch to docker environment

Change the platform project to add the required configuration to execute it
as an orchestrated docker environment that includes ACS, Share (optional),
PostgreSQL and ASS. This will replace the use of the Alfresco Maven Plugin.

New bash scripts has been added to manage the docker environment.
A new docker-compose file configure the docker environment.
All the unnecessary files and configuration have been removed from the archetype.
This commit is contained in:
Jose Luis Osorno 2018-12-19 14:13:48 +01:00
parent 779d53a051
commit 82cb58f472
23 changed files with 685 additions and 320 deletions

View File

@ -4,7 +4,7 @@
SET COMPOSE_FILE_PATH=%CD%\target\classes\docker\docker-compose.yml
IF [%1]==[] (
echo "Usage: %0 {build_start|stop|purge|tail|reload_share|reload_acs|build_test|test}"
echo "Usage: %0 {build_start|start|stop|purge|tail|reload_share|reload_acs|build_test|test}"
GOTO END
)
@ -57,7 +57,7 @@ IF %1==test (
CALL :test
GOTO END
)
echo "Usage: %0 {build_start|stop|purge|tail|reload_share|reload_acs|build_test|test}"
echo "Usage: %0 {build_start|start|stop|purge|tail|reload_share|reload_acs|build_test|test}"
:END
EXIT /B %ERRORLEVEL%

View File

@ -98,5 +98,5 @@ case "${symbol_dollar}1" in
test
;;
*)
echo "Usage: ${symbol_dollar}0 {build_start|stop|purge|tail|reload_share|reload_acs|build_test|test}"
echo "Usage: ${symbol_dollar}0 {build_start|start|stop|purge|tail|reload_share|reload_acs|build_test|test}"
esac

View File

@ -11,12 +11,46 @@
</requiredProperties>
<fileSets>
<fileSet encoding="UTF-8" filtered="true">
<directory>docker</directory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false" encoding="UTF-8">
<directory>src/main/assembly</directory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/main/docker/license</directory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/main/docker</directory>
<includes>
<include>license/**</include>
<include>Dockerfile</include>
<include>disable-webscript-caching-context.xml</include>
</includes>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</fileSet>
<fileSet encoding="UTF-8" filtered="true">
<directory>src/main/docker</directory>
<includes>
<include>**/*.properties</include>
</includes>
<excludes>
<exclude>license/**</exclude>
<exclude>Dockerfile</exclude>
<exclude>disable-webscript-caching-context.xml</exclude>
</excludes>
</fileSet>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
@ -45,37 +79,8 @@
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="true">
<directory>src/test/resources</directory>
<includes>
<include>**/dev-log4j.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/test/resources</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/dev-log4j.properties</exclude>
</excludes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/test/properties</directory>
<includes>
<include>**/*.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/test/license</directory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory></directory>
<includes>
<include>debug.sh</include>
<include>debug.bat</include>
<include>run.sh</include>
<include>run.bat</include>
<include>README.md</include>

View File

@ -1,9 +0,0 @@
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Dev environment startup script for Alfresco Community ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
set MAVEN_OPTS=-Xms256m -Xmx2G
mvnDebug clean install alfresco:run

View File

@ -1,3 +0,0 @@
#!/bin/bash
MAVEN_OPTS="-Xms256m -Xmx2G" mvnDebug clean install alfresco:run

View File

@ -0,0 +1,54 @@
#set( $symbol_dollar = '$' )
version: '3.4'
services:
${rootArtifactId}-share:
image: ${symbol_dollar}{docker.share.image}:${symbol_dollar}{alfresco.share.version}
environment:
REPO_HOST: ${rootArtifactId}-acs
REPO_PORT: 8080
ports:
- "${symbol_dollar}{share.port}:8080"
${rootArtifactId}-acs:
image: alfresco-content-services-${rootArtifactId}:development
build:
dockerfile: ./Dockerfile
context: ../../../target
environment:
CATALINA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888"
ports:
- "${symbol_dollar}{acs.port}:8080"
- "${symbol_dollar}{acs.debug.port}:8888"
volumes:
- alf-acs-volume:/usr/local/tomcat/alf_data
depends_on:
- ${rootArtifactId}-postgres
${rootArtifactId}-postgres:
image: postgres:9.6
environment:
POSTGRES_DB: alfresco
POSTGRES_USER: alfresco
POSTGRES_PASSWORD: alfresco
ports:
- "${symbol_dollar}{postgres.port}:5432"
volumes:
- alf-db-volume:/var/lib/postgresql/data
${rootArtifactId}-ass:
image: alfresco/alfresco-search-services:1.2.0
environment:
SOLR_ALFRESCO_HOST: ${rootArtifactId}-acs
SOLR_ALFRESCO_PORT: 8080
SOLR_SOLR_HOST: ${rootArtifactId}-ass
SOLR_SOLR_PORT: 8983
SOLR_CREATE_ALFRESCO_DEFAULTS: alfresco,archive
ports:
- "8983:8983"
volumes:
- alf-ass-volume:/opt/alfresco-search-services/contentstore
- alf-ass-volume:/opt/alfresco-search-services/data
volumes:
alf-acs-volume:
external: true
alf-db-volume:
external: true
alf-ass-volume:
external: true

View File

@ -5,8 +5,8 @@
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<name>${artifactId} Platform Jar Module - SDK 4.0</name>
<description>Platform JAR Module (to be included in the alfresco.war) - SDK 4.0</description>
<name>${artifactId} Platform/Repository JAR Module</name>
<description>Platform/Repo JAR Module (to be included in the alfresco.war)</description>
<packaging>jar</packaging>
<properties>
@ -15,49 +15,91 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Alfresco Data directory, which will contain:
Content Store (i.e. the files we upload)
Database (i.e. the metadata for the uploaded files)
Search index (i.e. the indexed content and metadata)
Configured in alfresco-global.properties with the 'dir.root' property.
-->
<alfresco.data.location>${session.executionRootDirectory}/alf_data_dev</alfresco.data.location>
<!-- Properties used in dependency declarations, you don't need to change these -->
<alfresco.groupId>org.alfresco</alfresco.groupId>
<!-- COMMUNITY -->
<alfresco.bomDependencyArtifactId>acs-community-packaging</alfresco.bomDependencyArtifactId>
<!-- Alfresco Platform webapp version, this is the original Alfresco webapp that will be
customized and then deployed and run by the tomcat maven plugin when
executing for example $ mvn clean install alfresco:run -->
<alfresco.platform.version>6.0.7-ga</alfresco.platform.version>
<!-- Alfresco Share version, so we can bring in correct alfresco-share-services artifact -->
<alfresco.share.version>6.0.c</alfresco.share.version>
<!-- ENTERPRISE -->
<!--<alfresco.bomDependencyArtifactId>acs-packaging</alfresco.bomDependencyArtifactId>-->
<!--<alfresco.platform.version>6.0.0.2</alfresco.platform.version>-->
<!--<alfresco.share.version>6.0</alfresco.share.version>-->
<!-- Docker images -->
<!-- COMMUNITY -->
<docker.acs.image>alfresco/alfresco-content-repository-community</docker.acs.image>
<docker.share.image>alfresco/alfresco-share</docker.share.image>
<!-- ENTERPRISE -->
<!--<docker.acs.image>alfresco/alfresco-content-repository</docker.acs.image>-->
<!--<docker.share.image>alfresco/alfresco-share</docker.share.image>-->
<!-- JRebel Hot reloading of classpath stuff and web resource stuff -->
<jrebel.version>1.1.6</jrebel.version>
<!-- Environment to use, Alfresco Maven Plugin will
copy alfresco-global-*.properties files from this directory, such as src/test/properties/local -->
<env>local</env>
<!-- Compile with Java 8, default is 5 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- Environment configuration properties -->
<share.port>8180</share.port>
<share.debug.port>9898</share.debug.port>
<acs.host>${artifactId}-acs</acs.host>
<acs.port>8080</acs.port>
<acs.debug.port>8888</acs.debug.port>
<postgres.port>5555</postgres.port>
<!-- This parameter is only required for those cases in which ACS is not exposed in http://localhost:8080/alfresco (i.e. Windows Docker) -->
<test.acs.endpoint.path></test.acs.endpoint.path>
<!-- Compile with Java 7, default is 5 -->
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<!-- Libs used in Unit and Integration tests -->
<!-- IMPORTANT - Test dependencies need to be here in the top parent POM as
the Alfresco Maven IT Mojo runs as part of the parent project ... -->
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
<scope>test</scope>
</dependency>
<!-- The main Alfresco Repo dependency for compiling Java code in src/main/java -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-remote-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Bring in Alfresco RAD so we get access to AlfrescoTestRunner classes -->
<dependency>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-rad</artifactId>
<version>${alfresco.sdk.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<!-- This will import the dependencyManagement for all artifacts in the selected Alfresco platform.
NOTE: You still need to define dependencies in your POM,
but you can omit version as it's enforced by this dependencyManagement.
NOTE: You still need to define dependencies in your POM, but you can omit version as
it's enforced by this dependencyManagement.
NOTE: It defaults to the latest version this SDK pom has been tested with,
but alfresco version can/should be overridden in your project's pom
-->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>${alfresco.bomDependencyArtifactId}</artifactId>
@ -68,89 +110,206 @@
</dependencies>
</dependencyManagement>
<dependencies>
<!-- The main Alfresco Repo dependency for compiling Java code in src/main/java -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-remote-api</artifactId>
</dependency>
<build>
<plugins>
<!-- Filter the test resource files in the AIO parent project, and do property substitutions.
We need this config so this is done before the Alfresco Maven Plugin 'run' is executed. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<encoding>UTF-8</encoding>
<nonFilteredFileExtensions> <!-- jpg, jpeg, gif, bmp and png are added automatically -->
<nonFilteredFileExtension>ftl</nonFilteredFileExtension>
<nonFilteredFileExtension>acp</nonFilteredFileExtension>
<nonFilteredFileExtension>svg</nonFilteredFileExtension>
<nonFilteredFileExtension>pdf</nonFilteredFileExtension>
<nonFilteredFileExtension>doc</nonFilteredFileExtension>
<nonFilteredFileExtension>docx</nonFilteredFileExtension>
<nonFilteredFileExtension>xls</nonFilteredFileExtension>
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
<nonFilteredFileExtension>ppt</nonFilteredFileExtension>
<nonFilteredFileExtension>pptx</nonFilteredFileExtension>
<nonFilteredFileExtension>bin</nonFilteredFileExtension>
<nonFilteredFileExtension>lic</nonFilteredFileExtension>
<nonFilteredFileExtension>swf</nonFilteredFileExtension>
<nonFilteredFileExtension>zip</nonFilteredFileExtension>
<nonFilteredFileExtension>msg</nonFilteredFileExtension>
<nonFilteredFileExtension>jar</nonFilteredFileExtension>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>eot</nonFilteredFileExtension>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
<nonFilteredFileExtension>css</nonFilteredFileExtension>
<nonFilteredFileExtension>ico</nonFilteredFileExtension>
<nonFilteredFileExtension>psd</nonFilteredFileExtension>
<nonFilteredFileExtension>js</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
<executions>
<execution>
<id>copy-and-filter-docker-compose-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/docker</outputDirectory>
<resources>
<resource>
<directory>docker</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-and-filter-docker-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<resources>
<resource>
<directory>src/main/docker</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.jar</exclude>
<exclude>**/*.so</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-and-filter-docker-resources-non-filtered</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<resources>
<resource>
<directory>src/main/docker</directory>
<filtering>false</filtering>
<includes>
<include>**/*.jar</include>
<include>**/*.so</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Bring in Alfresco RAD so we get access to AlfrescoTestRunner classes -->
<dependency>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.2</version>
<executions>
<!-- Copy the repository extension and the dependencies required for execute integration tests -->
<execution>
<id>copy-repo-extension</id>
<phase>pre-integration-test</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
</artifactItem>
<!-- Test dependencies -->
<!-- We need these dependencies installed in ACS in order to execute the test remotely making use of the Alfresco RAD module -->
<artifactItem>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-rad</artifactId>
<version>${alfresco.sdk.version}</version>
<scope>test</scope>
</dependency>
<!-- Bring in Spring Context so we can use ApplicationContext, ApplicationContextAware etc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>test</scope>
</dependency>
<!-- Integration tests need httpcomponents to execute tests -->
<dependency>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!--
The Alfresco Maven Plugin contains all the logic to run the extension
in an embedded Tomcat with the H2 database.
-->
<plugin>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>alfresco-maven-plugin</artifactId>
<version>${alfresco.sdk.version}</version>
<executions>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<!-- Copy other dependencies (JARs or AMPs) declared in the platform module -->
<execution>
<id>start-alfresco</id>
<goals>
<goal>it</goal>
</goals>
<id>copy-third-party-dependencies</id>
<phase>pre-integration-test</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<!-- Runs the integration tests, any class that follows naming convention
"**/IT*.java", "**/*IT.java", and "**/*ITCase.java" will be considered an integration test -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<!-- This is a platform extension JAR, so we need the platform webapp (alfresco.war) -->
<enablePlatform>true</enablePlatform>
<!-- We don't need the share.war if we don't have any UI extensions -->
<enableShare>false</enableShare>
<!-- Enable the REST API Explorer -->
<enableApiExplorer>true</enableApiExplorer>
<!--
JARs and AMPs that should be overlayed/applied to the Platform/Repository WAR
(i.e. alfresco.war)
-->
<platformModules>
<!-- This AMP is needed if we are going to access the platform webapp from a Share webapp -->
<!-- Share Services will be ignored if you are on Platform earlier than 5.1 -->
<moduleDependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-share-services</artifactId>
<version>${alfresco.share.version}</version>
<type>amp</type>
</moduleDependency>
<!-- Bring in this JAR project, need to be included here, otherwise resources from META-INF
will not be loaded, such as the test.html page
-->
<moduleDependency>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</moduleDependency>
</platformModules>
<systemPropertyVariables>
<acs.endpoint.path>${test.acs.endpoint.path}</acs.endpoint.path>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify-test</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.19.1</version>
</dependency>
</dependencies>
</plugin>
<!--
@ -162,6 +321,7 @@
-->
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
@ -208,10 +368,8 @@
<fallback>all</fallback>
<resources>
<resource>
<!--
Empty resource element marks default configuration. By
default it is placed first in generated configuration.
-->
<directory>${project.build.outputDirectory}</directory>
<directory>${project.build.testOutputDirectory}</directory>
</resource>
</resources>
</classpath>
@ -224,73 +382,6 @@
<alwaysGenerate>true</alwaysGenerate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<encoding>UTF-8</encoding>
<nonFilteredFileExtensions> <!-- jpg, jpeg, gif, bmp and png are added automatically -->
<nonFilteredFileExtension>ftl</nonFilteredFileExtension>
<nonFilteredFileExtension>acp</nonFilteredFileExtension>
<nonFilteredFileExtension>svg</nonFilteredFileExtension>
<nonFilteredFileExtension>pdf</nonFilteredFileExtension>
<nonFilteredFileExtension>doc</nonFilteredFileExtension>
<nonFilteredFileExtension>docx</nonFilteredFileExtension>
<nonFilteredFileExtension>xls</nonFilteredFileExtension>
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
<nonFilteredFileExtension>ppt</nonFilteredFileExtension>
<nonFilteredFileExtension>pptx</nonFilteredFileExtension>
<nonFilteredFileExtension>bin</nonFilteredFileExtension>
<nonFilteredFileExtension>lic</nonFilteredFileExtension>
<nonFilteredFileExtension>swf</nonFilteredFileExtension>
<nonFilteredFileExtension>zip</nonFilteredFileExtension>
<nonFilteredFileExtension>msg</nonFilteredFileExtension>
<nonFilteredFileExtension>jar</nonFilteredFileExtension>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>eot</nonFilteredFileExtension>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
<nonFilteredFileExtension>css</nonFilteredFileExtension>
<nonFilteredFileExtension>ico</nonFilteredFileExtension>
<nonFilteredFileExtension>psd</nonFilteredFileExtension>
<nonFilteredFileExtension>js</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
<!-- Runs the integration tests, any class that follows naming convention
"**/IT*.java", "**/*IT.java", and "**/*ITCase.java" will be considered an integration test -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify-test</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.19.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<resources>
@ -307,10 +398,6 @@
<filtering>true</filtering>
</testResource>
</testResources>
</build>
<!--
@ -335,6 +422,7 @@
<url>https://artifacts.alfresco.com/nexus/content/groups/private</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>alfresco-plugin-public</id>
@ -349,5 +437,4 @@
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -1,8 +1,75 @@
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Dev environment startup script for Alfresco Community ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
#set( $symbol_dollar = '$' )
@ECHO OFF
set MAVEN_OPTS=-Xms256m -Xmx2G
SET COMPOSE_FILE_PATH=%CD%\target\classes\docker\docker-compose.yml
mvn clean install alfresco:run
IF [%1]==[] (
echo "Usage: %0 {build_start|start|stop|purge|tail|build_test|test}"
GOTO END
)
IF %1==build_start (
CALL :down
CALL :build
CALL :start
CALL :tail
GOTO END
)
IF %1==start (
CALL :start
CALL :tail
GOTO END
)
IF %1==stop (
CALL :down
GOTO END
)
IF %1==purge (
CALL:down
CALL:purge
GOTO END
)
IF %1==tail (
CALL :tail
GOTO END
)
IF %1==build_test (
CALL :down
CALL :build
CALL :start
CALL :test
CALL :down
GOTO END
)
IF %1==test (
CALL :test
GOTO END
)
echo "Usage: %0 {build_start|start|stop|purge|tail|build_test|test}"
:END
EXIT /B %ERRORLEVEL%
:start
docker volume create alf-acs-volume
docker volume create alf-db-volume
docker volume create alf-ass-volume
docker-compose -f "%COMPOSE_FILE_PATH%" up --build -d
EXIT /B 0
:down
docker-compose -f "%COMPOSE_FILE_PATH%" down
EXIT /B 0
:build
docker rmi alfresco-content-services-${rootArtifactId}:development
call mvn clean install -DskipTests
EXIT /B 0
:tail
docker-compose -f "%COMPOSE_FILE_PATH%" logs -f
EXIT /B 0
:test
call mvn verify
EXIT /B 0
:purge
docker volume rm alf-acs-volume
docker volume rm alf-db-volume
docker volume rm alf-ass-volume
EXIT /B 0

View File

@ -1,3 +1,69 @@
#!/bin/bash
#set( $symbol_dollar = '$' )
#!/bin/sh
MAVEN_OPTS="-Xms256m -Xmx2G" mvn clean install alfresco:run
export COMPOSE_FILE_PATH=${symbol_dollar}{PWD}/target/classes/docker/docker-compose.yml
start() {
docker volume create alf-acs-volume
docker volume create alf-db-volume
docker volume create alf-ass-volume
docker-compose -f ${symbol_dollar}COMPOSE_FILE_PATH up --build -d
}
down() {
docker-compose -f ${symbol_dollar}COMPOSE_FILE_PATH down
}
purge() {
docker volume rm alf-acs-volume
docker volume rm alf-db-volume
docker volume rm alf-ass-volume
}
build() {
docker rmi alfresco-content-services-${rootArtifactId}:development
mvn clean install -DskipTests=true
}
tail() {
docker-compose -f ${symbol_dollar}COMPOSE_FILE_PATH logs -f
}
test() {
mvn verify
}
case "${symbol_dollar}1" in
build_start)
down
build
start
tail
;;
start)
start
tail
;;
stop)
down
;;
purge)
down
purge
;;
tail)
tail
;;
build_test)
down
build
start
test
down
;;
test)
test
;;
*)
echo "Usage: ${symbol_dollar}0 {build_start|start|stop|purge|tail|build_test|test}"
esac

View File

@ -0,0 +1,18 @@
FROM ${docker.acs.image}:${alfresco.platform.version}
ARG TOMCAT_DIR=/usr/local/tomcat
# Copy Dockerfile to avoid an error if no JARs exist
COPY Dockerfile extensions/*.jar $TOMCAT_DIR/webapps/alfresco/WEB-INF/lib/
# Copy Dockerfile to avoid an error if no AMPs exist
COPY Dockerfile extensions/*.amp $TOMCAT_DIR/amps/
RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \
$TOMCAT_DIR/amps $TOMCAT_DIR/webapps/alfresco -directory -nobackup -force
COPY alfresco-global.properties $TOMCAT_DIR/shared/classes/alfresco-global.properties
COPY dev-log4j.properties $TOMCAT_DIR/shared/classes/alfresco/extension
COPY disable-webscript-caching-context.xml $TOMCAT_DIR/shared/classes/alfresco/extension
# Copy Dockerfile to avoid an error if no license file exists
COPY Dockerfile license/*.* $TOMCAT_DIR/webapps/alfresco/WEB-INF/classes/alfresco/extension/license/

View File

@ -1,3 +1,6 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
@ -15,14 +18,12 @@
# RUN TIME PROPERTIES
# -------------------
########################################################################################################################
#
# Alfresco configuration for running locally with PostgreSQL Database
#
# Configuration when running Tomcat embedded from Maven.
# Property values from the POM but it can also be edited here.
########################################################################################################################
dir.root=${alfresco.data.location}
#
# Alfresco Repo Webapp (alfresco.war) context, ports etc
alfresco.context=alfresco
@ -33,14 +34,9 @@ alfresco.protocol=http
# Alfresco Share Webapp (share.war) context, ports etc
share.context=share
share.host=localhost
share.port=8080
share.port=8180
share.protocol=http
index.subsystem.name=solr4
solr.host=localhost
solr.port=8080
solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
@ -57,12 +53,24 @@ integrity.failOnError=true
# Alfresco Repository PostgreSQL Database configuration.
# The PostgreSQL Driver is brought in via the tomcat7-maven-plugin as a dependency.
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost:5432/alfrescoaio
# This Alfresco Platform Configuration file should be used for custom properties that are introduced by this module.
# Define default values for all properties here.
# System Administrators can override these values in environment specific configurations in
# alfresco/tomcat/shared/classes/alfresco-global.properties.
#
index.subsystem.name=solr6
solr.host=${rootArtifactId}-ass
solr.port=8983
solr.secureComms=none
db.username=alfresco
db.password=alfresco
db.pool.initial=10
db.pool.max=100
db.url=jdbc:postgresql://${rootArtifactId}-postgres:5432/alfresco
# File servers related properties
# For local runs we disable CIFS and FTP
cifs.enabled=false

View File

@ -4,7 +4,6 @@
# Set root logger level to error
log4j.rootLogger=error, Console, File
###### Console appender definition #######
# All outputs currently set to be a ConsoleAppender.
log4j.appender.Console=org.apache.log4j.ConsoleAppender
@ -14,7 +13,6 @@ log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n
#log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
###### File appender definition #######
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=alfresco.log
log4j.appender.File.Append=true
@ -22,13 +20,11 @@ log4j.appender.File.DatePattern='.'yyyy-MM-dd
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d{yyyy-MM-dd} %d{ABSOLUTE} %-5p [%c] [%t] %m%n
###### Hibernate specific appender definition #######
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
###### Log level overrides #######
# Commented-in loggers will be exposed as JMX MBeans (refer to org.alfresco.repo.admin.Log4JHierarchyInit)
# Hence, generally useful loggers should be listed with at least ERROR level to allow simple runtime
@ -64,8 +60,7 @@ log4j.logger.org.apache.myfaces.taglib=error
# OpenOfficeConnection
log4j.logger.net.sf.jooreports.openoffice.connection=fatal
# log prepared statement cache activity ###
log4j.logger.org.hibernate.ps.PreparedStatementCache=info
# log prepared statement cache activity log4j.logger.org.hibernate.ps.PreparedStatementCache=info
# Alfresco
log4j.logger.org.alfresco=error
@ -215,7 +210,6 @@ log4j.logger.org.jbpm.graph.def.GraphElement=fatal
#log4j.logger.org.alfresco.repo.googledocs=debug
###### Scripting #######
# Web Framework
log4j.logger.org.springframework.extensions.webscripts=info
@ -271,3 +265,6 @@ log4j.logger.org.alfresco.enterprise.repo.authorization.AuthorizationsConsistenc
#-----------------------------------------------------------------------
log4j.logger.${package}.platformsample.DemoComponent=debug
log4j.logger.${package}.platformsample.HelloWorldWebScript=debug

View File

@ -1,3 +1,6 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
# Enable hotswap so that changes in this module will be automatically reloaded
# Watch for changed class files on watchResources path and reload class definition in the running application.
autoHotswap=true
@ -11,7 +14,7 @@ autoHotswap=true
# i.e. monitor /target/classes
# should work with extraClasspath=${project.build.outputDirectory}
# If not try
extraClasspath=${project.build.outputDirectory};${project.build.testOutputDirectory}
extraClasspath=/usr/local/tomcat/hotswap-agent
# Comma separated list of disabled plugins
# Use plugin name - e.g.
@ -23,12 +26,12 @@ disabledPlugins=Hibernate,Spring
#
# Load web application resources (such as HTML, JSP, CSS, ...) from this directory prior to default processing.
# Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp).
extraWebappContext=${project.build.outputDirectory}/META-INF/resources
extraWebappContext=/usr/local/tomcat/hotswap-agent/${rootArtifactId}-platform-jar/target/classes/META-INF/resources;
# Load static web resources from different directory.
#
# This setting is dependent on application server plugin(Jetty, Tomcat, JBoss, ...)
webappDir=${project.build.outputDirectory}/META-INF/resources
webappDir=/usr/local/tomcat/hotswap-agent/${rootArtifactId}-platform-jar/target/classes/META-INF/resources;
# Watch for changes in a directory (resources only).
#

View File

@ -0,0 +1,6 @@
# Enterprise License location
Put the Alfresco Enterprise license file in this directory.
It will then be copied into the ACS container in the
$TOMCAT_DIR/WEB-INF/classes/alfresco/extension/license directory.

View File

@ -1,6 +1,23 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ${package}.platformsample;
/**

View File

@ -1,22 +1,23 @@
#set($symbol_pound='#')
#set($symbol_dollar='$')
#set($symbol_escape='\' )
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ${package}.platformsample;
import org.alfresco.repo.module.AbstractModuleComponent;

View File

@ -1,22 +1,23 @@
#set($symbol_pound='#')
#set($symbol_dollar='$')
#set($symbol_escape='\' )
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ${package}.platformsample;
import org.springframework.extensions.webscripts.Cache;

View File

@ -20,6 +20,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- This is filtered by Maven at build time, so that module name is single sourced. -->
<!-- Note. The bootstrap-context.xml file has to be loaded first.
Otherwise your custom models are not yet loaded when your service beans are instantiated and you

View File

@ -0,0 +1,56 @@
#set($symbol_pound='#')
#set($symbol_dollar='$')
#set($symbol_escape='\' )
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ${package}.platformsample;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.extensions.webscripts.*;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* Unit testing the Web Script Java Controller
*
* @author martin.bergljung@alfresco.com
* @version 1.0
* @since 3.0
*/
public class HelloWorldWebScriptControllerTest {
@Test
public void testController() {
WebScriptRequest req = Mockito.mock(WebScriptRequest.class);
Status status = Mockito.mock(Status.class);
Cache cache = Mockito.mock(Cache.class);
String helloPropName = "fromJava";
String helloPropExpectedValue = "HelloFromJava";
HelloWorldWebScript ws = new HelloWorldWebScript();
Map<String, Object> model = ws.executeImpl(req, status, cache);
assertNotNull("Response from Web Script Java Controller is null", model);
assertEquals("Incorrect Web Script Java Controller Response",
helloPropExpectedValue, model.get(helloPropName));
}
}

View File

@ -1,10 +0,0 @@
# Enterprise License location
Put the Alfresco Enterprise license file in this directory.
It will then be copied into the Platform WAR in the
WEB-INF/classes/alfresco/extension/license directory.
And then not be part of any other classpaths.