Compare commits

...
9 Commits
Author SHA1 Message Date
brian.long 6fda89f128 upgrade to jdk17 2023-09-05 15:48:03 -04:00
brian.long a42895297a fabric8 to jkube; latest fixpacks 2023-09-05 15:44:13 -04:00
brian.long 82b3c68d21 not using hotswap plugins; passthru 2021-06-02 14:33:31 -04:00
brian.long 22546bee71 using parameterized hotswap plugins 2021-06-01 13:35:00 -04:00
brian.long f42a353a61 updated to tomcat v9.0.46 2021-06-01 13:34:37 -04:00
brian.long a109253419 changed permissions on docker-entrypoint.sh 2021-04-22 22:38:12 -04:00
brian.long 34b5940bf7 version update and fixes 2021-04-22 22:06:34 -04:00
brian.long 083658fb13 added more paths to hotswap; added README 2021-03-16 21:48:12 -04:00
brian.long fd0394df3c split setenv 2021-03-16 13:00:05 -04:00
6 changed files with 109 additions and 18 deletions
+6 -4
View File
@@ -1,5 +1,5 @@
FROM docker.inteligr8.com/inteligr8/java-dcevm-hotswap:${java-dcevm-hotswap.version} FROM docker.inteligr8.com/inteligr8/jdk-hotswap:${jdk-hotswap.version}
# Configure the Apache Tomcat Catalina script # Configure the Apache Tomcat Catalina script
ENV JAVA_MEMORY_INIT=128m ENV JAVA_MEMORY_INIT=128m
@@ -26,12 +26,14 @@ RUN cd /var/lib/tomcat/dev && \
mkdir web web-extra1 web-extra2 web-extra3 web-extra4 web-extra5 web-extra6 web-extra7 mkdir web web-extra1 web-extra2 web-extra3 web-extra4 web-extra5 web-extra6 web-extra7
# Add our Docker container initialization script # Add our Docker container initialization script
COPY docker-entrypoint.sh /usr/local/bin ADD maven/target/setenv.sh /usr/local/bin/${namespace.prefix}-setenv.sh
COPY maven/target/docker-entrypoint.sh /usr/local/bin
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh
# Add our Apache Tomcat configuration # Add our Apache Tomcat configuration
# This gives us dynamic injection points into the running webapps # This gives us dynamic injection points into the running webapps
COPY tomcat-context.xml /var/lib/tomcat/conf/context.xml COPY maven/target/tomcat-context.xml /var/lib/tomcat/conf/context.xml
ADD hotswap-agent.properties /var/lib/tomcat/lib ADD maven/target/hotswap-agent.properties /var/lib/tomcat/lib
# Listening for HTTP (not HTTPS) traffic # Listening for HTTP (not HTTPS) traffic
EXPOSE 8080 EXPOSE 8080
+35
View File
@@ -0,0 +1,35 @@
# Apache Tomcat Application Container Image with Hot-Reloading
This project creates a Docker image that has uses the [Java Hotswap Docker Image](/inteligr8/jdk-hotswap-docker) to support hot-reloading for the enablement of rapid application development. As a Docker image, containers can be started to facilitate development without requiring complicated installations on developer workstations.
It is expected that containers are configured in Maven using the Fabric8 or Spotify Docker plugins. These configurations should expose the 8080 (HTTP) and 8000 (debugger) ports and any other port that the application may open. Most importantly, it should mount/bind the source code to the following possible paths.
| Directory | Type | Hot-Reloaded |
| ------------------------------------ |:---------:|:------------:|
| `/var/lib/tomcat/dev/classes` | Classpath | Yes |
| `/var/lib/tomcat/dev/classes-extra1` | Classpath | Yes |
| `/var/lib/tomcat/dev/classes-extra2` | Classpath | Yes |
| `/var/lib/tomcat/dev/classes-extra3` | Classpath | Yes |
| `/var/lib/tomcat/dev/classes-extra4` | Classpath | Yes |
| `/var/lib/tomcat/dev/classes-extra5` | Classpath | Yes |
| `/var/lib/tomcat/dev/classes-extra6` | Classpath | Yes |
| `/var/lib/tomcat/dev/classes-extra7` | Classpath | Yes |
| `/var/lib/tomcat/dev/lib` | JARs | No |
| `/var/lib/tomcat/dev/lib-extra1` | JARs | No |
| `/var/lib/tomcat/dev/lib-extra2` | JARs | No |
| `/var/lib/tomcat/dev/lib-extra3` | JARs | No |
| `/var/lib/tomcat/dev/lib-extra4` | JARs | No |
| `/var/lib/tomcat/dev/lib-extra5` | JARs | No |
| `/var/lib/tomcat/dev/lib-extra6` | JARs | No |
| `/var/lib/tomcat/dev/lib-extra7` | JARs | No |
| `/var/lib/tomcat/dev/web` | Web | Yes |
| `/var/lib/tomcat/dev/web-extra1` | Web | Yes |
| `/var/lib/tomcat/dev/web-extra2` | Web | Yes |
| `/var/lib/tomcat/dev/web-extra3` | Web | Yes |
| `/var/lib/tomcat/dev/web-extra4` | Web | Yes |
| `/var/lib/tomcat/dev/web-extra5` | Web | Yes |
| `/var/lib/tomcat/dev/web-extra6` | Web | Yes |
| `/var/lib/tomcat/dev/web-extra7` | Web | Yes |
You may include your own `hotswap-agent.properties` in any of the `classes` folders. The one loaded by default is usually sufficient. It most notably disables the Hotswap Agent Hibernate plugin.
+3 -2
View File
@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/sh
CATALINA_OPTS="${JAVA_OPTS} ${CATALINA_OPTS}" . /usr/local/bin/jdk-hotswap-setenv.sh
. /usr/local/bin/${namespace.prefix}-setenv.sh
exec "$@" exec "$@"
+24 -3
View File
@@ -7,7 +7,14 @@
# This may be useful for example in multi module maven project to load class changes from upstream project # 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. Set extraClasspath to upstream project compiler output and .class file will have precedence to
# classes from built JAR file. # classes from built JAR file.
extraClasspath=/var/lib/tomcat/dev/classes extraClasspath=/var/lib/tomcat/dev/classes; \
/var/lib/tomcat/dev/classes-extra1; \
/var/lib/tomcat/dev/classes-extra2; \
/var/lib/tomcat/dev/classes-extra3; \
/var/lib/tomcat/dev/classes-extra4; \
/var/lib/tomcat/dev/classes-extra5; \
/var/lib/tomcat/dev/classes-extra6; \
/var/lib/tomcat/dev/classes-extra7
# Watch for changes in a directory (resources only). If not set, changes of resources won't be observed. # Watch for changes in a directory (resources only). If not set, changes of resources won't be observed.
# #
@@ -19,7 +26,14 @@ extraClasspath=/var/lib/tomcat/dev/classes
# replacements of resources in a building step (maven filtering resource option). # 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 # 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. # in src/main/resources, the new changed resource is served instead.
watchResources=/var/lib/tomcat/dev/classes watchResources=/var/lib/tomcat/dev/classes; \
/var/lib/tomcat/dev/classes-extra1; \
/var/lib/tomcat/dev/classes-extra2; \
/var/lib/tomcat/dev/classes-extra3; \
/var/lib/tomcat/dev/classes-extra4; \
/var/lib/tomcat/dev/classes-extra5; \
/var/lib/tomcat/dev/classes-extra6; \
/var/lib/tomcat/dev/classes-extra7
# Load static web resources from different directory. # Load static web resources from different directory.
# #
@@ -27,11 +41,18 @@ watchResources=/var/lib/tomcat/dev/classes
# Jboss and Glassfish are not yet supported. # Jboss and Glassfish are not yet supported.
# Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp). # Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp).
webappDir=/var/lib/tomcat/dev/web webappDir=/var/lib/tomcat/dev/web
#/var/lib/tomcat/dev/web-extra1; \
#/var/lib/tomcat/dev/web-extra2; \
#/var/lib/tomcat/dev/web-extra3; \
#/var/lib/tomcat/dev/web-extra4; \
#/var/lib/tomcat/dev/web-extra5; \
#/var/lib/tomcat/dev/web-extra6; \
#/var/lib/tomcat/dev/web-extra7
# Comma separated list of disabled plugins # Comma separated list of disabled plugins
# Use plugin name - e.g. Hibernate, Spring, ZK, Hotswapper, AnonymousClassPatch, Tomcat, Logback .... # Use plugin name - e.g. Hibernate, Spring, ZK, Hotswapper, AnonymousClassPatch, Tomcat, Logback ....
disabledPlugins=Hibernate disabledPlugins=${hotswap.disablePlugins}
# Watch for changed class files on watchResources path and reload class definition in the running application. # Watch for changed class files on watchResources path and reload class definition in the running application.
# #
+38 -9
View File
@@ -3,18 +3,20 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.inteligr8</groupId> <groupId>com.inteligr8</groupId>
<artifactId>tomcat-rad</artifactId> <artifactId>tomcat-rad</artifactId>
<version>9-1.3</version> <version>9-2.0</version>
<name>Apache Tomcat for Rapid Application Development</name> <name>Apache Tomcat for Rapid Application Development</name>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<!-- The release version of the Java DCEVM Hotswap Docker image --> <!-- The release version of the Java Hotswap Docker image -->
<!-- See: https://bitbucket.org/inteligr8/java-dcevm-hotswap-docker --> <!-- See: https://bitbucket.org/inteligr8/jdk-hotswap-docker -->
<java-dcevm-hotswap.version>11.0.10-1.4.1</java-dcevm-hotswap.version> <jdk-hotswap.version>1.4.1-jbr-17.0.8</jdk-hotswap.version>
<namespace.prefix>tomcat-rad</namespace.prefix>
<!-- The version of Apache Tomcat to serve as the basis of this Docker image --> <!-- The version of Apache Tomcat to serve as the basis of this Docker image -->
<!-- See: https://tomcat.apache.org/download-90.cgi --> <!-- See: https://tomcat.apache.org/download-90.cgi -->
<tomcat.version>9.0.44</tomcat.version> <tomcat.version>9.0.80</tomcat.version>
<tomcat.majorVersion>9</tomcat.majorVersion> <tomcat.majorVersion>9</tomcat.majorVersion>
<tomcat.mirror.baseUrl>https://apache.osuosl.org/tomcat</tomcat.mirror.baseUrl> <tomcat.mirror.baseUrl>https://apache.osuosl.org/tomcat</tomcat.mirror.baseUrl>
@@ -25,12 +27,39 @@
</properties> </properties>
<build> <build>
<resources>
<resource>
<directory>.</directory>
<includes>
<include>*.sh</include>
<include>*.properties</include>
<include>*.xml</include>
</includes>
<filtering>true</filtering>
<targetPath>${project.build.directory}</targetPath>
</resource>
</resources>
<plugins> <plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals><goal>resources</goal></goals>
<configuration>
<encoding>utf-8</encoding>
<propertiesEncoding>utf-8</propertiesEncoding>
</configuration>
</execution>
</executions>
</plugin>
<!-- This plugin build and pushes the Docker image --> <!-- This plugin build and pushes the Docker image -->
<plugin> <plugin>
<groupId>io.fabric8</groupId> <groupId>org.eclipse.jkube</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>kubernetes-maven-plugin</artifactId>
<version>4.4.0</version> <version>1.14.0</version>
<configuration> <configuration>
<images> <images>
<image> <image>
@@ -60,7 +89,7 @@
<!-- This plugin prevents the project from deploying to the Maven Repository, as it is pointless --> <!-- This plugin prevents the project from deploying to the Maven Repository, as it is pointless -->
<plugin> <plugin>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version> <version>3.1.1</version>
<configuration> <configuration>
<skip>true</skip> <skip>true</skip>
</configuration> </configuration>
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
CATALINA_OPTS="${JAVA_OPTS} ${CATALINA_OPTS}"
JAVA_OPTS=""