Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF- ToolKIT 6.2 upgrade #64

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

alfresco-pdf-toolkit
====================

Expand Down Expand Up @@ -46,3 +47,51 @@ AGPL License.
iText - Affero GPL 3 (http://itextpdf.com/terms-of-use/agpl.php)




# Alfresco AIO Project - SDK 4.0

This is an All-In-One (AIO) project for Alfresco SDK 4.0.

Run with `./run.sh build_start` or `./run.bat build_start` and verify that it

* Runs Alfresco Content Service (ACS)
* Runs Alfresco Share
* Runs Alfresco Search Service (ASS)
* Runs PostgreSQL database
* Deploys the JAR assembled modules

All the services of the project are now run as docker containers. The run script offers the next tasks:

* `build_start`. Build the whole project, recreate the ACS and Share docker images, start the dockerised environment composed by ACS, Share, ASS and
PostgreSQL and tail the logs of all the containers.
* `build_start_it_supported`. Build the whole project including dependencies required for IT execution, recreate the ACS and Share docker images, start the
dockerised environment composed by ACS, Share, ASS and PostgreSQL and tail the logs of all the containers.
* `start`. Start the dockerised environment without building the project and tail the logs of all the containers.
* `stop`. Stop the dockerised environment.
* `purge`. Stop the dockerised container and delete all the persistent data (docker volumes).
* `tail`. Tail the logs of all the containers.
* `reload_share`. Build the Share module, recreate the Share docker image and restart the Share container.
* `reload_acs`. Build the ACS module, recreate the ACS docker image and restart the ACS container.
* `build_test`. Build the whole project, recreate the ACS and Share docker images, start the dockerised environment, execute the integration tests from the
`integration-tests` module and stop the environment.
* `test`. Execute the integration tests (the environment must be already started).

# Few things to notice

* No parent pom
* No WAR projects, the jars are included in the custom docker images
* No runner project - the Alfresco environment is now managed through [Docker](https://www.docker.com/)
* Standard JAR packaging and layout
* Works seamlessly with Eclipse and IntelliJ IDEA
* JRebel for hot reloading, JRebel maven plugin for generating rebel.xml [JRebel integration documentation]
* AMP as an assembly
* Persistent test data through restart thanks to the use of Docker volumes for ACS, ASS and database data
* Integration tests module to execute tests against the final environment (dockerised)
* Resources loaded from META-INF
* Web Fragment (this includes a sample servlet configured via web fragment)

# TODO

* Abstract assembly into a dependency so we don't have to ship the assembly in the archetype
* Functional/remote unit tests
59 changes: 59 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
version: '3.4'
services:
pdf-toolkit-share:
image: alfresco-share-pdf-toolkit:development
build:
dockerfile: ./Dockerfile
context: ../../../pdf-toolkit-share-docker/target
environment:
CATALINA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8888"
REPO_HOST: pdf-toolkit-acs
REPO_PORT: 8080
ports:
- "${share.port}:8080"
- "${share.debug.port}:8888"
pdf-toolkit-acs:
image: alfresco-content-services-pdf-toolkit:development
build:
dockerfile: ./Dockerfile
context: ../../../pdf-toolkit-platform-docker/target
environment:
CATALINA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8888"
ports:
- "${acs.port}:8080"
- "${acs.debug.port}:8888"
volumes:
- pdf-toolkit-acs-volume:/usr/local/tomcat/alf_data
depends_on:
- pdf-toolkit-postgres
pdf-toolkit-postgres:
image: postgres:9.6
environment:
POSTGRES_DB: alfresco
POSTGRES_USER: alfresco
POSTGRES_PASSWORD: alfresco
command: postgres -c max_connections=300 -c log_min_messages=LOG
ports:
- "${postgres.port}:5432"
volumes:
- pdf-toolkit-db-volume:/var/lib/postgresql/data
pdf-toolkit-ass:
image: alfresco/alfresco-search-services:1.2.0
environment:
SOLR_ALFRESCO_HOST: pdf-toolkit-acs
SOLR_ALFRESCO_PORT: 8080
SOLR_SOLR_HOST: pdf-toolkit-ass
SOLR_SOLR_PORT: 8983
SOLR_CREATE_ALFRESCO_DEFAULTS: alfresco,archive
ports:
- "8983:8983"
volumes:
- pdf-toolkit-ass-volume:/opt/alfresco-search-services/contentstore
- pdf-toolkit-ass-volume:/opt/alfresco-search-services/data
volumes:
pdf-toolkit-acs-volume:
external: true
pdf-toolkit-db-volume:
external: true
pdf-toolkit-ass-volume:
external: true
76 changes: 76 additions & 0 deletions pdf-toolkit-integration-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>pdf-toolkit-integration-tests</artifactId>
<name>Integration Tests Module</name>
<description>Integration Tests module for in-container integration testing - part of AIO - SDK 4.0</description>
<packaging>jar</packaging> <!-- Note. this just runs Integration Tests, but it needs to be a JAR otherwise
nothing is compiled (i.e. you cannot set it to pom) -->

<parent>
<groupId>org.alfresco.extension</groupId>
<artifactId>alfresco-pdf-toolkit</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<properties>
</properties>

<dependencies>
<!-- Bring in any custom module that should be tested, by default we bring in the Platform JAR module
that is generated for the AIO project -->
<dependency>
<groupId>org.alfresco.extension</groupId>
<artifactId>pdf-toolkit-platform</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>

<plugins>

<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<configuration>
<rebelXmlDirectory>${project.build.testOutputDirectory}</rebelXmlDirectory>
</configuration>
</plugin>

<!-- Make sure we attach the tests so we can include them when running -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</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>
<configuration>
<systemPropertyVariables>
<acs.endpoint.path>${test.acs.endpoint.path}</acs.endpoint.path>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
130 changes: 130 additions & 0 deletions pdf-toolkit-platform-docker/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>pdf-toolkit-platform-docker</artifactId>
<name>Alfresco Platform/Repository Docker Module</name>
<description>Platform/Repo Docker Module to generate the final Docker image</description>
<packaging>jar</packaging>

<parent>
<groupId>org.alfresco.extension</groupId>
<artifactId>alfresco-pdf-toolkit</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<properties>
</properties>

<dependencies>
<dependency>
<groupId>org.alfresco.extension</groupId>
<artifactId>pdf-toolkit-platform</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.alfresco.extension</groupId>
<artifactId>pdf-toolkit-integration-tests</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
<!-- Add any additional AMPs or extension JARs here that you want to be deployed in Alfresco -->
<!-- IMPORTANT:
If using amp extensions only, add <includeTypes>amp</includeTypes> to the "collect-extensions" execution below.
If using both amp and jar extensions, you have to add:
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
to each amp dependency definition.
-->
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!-- Copy the repository extension and the dependencies required for execute integration tests -->
<execution>
<id>collect-test-artifacts</id>
<phase>pre-integration-test</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
<excludeScope>compile</excludeScope>
</configuration>
</execution>
<!-- Collect extensions (JARs or AMPs) declared in this module do be deployed to docker -->
<execution>
<id>collect-extensions</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
<includeScope>runtime</includeScope>
<!-- IMPORTANT: if using amp dependencies only, add <includeTypes>amp</includeTypes> -->
</configuration>
</execution>
</executions>
</plugin>
<!-- Filter the Dockerfile and the other files added to the container to be able to replace maven properties -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<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>
<exclude>**/*.gz</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>
<include>**/*.gz</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
22 changes: 22 additions & 0 deletions pdf-toolkit-platform-docker/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ${docker.acs.image}:${alfresco.platform.version}

ARG TOMCAT_DIR=/usr/local/tomcat

USER root

# 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/

USER ${USERNAME}
Loading