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..064d1dbf2 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,14 +28,14 @@ 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" 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