Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
Add javametrics as a dev only dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
seabaylea committed Jul 6, 2019
1 parent 3faca5d commit d164d71
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 9 deletions.
3 changes: 3 additions & 0 deletions incubator/java-microprofile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.5`. 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
Expand Down Expand Up @@ -63,3 +65,4 @@ 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)
15 changes: 8 additions & 7 deletions incubator/java-microprofile/image/Dockerfile-stack
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ WORKDIR /project/

RUN mkdir -p /mvn/repository
RUN mvn -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

Expand All @@ -22,22 +23,22 @@ ENV APPSODY_DEPS=/mvn/repository
# ENV APPSODY_WATCH_IGNORE_DIR=
# ENV APPSODY_WATCH_REGEX=""

ENV APPSODY_INSTALL="mvn -Dmaven.repo.local=/mvn/repository install -DskipTests"
ENV APPSODY_INSTALL="mvn -Dmaven.repo.local=/mvn/repository install -DskipTests && /project/install-dev-deps.sh"

ENV APPSODY_RUN="../enforce.sh && mvn -Dmaven.repo.local=/mvn/repository liberty:run"
ENV APPSODY_RUN_ON_CHANGE="mvn -Dmaven.repo.local=/mvn/repository compile"
ENV APPSODY_RUN="../enforce.sh && JVM_ARGS='-javaagent:resources/javametrics-agent.jar' mvn -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 compile"
ENV APPSODY_RUN_KILL=false

ENV APPSODY_DEBUG="../enforce.sh && mvn -Dmaven.repo.local=/mvn/repository liberty:debug"
ENV APPSODY_DEBUG_ON_CHANGE="mvn -Dmaven.repo.local=/mvn/repository compile"
ENV APPSODY_DEBUG="../enforce.sh && JVM_ARGS='-javaagent:resources/javametrics-agent.jar' mvn -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 compile"
ENV APPSODY_DEBUG_KILL=false

ENV APPSODY_TEST="../enforce.sh && mvn -Dmaven.repo.local=/mvn/repository verify"
ENV APPSODY_TEST="../enforce.sh && JVM_ARGS='-javaagent:resources/javametrics-agent.jar' mvn -Dmaven.repo.local=/mvn/repository verify"
ENV APPSODY_TEST_ON_CHANGE=""
ENV APPSODY_TEST_KILL=false

ENV PORT=9080

EXPOSE 9080
EXPOSE 9443
EXPOSE 7777
EXPOSE 7777
4 changes: 4 additions & 0 deletions incubator/java-microprofile/image/project/install-dev-deps.sh
Original file line number Diff line number Diff line change
@@ -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
91 changes: 91 additions & 0 deletions incubator/java-microprofile/image/project/pom-dev.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?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/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>dev.appsody</groupId>
<artifactId>dev-dependencies</artifactId>
<version>0.2.0</version>
<packaging>jar</packaging>

<repositories>
<repository>
<id>localrepository</id>
<url>/mvn/repository</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.ibm.runtimetools</groupId>
<artifactId>javametrics-agent</artifactId>
<version>[1.2,2.0)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.runtimetools</groupId>
<artifactId>javametrics-dash</artifactId>
<version>[1.2,2.0)</version>
<scope>provided</scope>
<type>war</type>
</dependency>
<dependency>
<groupId>com.ibm.runtimetools</groupId>
<artifactId>javametrics-rest</artifactId>
<version>[1.2,2.0)</version>
<scope>provided</scope>
<type>war</type>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-dropin</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<stripVersion>true</stripVersion>
<outputDirectory>${project.build.directory}/../user-app/target/liberty/wlp/usr/servers/defaultServer/dropins</outputDirectory>
<includeArtifactIds>javametrics-dash,javametrics-rest</includeArtifactIds>
</configuration>
</execution>
<execution>
<id>copy-resource</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<stripVersion>true</stripVersion>
<outputDirectory>${project.build.directory}/../user-app/target/liberty/wlp/usr/servers/defaultServer/resources/</outputDirectory>
<includeArtifactIds>javametrics-agent</includeArtifactIds>
</configuration>
</execution>
<execution>
<id>copy-asm</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/../user-app/target/liberty/wlp/usr/servers/defaultServer/resources/asm</outputDirectory>
<includeGroupIds>org.ow2.asm</includeGroupIds>
<includeArtifactIds>asm,asm-commons</includeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
6 changes: 6 additions & 0 deletions incubator/java-microprofile/image/project/server-dev.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<server>
<featureManager>
<feature>managedBeans-1.0</feature>
<feature>websocket-1.1</feature>
</featureManager>
</server>
4 changes: 2 additions & 2 deletions incubator/java-microprofile/stack.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id: java-microprofile
name: Java MicroProfile application built using Maven
version: 0.2.0
version: 0.2.1
description: Sample Java MicroProfile application built using Maven
maintainer: Neeraj Laad <[email protected]>
default-template: default
license: Apache-2.0
license: Apache-2.0

0 comments on commit d164d71

Please sign in to comment.