initial checkin

This commit is contained in:
Brian Long 2021-03-15 22:47:50 -04:00
commit 1d67774fba
5 changed files with 223 additions and 0 deletions

8
.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Maven
target
pom.xml.versionsBackup
# Eclipse
.project
.settings

42
Dockerfile Normal file
View File

@ -0,0 +1,42 @@
FROM ubuntu:${ubuntu.version}
# Configure standard JAVA parameters
ENV JAVA_MEMORY_INIT=128m
ENV JAVA_MEMORY_MAX=512m
ENV JAVA_OPTS=
# Install curl
RUN apt update && apt -y install curl
# Download & Install DCEVM Java
RUN mkdir -p /usr/local/lib/jvm && \
curl -L https://github.com/TravaOpenJDK/trava-jdk-${dcevm.majorVersion}-dcevm/releases/download/dcevm-${dcevm.version}/java${dcevm.majorVersion}-openjdk-dcevm-linux.tar.gz -o /usr/local/lib/jvm/java-openjdk-dcevm.tar.gz && \
cd /usr/local/lib/jvm && tar xzvf java-openjdk-dcevm.tar.gz && mv dcevm-${dcevm.version} java-openjdk-dcevm && rm java-openjdk-dcevm.tar.gz
# Download Hotswap Agent
RUN curl -L https://github.com/HotswapProjects/HotswapAgent/releases/download/RELEASE-${hotswap.version}/hotswap-agent-${hotswap.version}.jar -o /usr/local/lib/jvm/hotswap-agent.jar
# Add directories for dynamic injection points
RUN mkdir -p /var/lib/jvm && cd /var/lib/jvm && \
mkdir dev lib && cd dev && \
mkdir classes classes-extra1 classes-extra2 classes-extra3 classes-extra4 classes-extra5 classes-extra6 classes-extra7 && \
mkdir lib lib-extra1 lib-extra2 lib-extra3 lib-extra4 lib-extra5 lib-extra6 lib-extra7
# Add our Docker container initialization script
ADD docker-entrypoint.sh /usr/local/bin
# Add our default hotswap configuration; may be overwritten
ADD hotswap-agent.properties /var/lib/jvm/lib
# Listening for Java debugger traffic
EXPOSE 8000
# Running as ROOT user for now
#USER java
# Execute the Docker container initialization script
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint.sh" ]
# Do nothing meaningful; made to be overridden
CMD [ "-version" ]

4
docker-entrypoint.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
JAVA_OPTS="-Xms${JAVA_MEMORY_INIT} -Xmx${JAVA_MEMORY_MAX} -XX:HotswapAgent=external -javaagent:/usr/local/lib/jvm/hotswap-agent.jar -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n $JAVA_OPTS"
exec "/usr/local/lib/jvm/java-openjdk-dcevm/bin/java ${JAVA_OPTS} $@"

85
hotswap-agent.properties Normal file
View File

@ -0,0 +1,85 @@
# Default agent properties
# You can override them in your application by creating hotswap-agent.properties file in class root
# and specifying new property values.
# Add a directory prior to application classpath (load classes and resources).
#
# This may be useful for example in multi module maven project to load class changes from upstream project
# classes. Set extraClasspath to upstream project compiler output and .class file will have precedence to
# classes from built JAR file.
extraClasspath=/tmp/java/classpath
# Watch for changes in a directory (resources only). If not set, changes of resources won't be observed.
#
# Similar to extraClasspath this property adds classpath when searching for resources (not classes).
# While extra classpath just modifies the classloader, this setting does nothing until the resource
# is really changed.
#
# Sometimes it is not possible to point extraClasspath to your i.e. src/main/resources, because there are multiple
# replacements of resources in a building step (maven filtering resource option).
# This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified
# in src/main/resources, the new changed resource is served instead.
watchResources=/tmp/java/resources
# Load static web resources from different directory.
#
# This setting is dependent on application server plugin(Jetty, Tomcat, ...).
# Jboss and Glassfish are not yet supported.
# Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp).
webappDir=/var/java/web
# Comma separated list of disabled plugins
# Use plugin name - e.g. Hibernate, Spring, ZK, Hotswapper, AnonymousClassPatch, Tomcat, Logback ....
disabledPlugins=
# Watch for changed class files on watchResources path and reload class definition in the running application.
#
# Usually you will launch debugging session from your IDE and use standard hotswap feature.
# This property is useful if you do not want to use debugging session for some reason or
# if you want to enable hotswap at runtime environment.
#
# Internally this uses java Instrumentation API to reload class bytecode. If you need to use JPDA API instead,
# specify autoHotswap.port with JPDA port.
autoHotswap=true
# The base package prefix of your spring application (e.g. org.hotswap.).
# Needed when component scan is turned off, so we can still know which classes is your beans
# Can also be set to filter beans we handle to improve performance (So that we won't create proxy for thirty party lib's beans).
# Comma separated.
#spring.basePackagePrefix=
# Create Java Platform Debugger Architecture (JPDA) connection on autoHotswap.port, watch for changed class files
# and do the hotswap (reload) in background.
#
# You need to specify JPDA port at startup
# <pre>java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000</pre>
autoHotswap.port=8000
# Enables debugging in OsgiEquinox
# osgiEquinox.debugMode=true
# Setup reloading strategy of bean INSTANCE(s) in Weld CONTEXT(s). While bean class is redefined by DCEVM, reloading of bean instances
# can be customized by this parameter. Available values:
# - CLASS_CHANGE - reload bean instance on any class modification, plus reaload on changes specified in
# METHOD_FIELD_SIGNATURE_CHANGE and FIELD_SIGNATURE_CHANGE strategies
# - METHOD_FIELD_SIGNATURE_CHANGE - reload bean instance on any method/field change. Includes changes specified in
# strategy FIELD_SIGNATURE_CHANGE
# - FIELD_SIGNATURE_CHANGE - reload bean instance on any field signature change. Includes also field annotation changes
# - NEVER - never reload bean (default)
# weld.beanReloadStrategy=NEVER
# Logger setup - use entries in the format of
# format: LOGGER.my.package=LEVEL
# e.g. LOGGER.org.hotswap.agent.plugin.myPlugin=trace
# root level
LOGGER=info
# DateTime format using format of SimpleDateFormat, default value HH:mm:ss.SSS
# LOGGER_DATETIME_FORMAT=HH:mm:ss.SSS
# Print output into logfile (with choice to append - false by default)
# LOGFILE=agent.log
# LOGFILE.append=true
# Comma separated list of class loaders to exclude from initialization, in the form of RegEx patterns.
#excludedClassLoaderPatterns=jdk.nashorn.*

84
pom.xml Normal file
View File

@ -0,0 +1,84 @@
<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>com.inteligr8</groupId>
<artifactId>java-dcevm-hotswap</artifactId>
<version>11.0.10-1.4.1</version>
<name>Java DCEVM for Rapid Application Development</name>
<packaging>pom</packaging>
<properties>
<!-- The release version of Ubuntu to use as the base -->
<!-- See: https://hub.docker.com/_/ubuntu -->
<!-- This has very little impact and may be replaced -->
<ubuntu.version>20.04</ubuntu.version>
<!-- The version of Java DCEVM to use for executing Apache Tomcat -->
<!-- See: https://github.com/TravaOpenJDK/trava-jdk-11-dcevm/releases -->
<dcevm.version>11.0.10+4</dcevm.version>
<dcevm.majorVersion>11</dcevm.majorVersion>
<!-- The version of the Hotswap Agent to use -->
<!-- See: https://github.com/HotswapProjects/HotswapAgent/releases -->
<hotswap.version>1.4.1</hotswap.version>
<!-- The Docker image meta-data for pushing the build -->
<image.name>inteligr8/${project.artifactId}</image.name>
<image.tag>${project.version}</image.tag>
<image.registry>docker.inteligr8.com</image.registry>
</properties>
<build>
<plugins>
<!-- This plugin build and pushes the Docker image -->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>4.4.0</version>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
</image>
</images>
<contextDir>${basedir}</contextDir>
<buildStrategy>docker</buildStrategy>
<verbose>true</verbose>
</configuration>
<executions>
<!-- This execution builds the Docker image -->
<execution>
<id>docker-build</id>
<phase>package</phase>
<goals><goal>build</goal></goals>
</execution>
<!-- This execution pushes the built Docker image to the configured Docker Registry -->
<execution>
<id>docker-push</id>
<phase>deploy</phase>
<goals><goal>push</goal></goals>
</execution>
</executions>
</plugin>
<!-- This plugin prevents the project from deploying to the Maven Repository, as it is pointless -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>no-docker</id>
<properties>
<fabric8.build.jib>true</fabric8.build.jib>
</properties>
</profile>
</profiles>
</project>