From dbb049b2dca835fb5b33406c0274d8824f09965f Mon Sep 17 00:00:00 2001 From: Chris Bailey Date: Sat, 6 Jul 2019 14:06:53 +0100 Subject: [PATCH 1/2] Add javametrics as a dev only dependency --- incubator/java-microprofile/README.md | 3 + .../java-microprofile/image/Dockerfile-stack | 13 +-- .../image/project/install-dev-deps.sh | 4 + .../image/project/pom-dev.xml | 91 +++++++++++++++++++ .../image/project/server-dev.xml | 6 ++ incubator/java-microprofile/stack.yaml | 2 +- 6 files changed, 112 insertions(+), 7 deletions(-) create mode 100755 incubator/java-microprofile/image/project/install-dev-deps.sh create mode 100644 incubator/java-microprofile/image/project/pom-dev.xml create mode 100644 incubator/java-microprofile/image/project/server-dev.xml diff --git a/incubator/java-microprofile/README.md b/incubator/java-microprofile/README.md index 95ba5c621..2334ec5b6 100644 --- a/incubator/java-microprofile/README.md +++ b/incubator/java-microprofile/README.md @@ -6,6 +6,8 @@ The Java MicroProfile stack uses a parent Maven project object model (POM) to ma This stack is based on OpenJDK with container-optimizations in OpenJ9 and `Open Liberty v19.0.0.8`. It provides live reloading during development by utilizing `loose application` capabilities. +The stack also provides a in-built application monitoring dashboard based on [javametrics](https://github.com/runtimetools/javametrics). This dashboard is only included during development and is not included in the image built using `appsody build`. + **Note:** Maven is provided by the Appsody stack container, allowing you to build, test, and debug your Java application without installing Maven locally. However, we recommend installing Maven locally for the best IDE experience. ## Templates @@ -65,6 +67,7 @@ OpenAPI endpoints: - Metrics endpoint: http://localhost:9080/metrics (login as `admin` user with `adminpwd` password) - OpenAPI endpoint: http://localhost:9080/openapi - Swagger UI endpoint: http://localhost:9080/openapi/ui + - Javametrics Dashboard endpoint: http://localhost:9080/javametrics-dash/ (development-time only) ## License diff --git a/incubator/java-microprofile/image/Dockerfile-stack b/incubator/java-microprofile/image/Dockerfile-stack index 97f9333df..3e7d7e578 100644 --- a/incubator/java-microprofile/image/Dockerfile-stack +++ b/incubator/java-microprofile/image/Dockerfile-stack @@ -17,6 +17,7 @@ WORKDIR /project/ RUN mkdir -p /mvn/repository RUN mvn -B -Dmaven.repo.local=/mvn/repository -N io.takari:maven:wrapper -Dmaven=$(mvn help:evaluate -Dexpression=maven.version -q -DforceStdout) RUN mvn -B -Dmaven.repo.local=/mvn/repository install dependency:go-offline -DskipTests +RUN mvn -Dmaven.repo.local=/mvn/repository install dependency:go-offline -DskipTests -f pom-dev.xml WORKDIR /project/user-app @@ -27,17 +28,17 @@ ENV APPSODY_WATCH_DIR=/project/user-app ENV APPSODY_WATCH_IGNORE_DIR=/project/user-app/target ENV APPSODY_WATCH_REGEX="^.*(.xml|.java|.properties)$" -ENV APPSODY_INSTALL="../validate.sh && mvn -B -Dmaven.repo.local=/mvn/repository install -DskipTests" +ENV APPSODY_INSTALL="../validate.sh && mvn -B -Dmaven.repo.local=/mvn/repository install -DskipTests && /project/install-dev-deps.sh" -ENV APPSODY_RUN="mvn -B -Dmaven.repo.local=/mvn/repository liberty:run" -ENV APPSODY_RUN_ON_CHANGE="mvn -Dmaven.repo.local=/mvn/repository package -DskipTests" +ENV APPSODY_RUN="JVM_ARGS='-javaagent:resources/javametrics-agent.jar' mvn -B -Dmaven.repo.local=/mvn/repository liberty:run" +ENV APPSODY_RUN_ON_CHANGE="JVM_ARGS='-javaagent:resources/javametrics-agent.jar' mvn -Dmaven.repo.local=/mvn/repository package -DskipTests" ENV APPSODY_RUN_KILL=false -ENV APPSODY_DEBUG="mvn -B -Dmaven.repo.local=/mvn/repository liberty:debug" -ENV APPSODY_DEBUG_ON_CHANGE="mvn -Dmaven.repo.local=/mvn/repository package -DskipTests" +ENV APPSODY_DEBUG="JVM_ARGS='-javaagent:resources/javametrics-agent.jar' mvn -B -Dmaven.repo.local=/mvn/repository liberty:debug" +ENV APPSODY_DEBUG_ON_CHANGE="JVM_ARGS='-javaagent:resources/javametrics-agent.jar' mvn -Dmaven.repo.local=/mvn/repository package -DskipTests" ENV APPSODY_DEBUG_KILL=false -ENV APPSODY_TEST="mvn -B -Dmaven.repo.local=/mvn/repository verify" +ENV APPSODY_TEST="JVM_ARGS='-javaagent:resources/javametrics-agent.jar' mvn -B -Dmaven.repo.local=/mvn/repository verify" ENV APPSODY_TEST_ON_CHANGE="" ENV APPSODY_TEST_KILL=false diff --git a/incubator/java-microprofile/image/project/install-dev-deps.sh b/incubator/java-microprofile/image/project/install-dev-deps.sh new file mode 100755 index 000000000..09d613245 --- /dev/null +++ b/incubator/java-microprofile/image/project/install-dev-deps.sh @@ -0,0 +1,4 @@ +#!/bin/bash +mvn -Dmaven.repo.local=/mvn/repository dependency:copy-dependencies@copy-dropin dependency:copy-dependencies@copy-resource dependency:copy-dependencies@copy-asm -f /project/pom-dev.xml +mkdir -p /project/user-app/target/liberty/wlp/usr/servers/defaultServer/configDropins/defaults +cp /project/server-dev.xml /project/user-app/target/liberty/wlp/usr/servers/defaultServer/configDropins/defaults/server.xml diff --git a/incubator/java-microprofile/image/project/pom-dev.xml b/incubator/java-microprofile/image/project/pom-dev.xml new file mode 100644 index 000000000..e08e08bfc --- /dev/null +++ b/incubator/java-microprofile/image/project/pom-dev.xml @@ -0,0 +1,91 @@ + + + + 4.0.0 + + dev.appsody + dev-dependencies + 0.2.0 + jar + + + + localrepository + /mvn/repository + + + + + + com.ibm.runtimetools + javametrics-agent + [1.2,2.0) + provided + + + com.ibm.runtimetools + javametrics-dash + [1.2,2.0) + provided + war + + + com.ibm.runtimetools + javametrics-rest + [1.2,2.0) + provided + war + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.0.1 + + + copy-dropin + package + + copy-dependencies + + + true + ${project.build.directory}/../user-app/target/liberty/wlp/usr/servers/defaultServer/dropins + javametrics-dash,javametrics-rest + + + + copy-resource + package + + copy-dependencies + + + true + ${project.build.directory}/../user-app/target/liberty/wlp/usr/servers/defaultServer/resources/ + javametrics-agent + + + + copy-asm + package + + copy-dependencies + + + ${project.build.directory}/../user-app/target/liberty/wlp/usr/servers/defaultServer/resources/asm + org.ow2.asm + asm,asm-commons + + + + + + + + diff --git a/incubator/java-microprofile/image/project/server-dev.xml b/incubator/java-microprofile/image/project/server-dev.xml new file mode 100644 index 000000000..414097113 --- /dev/null +++ b/incubator/java-microprofile/image/project/server-dev.xml @@ -0,0 +1,6 @@ + + + managedBeans-1.0 + websocket-1.1 + + diff --git a/incubator/java-microprofile/stack.yaml b/incubator/java-microprofile/stack.yaml index e3d8e6a4e..538832780 100644 --- a/incubator/java-microprofile/stack.yaml +++ b/incubator/java-microprofile/stack.yaml @@ -1,5 +1,5 @@ name: Eclipse MicroProfile® -version: 0.2.17 +version: 0.2.18 description: Eclipse MicroProfile on Open Liberty & OpenJ9 using Maven license: Apache-2.0 language: java From fa6bc06ca4816885a552be77bbcdf189b37b3280 Mon Sep 17 00:00:00 2001 From: Kamran Shamsi <45264227+Kamran64@users.noreply.github.com> Date: Wed, 16 Oct 2019 16:58:39 +0100 Subject: [PATCH 2/2] remove javametrics for test env var --- incubator/java-microprofile/image/Dockerfile-stack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incubator/java-microprofile/image/Dockerfile-stack b/incubator/java-microprofile/image/Dockerfile-stack index 3e7d7e578..064d1dbf2 100644 --- a/incubator/java-microprofile/image/Dockerfile-stack +++ b/incubator/java-microprofile/image/Dockerfile-stack @@ -38,7 +38,7 @@ ENV APPSODY_DEBUG="JVM_ARGS='-javaagent:resources/javametrics-agent.jar' mvn -B ENV APPSODY_DEBUG_ON_CHANGE="JVM_ARGS='-javaagent:resources/javametrics-agent.jar' mvn -Dmaven.repo.local=/mvn/repository package -DskipTests" ENV APPSODY_DEBUG_KILL=false -ENV APPSODY_TEST="JVM_ARGS='-javaagent:resources/javametrics-agent.jar' mvn -B -Dmaven.repo.local=/mvn/repository verify" +ENV APPSODY_TEST="mvn -B -Dmaven.repo.local=/mvn/repository verify" ENV APPSODY_TEST_ON_CHANGE="" ENV APPSODY_TEST_KILL=false