From cfc001806c4cc95bca4672d65818fe780d65dd4c Mon Sep 17 00:00:00 2001 From: Piergiorgio Lucidi Date: Tue, 21 Nov 2023 20:57:24 +0100 Subject: [PATCH] added run scripts (#80), removed old plugins (#68), removed Dockerfiles from target (#79), updated Maven plugins (#76) --- README.md | 2 +- activiti-app-integration-tests/pom.xml | 74 ++++-- .../sdk/integrationtests/FourEyesAppIT.java | 2 +- activiti-app-overlay-docker/pom.xml | 117 +++++++--- .../docker-compose-activiti-admin.yml | 105 +++++++++ .../docker/docker-compose/docker-compose.yml | 83 +++++++ activiti-app-overlay-war/pom.xml | 2 +- aps-extensions-jar/pom.xml | 55 ++++- pom.xml | 40 +++- run.bat | 216 ++++++++++++++++++ run.sh | 203 ++++++++++++++++ 11 files changed, 826 insertions(+), 73 deletions(-) create mode 100644 activiti-app-overlay-docker/src/main/docker/docker-compose/docker-compose-activiti-admin.yml create mode 100644 activiti-app-overlay-docker/src/main/docker/docker-compose/docker-compose.yml create mode 100644 run.bat create mode 100755 run.sh diff --git a/README.md b/README.md index e784d5e..cf2e1e6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Alfresco Process Services SDK Project 2.3.1 +# Alfresco Process Services SDK Project 2.4.0-SNAPSHOT The project consists of the following Maven submodules: diff --git a/activiti-app-integration-tests/pom.xml b/activiti-app-integration-tests/pom.xml index c2c329c..f2a2459 100644 --- a/activiti-app-integration-tests/pom.xml +++ b/activiti-app-integration-tests/pom.xml @@ -7,11 +7,11 @@ org.alfresco.activiti aps-project - 2.3.1 + 2.4.0-SNAPSHOT - 5.2.1 + ${integration.test.httpclient5.version} @@ -73,23 +73,6 @@ ${maven.compiler.target} - - maven-failsafe-plugin - - ${skip.integration.test} - - --illegal-access=permit - - - - - - integration-test - verify - - - - org.apache.maven.plugins maven-dependency-plugin @@ -167,6 +150,59 @@ + + failsafe-openjdk-17 + + false + 17 + + + + + maven-failsafe-plugin + + ${skip.integration.test} + + + + + integration-test + verify + + + + + + + + + failsafe-openjdk-11 + + false + 11 + + + + + maven-failsafe-plugin + + ${skip.integration.test} + + --illegal-access=permit + + + + + + integration-test + verify + + + + + + + \ No newline at end of file diff --git a/activiti-app-integration-tests/src/test/java/com/activiti/sdk/integrationtests/FourEyesAppIT.java b/activiti-app-integration-tests/src/test/java/com/activiti/sdk/integrationtests/FourEyesAppIT.java index 657a4d1..d486192 100644 --- a/activiti-app-integration-tests/src/test/java/com/activiti/sdk/integrationtests/FourEyesAppIT.java +++ b/activiti-app-integration-tests/src/test/java/com/activiti/sdk/integrationtests/FourEyesAppIT.java @@ -55,7 +55,7 @@ public class FourEyesAppIT { protected static final String BASE_PATH_HOSTNAME = "localhost"; protected static final int BASE_PATH_PORT = 8080; - protected static final String appZipFile = "aps-extensions-jar-2.3.1-App.zip"; + protected static final String appZipFile = "aps-extensions-jar-2.4.0-SNAPSHOT-App.zip"; protected static final String ACTIVITI_APP_BASE_PATH = BASE_PATH_PROTOCOL + "://" + BASE_PATH_HOSTNAME + ":" + BASE_PATH_PORT; diff --git a/activiti-app-overlay-docker/pom.xml b/activiti-app-overlay-docker/pom.xml index e88013b..e17c1fc 100644 --- a/activiti-app-overlay-docker/pom.xml +++ b/activiti-app-overlay-docker/pom.xml @@ -7,7 +7,7 @@ org.alfresco.activiti aps-project - 2.3.1 + 2.4.0-SNAPSHOT @@ -70,6 +70,12 @@ 5005 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:${aps.debug.port} + + Dockerfile-${aps.version} + Dockerfile-admin-${aps.version} + + ${project.parent.basedir} + @@ -99,9 +105,57 @@ + + org.apache.maven.plugins + maven-antrun-plugin + ${maven-antrun-plugin.version} + + + org.codehaus.gmaven + groovy-maven-plugin + ${gmaven-plugin.version} + + + org.codehaus.gmaven + groovy-maven-plugin + + + set-project-parent-basedir-for-ant + validate + + execute + + + + project.properties.setProperty('ant.project.parent.basedir', project.parent.basedir.toString()) + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + copy-and-rename-dockerfiles + false + package + + + + + + + + run + + + + maven-dependency-plugin @@ -185,7 +239,7 @@ copy-and-filter-docker-resources - package + prepare-package copy-resources @@ -200,6 +254,19 @@ **/*.so **/*.gz + + **/Dockerfile-${aps.version}* + **/Dockerfile-admin-${aps.version}* + **/docker-compose/*.* + **/config/*.* + **/license/*.* + **/logging/*.* + **/properties/*.* + **/admin + **/admin/properties/*.* + **/admin/tomcat/*.* + **/admin/tomcat/conf/*.* + @@ -271,10 +338,10 @@ linux/amd64, linux/arm64 ${project.parent.basedir}/target - Dockerfile-${aps.version} + ${docker.compose.dockerfile.activiti.app} latest - ${project.version} + ${modified.version} @@ -429,37 +496,11 @@ true true + Dockerfile-${aps.version}-arm64 + Dockerfile-admin-${aps.version}-arm64 - - com.coderplus.maven.plugins - copy-rename-maven-plugin - - - copy-Dockerfile-activiti-app - package - - copy - - - ${project.parent.basedir}/target/Dockerfile-${aps.version}-arm64 - ${project.parent.basedir}/target/Dockerfile - - - - copy-Dockerfile-activiti-admin - package - - copy - - - ${project.parent.basedir}/target/admin/Dockerfile-admin-${aps.version}-arm64 - ${project.parent.basedir}/target/admin/Dockerfile - - - - org.codehaus.mojo exec-maven-plugin @@ -476,6 +517,7 @@ buildx build + --file=${docker.compose.dockerfile.activiti.app} --platform=linux/arm64 -taps-sdk/alfresco-process-services:development -tlatest @@ -500,6 +542,7 @@ buildx build + --file=${docker.compose.dockerfile.activiti.admin} --platform=linux/arm64 -taps-sdk/alfresco-process-services-admin:development -tlatest @@ -543,10 +586,10 @@ ${skip.admin} ${project.parent.basedir}/target/admin - Dockerfile-admin-${aps.version} + ${docker.compose.dockerfile.activiti.admin} latest - ${project.version} + ${modified.version} @@ -576,10 +619,10 @@ linux/amd64, linux/arm64 ${project.parent.basedir}/target - Dockerfile-${aps.version} + ${docker.compose.dockerfile.activiti.app} latest - ${project.version} + ${modified.version} mkdir -p /act_data @@ -753,5 +796,5 @@ - + \ No newline at end of file diff --git a/activiti-app-overlay-docker/src/main/docker/docker-compose/docker-compose-activiti-admin.yml b/activiti-app-overlay-docker/src/main/docker/docker-compose/docker-compose-activiti-admin.yml new file mode 100644 index 0000000..9506005 --- /dev/null +++ b/activiti-app-overlay-docker/src/main/docker/docker-compose/docker-compose-activiti-admin.yml @@ -0,0 +1,105 @@ +version: "3.8" +services: + aps-admin: + image: aps-sdk/alfresco-process-services-admin:development + hostname: aps-admin + networks: + - aps-network + build: + dockerfile: ./${docker.compose.dockerfile.activiti.admin} + context: ${project.parent.basedir}/target/admin + tags: + - "latest" + - "${modified.version}" + ports: + - ${docker.aps-admin.tomcat.port.internal}:${docker.aps-admin.tomcat.port.external} + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:${docker.aps-admin.tomcat.port.external}/activiti-admin"] + interval: 30s + timeout: 10s + retries: 5 + depends_on: + aps-current-project: + condition: service_healthy + + aps-current-project: + image: aps-sdk/alfresco-process-services:development + hostname: aps-current-project + networks: + - aps-network + build: + dockerfile: ./${docker.compose.dockerfile.activiti.app} + context: ../../target + tags: + - "latest" + - "${modified.version}" + environment: + CATALINA_OPTS: ${catalina.opts.debug} + ports: + - ${docker.tomcat.port.external}:${docker.tomcat.port.internal} + - ${aps.debug.port}:${aps.debug.port} + volumes: + - aps-contentstore-volume:/act_data + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:${docker.tomcat.port.external}/activiti-app"] + interval: 30s + timeout: 10s + retries: 5 + depends_on: + postgre: + condition: service_healthy + elasticsearch: + condition: service_healthy + + postgre: + image: ${docker.aps.database.image} + hostname: postgre + networks: + - aps-network + environment: + POSTGRES_DB: ${docker.aps.database.server.db.name} + POSTGRES_USER: ${docker.aps.database.username} + POSTGRES_PASSWORD: ${docker.aps.database.password} + ports: + - ${docker.aps.database.port.internal}:${docker.aps.database.port.external} + volumes: + - aps-db-volume:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -d ${docker.aps.database.server.db.name} -U ${docker.aps.database.username}"] + interval: 10s + timeout: 5s + retries: 5 + + elasticsearch: + image: elasticsearch:${elasticsearch.version} + hostname: elasticsearch + networks: + - aps-network + environment: + discovery.type: ${docker.aps.es.discovery.type} + ES_JAVA_OPTS: ${docker.aps.es.memory.settings} + ports: + - ${docker.es.service.port.internal}:${docker.es.service.port.external} + - ${docker.es.discovery.port.internal}:${docker.es.discovery.port.external} + volumes: + - aps-es-volume:/usr/share/elasticsearch/data + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:${docker.es.service.port.external}/_cat/health"] + interval: 30s + timeout: 10s + retries: 5 + +networks: + aps-network: + name: aps-network + +volumes: + aps-db-volume: + name: aps-db-volume + external: true + aps-contentstore-volume: + name: aps-contentstore-volume + external: true + aps-es-volume: + name: aps-es-volume + external: true \ No newline at end of file diff --git a/activiti-app-overlay-docker/src/main/docker/docker-compose/docker-compose.yml b/activiti-app-overlay-docker/src/main/docker/docker-compose/docker-compose.yml new file mode 100644 index 0000000..9c7ff66 --- /dev/null +++ b/activiti-app-overlay-docker/src/main/docker/docker-compose/docker-compose.yml @@ -0,0 +1,83 @@ +version: "3.8" +services: + aps-current-project: + image: aps-sdk/alfresco-process-services:development + hostname: aps-current-project + networks: + - aps-network + build: + dockerfile: ./${docker.compose.dockerfile.activiti.app} + context: ../../target + tags: + - "latest" + - "${modified.version}" + environment: + CATALINA_OPTS: ${catalina.opts.debug} + ports: + - ${docker.tomcat.port.external}:${docker.tomcat.port.internal} + - ${aps.debug.port}:${aps.debug.port} + volumes: + - aps-contentstore-volume:/act_data + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:${docker.tomcat.port.external}/activiti-app"] + interval: 30s + timeout: 10s + retries: 5 + depends_on: + postgre: + condition: service_healthy + elasticsearch: + condition: service_healthy + + postgre: + image: ${docker.aps.database.image} + hostname: postgre + networks: + - aps-network + environment: + POSTGRES_DB: ${docker.aps.database.server.db.name} + POSTGRES_USER: ${docker.aps.database.username} + POSTGRES_PASSWORD: ${docker.aps.database.password} + ports: + - ${docker.aps.database.port.internal}:${docker.aps.database.port.external} + volumes: + - aps-db-volume:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -d ${docker.aps.database.server.db.name} -U ${docker.aps.database.username}"] + interval: 10s + timeout: 5s + retries: 5 + + elasticsearch: + image: elasticsearch:${elasticsearch.version} + hostname: elasticsearch + networks: + - aps-network + environment: + discovery.type: ${docker.aps.es.discovery.type} + ES_JAVA_OPTS: ${docker.aps.es.memory.settings} + ports: + - ${docker.es.service.port.internal}:${docker.es.service.port.external} + - ${docker.es.discovery.port.internal}:${docker.es.discovery.port.external} + volumes: + - aps-es-volume:/usr/share/elasticsearch/data + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:${docker.es.service.port.external}/_cat/health"] + interval: 30s + timeout: 10s + retries: 5 + +networks: + aps-network: + name: aps-network + +volumes: + aps-db-volume: + name: aps-db-volume + external: true + aps-contentstore-volume: + name: aps-contentstore-volume + external: true + aps-es-volume: + name: aps-es-volume + external: true \ No newline at end of file diff --git a/activiti-app-overlay-war/pom.xml b/activiti-app-overlay-war/pom.xml index 3867ef3..e3741d2 100644 --- a/activiti-app-overlay-war/pom.xml +++ b/activiti-app-overlay-war/pom.xml @@ -7,7 +7,7 @@ org.alfresco.activiti aps-project - 2.3.1 + 2.4.0-SNAPSHOT diff --git a/aps-extensions-jar/pom.xml b/aps-extensions-jar/pom.xml index 8068005..23e159d 100644 --- a/aps-extensions-jar/pom.xml +++ b/aps-extensions-jar/pom.xml @@ -7,7 +7,7 @@ org.alfresco.activiti aps-project - 2.3.1 + 2.4.0-SNAPSHOT @@ -266,14 +266,6 @@ - - maven-surefire-plugin - - - --illegal-access=permit - - - maven-antrun-plugin @@ -320,5 +312,50 @@ + + + + surefire-openjdk-17 + + false + [17,) + + + + + maven-surefire-plugin + + + + + + surefire-openjdk-11 + + false + 11 + + + + + maven-surefire-plugin + + ${skip.integration.test} + + --illegal-access=permit + + + + + + integration-test + verify + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 085e7f3..61f7187 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.alfresco.activiti aps-project - 2.3.1 + 2.4.0-SNAPSHOT pom APS - SDK Project @@ -38,7 +38,9 @@ 5.10.1 false 3.1.0 - 1.0 + 3.4.0 + 2.1.1 + 5.2.1 false false @@ -725,9 +727,9 @@ ${exec-maven-plugin.version} - com.coderplus.maven.plugins - copy-rename-maven-plugin - ${copy-rename-maven-plugin.version} + org.codehaus.mojo + build-helper-maven-plugin + ${maven-build-helper.plugin.version} @@ -768,6 +770,34 @@ + + org.codehaus.mojo + build-helper-maven-plugin + + + docker-compose-version + + regex-property + + + modified.version + ${project.version} + -SNAPSHOT + + false + + + + parse-version + + parse-version + + + ${modified.version} + + + + diff --git a/run.bat b/run.bat new file mode 100644 index 0000000..5f4014d --- /dev/null +++ b/run.bat @@ -0,0 +1,216 @@ +@ECHO OFF + +SET COMPOSE_FILE_PATH=%CD%\target\docker-compose\docker-compose.yml +SET COMPOSE_ADMIN_FILE_PATH=%CD%\target\docker-compose\docker-compose-activiti-admin.yml + +for /f %%i in ('call mvn help:evaluate -Dexpression=aps.version -q -DforceStdout') do SET APS_VERSION=%%i + + +IF [%M2_HOME%]==[] ( + SET MVN_EXEC=mvn +) + +IF NOT [%M2_HOME%]==[] ( + SET MVN_EXEC=%M2_HOME%\bin\mvn +) + +IF [%1]==[] ( + echo "Usage for Activiti App only: %0 {build_start|build_start_it_supported|start|stop|purge|tail|reload_aps|build_test|test}" + echo "Usage for Activiti App with Activiti Admin: %0 {build_start_admin|build_start_it_supported_admin|start_admin|stop_admin|purge_admin|tail_admin|reload_aps_admin|build_test_admin|test_admin}" + + GOTO END +) + +IF %1==build_start ( + CALL :down + CALL :build + CALL :start + CALL :tail + GOTO END +) +IF %1==build_start_admin ( + CALL :down_admin + CALL :build_admin + CALL :start_admin + CALL :tail_admin + GOTO END +) +IF %1==build_start_it_supported ( + CALL :down + CALL :build + CALL :prepare-test + CALL :start + CALL :tail + GOTO END +) +IF %1==build_start_it_supported_admin ( + CALL :down_admin + CALL :build_admin + CALL :prepare-test_admin + CALL :start_admin + CALL :tail_admin + GOTO END +) +IF %1==start ( + CALL :start + CALL :tail + GOTO END +) +IF %1==start_admin ( + CALL :start_admin + CALL :tail_admin + GOTO END +) +IF %1==stop ( + CALL :down + GOTO END +) +IF %1==stop_admin ( + CALL :down_admin + GOTO END +) +IF %1==purge ( + CALL:down + CALL:purge + GOTO END +) +IF %1==purge_admin ( + CALL:down_admin + CALL:purge_admin + GOTO END +) +IF %1==tail ( + CALL :tail + GOTO END +) + +IF %1==reload_aps ( + CALL :build_activiti_app + CALL :start + CALL :tail + GOTO END +) +IF %1==reload_aps_admin ( + CALL :build_activiti_app_admin + CALL :start_admin + CALL :tail_admin + GOTO END +) +IF %1==build_test ( + CALL :down + CALL :build + CALL :prepare-test + CALL :start + CALL :test + CALL :tail_all + CALL :down + GOTO END +) +IF %1==build_test_admin ( + CALL :down_admin + CALL :build_admin + CALL :prepare-test_admin + CALL :start_admin + CALL :test_admin + CALL :tail_all_admin + CALL :down_admin + GOTO END +) +IF %1==test ( + CALL :test + GOTO END +) +IF %1==test_admin ( + CALL :test_admin + GOTO END +) +echo "Usage for Activiti App only: %0 {build_start|build_start_it_supported|start|stop|purge|tail|reload_aps|build_test|test}" + echo "Usage for Activiti App with Activiti Admin: %0 {build_start_admin|build_start_it_supported_admin|start_admin|stop_admin|purge_admin|tail_admin|reload_aps_admin|build_test_admin|test_admin}" + +:END +EXIT /B %ERRORLEVEL% + +:start + docker volume create aps-db-volume + docker volume create aps-contentstore-volume + docker volume create aps-es-volume + docker-compose -f "%COMPOSE_FILE_PATH%" up --build -d --remove-orphans +EXIT /B 0 +:start_admin + docker volume create aps-db-volume + docker volume create aps-contentstore-volume + docker volume create aps-es-volume + docker-compose -f "%COMPOSE_ADMIN_FILE_PATH%" up --build -d --remove-orphans +EXIT /B 0 +:start_activiti_app + docker volume create aps-db-volume + docker volume create aps-contentstore-volume + docker volume create aps-es-volume + docker-compose -f "%COMPOSE_FILE_PATH%" up --build -d aps-current-project --remove-orphans +EXIT /B 0 +:start_activiti_app_admin + docker volume create aps-db-volume + docker volume create aps-contentstore-volume + docker volume create aps-es-volume + docker-compose -f "%COMPOSE_ADMIN_FILE_PATH%" up --build -d aps-current-project --remove-orphans +EXIT /B 0 +:down + if exist "%COMPOSE_FILE_PATH%" ( + docker-compose -f "%COMPOSE_FILE_PATH%" down + ) +EXIT /B 0 +:down_admin + if exist "%COMPOSE_ADMIN_FILE_PATH%" ( + docker-compose -f "%COMPOSE_ADMIN_FILE_PATH%" down + ) +EXIT /B 0 +:build + call %MVN_EXEC% clean package -Paps%APS_VERSION% +EXIT /B 0 +:build_admin + call %MVN_EXEC% clean package -Paps%APS_VERSION%,activiti-admin +EXIT /B 0 +:build_activiti_app + docker-compose -f "%COMPOSE_FILE_PATH%" kill aps-current-project + docker-compose -f "%COMPOSE_FILE_PATH%" rm -f aps-current-project + call %MVN_EXEC% clean package -pl aps-extensions-jar,activiti-app-overlay-war,activiti-app-overlay-docker -Paps%APS_VERSION% +EXIT /B 0 +:build_activiti_app_admin + docker-compose -f "%COMPOSE_ADMIN_FILE_PATH%" kill aps-current-project + docker-compose -f "%COMPOSE_ADMIN_FILE_PATH%" rm -f aps-current-project + call %MVN_EXEC% clean package -pl aps-extensions-jar,activiti-app-overlay-war,activiti-app-overlay-docker -Paps%APS_VERSION%,activiti-admin +EXIT /B 0 +:tail + docker-compose -f "%COMPOSE_FILE_PATH%" logs -f +EXIT /B 0 +:tail_admin + docker-compose -f "%COMPOSE_ADMIN_FILE_PATH%" logs -f +EXIT /B 0 +:tail_all + docker-compose -f "%COMPOSE_FILE_PATH%" logs --tail="all" +EXIT /B 0 +:tail_all_admin + docker-compose -f "%COMPOSE_ADMIN_FILE_PATH%" logs --tail="all" +EXIT /B 0 +:prepare-test + call %MVN_EXEC% verify -DskipTests=true -pl aps-extensions-jar,activiti-app-overlay-war,activiti-app-overlay-docker -Paps%APS_VERSION% +EXIT /B 0 +:prepare-test_admin + call %MVN_EXEC% verify -DskipTests=true -pl aps-extensions-jar,activiti-app-overlay-war,activiti-app-overlay-docker -Paps%APS_VERSION%,activiti-admin +EXIT /B 0 +:test + call %MVN_EXEC% verify -pl aps-extensions-jar,activiti-app-overlay-war,activiti-app-overlay-docker -Paps%APS_VERSION% +EXIT /B 0 +:test_admin + call %MVN_EXEC% verify -pl aps-extensions-jar,activiti-app-overlay-war,activiti-app-overlay-docker -Paps%APS_VERSION%,activiti-admin +EXIT /B 0 +:purge + docker volume rm aps-db-volume + docker volume rm aps-contentstore-volume + docker volume rm aps-es-volume +EXIT /B 0 +:purge_admin + docker volume rm aps-db-volume + docker volume rm aps-contentstore-volume + docker volume rm aps-es-volume +EXIT /B 0 \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..bfb8552 --- /dev/null +++ b/run.sh @@ -0,0 +1,203 @@ +#!/bin/sh + +export COMPOSE_FILE_PATH="${PWD}/target/docker-compose/docker-compose.yml" +export COMPOSE_ADMIN_FILE_PATH="${PWD}/target/docker-compose/docker-compose-activiti-admin.yml" +export APS_VERSION=$(mvn help:evaluate -Dexpression=aps.version -q -DforceStdout) + +if [ -z "${M2_HOME}" ]; then + export MVN_EXEC="mvn" +else + export MVN_EXEC="${M2_HOME}/bin/mvn" +fi + +start() { + docker volume create aps-db-volume + docker volume create aps-contentstore-volume + docker volume create aps-es-volume + docker-compose -f "$COMPOSE_FILE_PATH" up --build -d --remove-orphans +} + +start_activiti_app() { + docker volume create aps-db-volume + docker volume create aps-contentstore-volume + docker volume create aps-es-volume + docker-compose -f "$COMPOSE_FILE_PATH" up --build -d aps-current-project --remove-orphans +} + +start_activiti_app_admin() { + docker volume create aps-db-volume + docker volume create aps-contentstore-volume + docker volume create aps-es-volume + docker-compose -f "$COMPOSE_ADMIN_FILE_PATH" up --build -d aps-current-project --remove-orphans +} + +start_admin() { + docker volume create aps-db-volume + docker volume create aps-contentstore-volume + docker volume create aps-es-volume + docker-compose -f "$COMPOSE_ADMIN_FILE_PATH" up --build -d --remove-orphans +} + +down() { + if [ -f "$COMPOSE_FILE_PATH" ]; then + docker-compose -f "$COMPOSE_FILE_PATH" down + fi +} + +down_admin() { + if [ -f "$COMPOSE_ADMIN_FILE_PATH" ]; then + docker-compose -f "$COMPOSE_ADMIN_FILE_PATH" down + fi +} + +purge() { + docker volume rm aps-db-volume + docker volume rm aps-contentstore-volume + docker volume rm aps-es-volume +} + +purge_admin() { + docker volume rm aps-db-volume + docker volume rm aps-contentstore-volume + docker volume rm aps-es-volume +} + +build() { + $MVN_EXEC clean package -Paps$APS_VERSION +} + +build_admin() { + $MVN_EXEC clean package -Paps$APS_VERSION,activiti-admin +} + +build_activiti_app(){ + docker-compose -f "$COMPOSE_FILE_PATH" kill aps-current-project + yes | docker-compose -f "$COMPOSE_FILE_PATH" rm -f aps-current-project + $MVN_EXEC clean package -pl aps-extensions-jar,activiti-app-overlay-war,activiti-app-overlay-docker -Paps$APS_VERSION +} + +build_activiti_app_admin(){ + docker-compose -f "$COMPOSE_ADMIN_FILE_PATH" kill aps-current-project + yes | docker-compose -f "$COMPOSE_ADMIN_FILE_PATH" rm -f aps-current-project + $MVN_EXEC clean package -pl aps-extensions-jar,activiti-app-overlay-war,activiti-app-overlay-docker -Paps$APS_VERSION,activiti-admin +} + +tail() { + docker-compose -f "$COMPOSE_FILE_PATH" logs -f +} + +tail_admin() { + docker-compose -f "$COMPOSE_ADMIN_FILE_PATH" logs -f +} + +tail_all() { + docker-compose -f "$COMPOSE_FILE_PATH" logs --tail="all" +} + +tail_all_admin() { + docker-compose -f "$COMPOSE_ADMIN_FILE_PATH" logs --tail="all" +} + +prepare_test() { + $MVN_EXEC verify -DskipTests=true -pl aps-extensions-jar,activiti-app-overlay-war,activiti-app-overlay-docker -Paps$APS_VERSION +} + +prepare_test_admin() { + $MVN_EXEC verify -DskipTests=true -pl aps-extensions-jar,activiti-app-overlay-war,activiti-app-overlay-docker -Paps$APS_VERSION,activiti-admin +} + +test() { + $MVN_EXEC verify -pl aps-extensions-jar +} + +test_admin() { + $MVN_EXEC verify -pl aps-extensions-jar -Pactiviti-admin +} + +case "$1" in + build_start) + down + build + start + tail + ;; + build_start_admin) + down_admin + build_admin + start_admin + tail_admin + ;; + build_start_it_supported) + down + build + prepare_test + start + tail + ;; + build_start_it_supported_admin) + down_admin + build_admin + prepare_test_admin + start_admin + tail_admin + ;; + build_test) + down + build + prepare_test + start + test + tail_all + down + ;; + build_test_admin) + down_admin + build_admin + prepare_test_admin + start_admin + test_admin + tail_all_admin + down_admin + ;; + start) + start + tail + ;; + start_admin) + start_admin + tail_admin + ;; + stop) + down + ;; + stop_admin) + down_admin + ;; + purge) + down + purge + ;; + purge_admin) + down_admin + purge_admin + ;; + tail) + tail + ;; + tail_admin) + tail_admin + ;; + reload_aps) + build_activiti_app + start + tail + ;; + reload_aps_admin) + build_activiti_app_admin + start_admin + tail_admin + ;; + *) + echo "Usage for Activiti App only: $0 {build_start|build_start_it_supported|start|stop|purge|tail|reload_aps|build_test|test}" + echo "Usage for Activiti App with Activiti Admin: $0 {build_start_admin|build_start_it_supported_admin|start_admin|stop_admin|purge_admin|tail_admin|reload_aps_admin|build_test_admin|test_admin}" +esac \ No newline at end of file