Compare commits

...
Author SHA1 Message Date
brian.long baff429fe3 Merge branch 'develop' into develop-tomcat10 2026-05-21 20:32:55 -04:00
brian.long 11dcc50a0c refactored 2026-05-21 20:32:13 -04:00
brian.long 6b88cbe3e8 generic jbr 2026-05-21 09:20:09 -04:00
brian.long 086a17cf98 Merge branch 'develop' into develop-tomcat10 2026-05-21 09:04:57 -04:00
brian.long b7ff68327a additional tagging 2026-05-21 09:04:46 -04:00
brian.long 35c38baa30 tomcat v10.1.55 2026-05-20 16:41:44 -04:00
brian.long 849cfde955 tabs, not spaces 2026-05-20 16:40:08 -04:00
brian.long 487c6814f2 fix kubernetes-maven-plugin upgrade 2026-03-24 10:56:00 -04:00
brian.long 958f42d84c flipped versioning scheme 2026-03-24 10:19:26 -04:00
brian.long 6744e46e28 upgrade plugins 2026-03-24 10:17:38 -04:00
brian.long 2db4660274 tomcat v10.1.52 2026-03-24 09:34:55 -04:00
brian.long be858e0eba upgrade jdk/tomcat 2025-05-27 17:06:52 -04:00
brian.long 9cf3390724 Merge branch 'develop-tomcat9' into develop 2025-01-31 16:46:16 -05:00
brian.long 1a24064c1b support old tomcat version downloads 2025-01-31 16:45:46 -05:00
brian.long 8fcceaa19d refactored; downgrade jkube to v1.16.2 2025-01-31 16:44:05 -05:00
brian.long 36bbc9f02a v10-2.2 pom 2025-01-31 16:05:24 -05:00
brian.long ec3dab1f9f Merge commit '342213e47d83a2e98ce01ce2a2dc3be0d7a94063' into develop 2025-01-31 16:04:36 -05:00
brian.long 7872db4ff8 v9-2.2 pom 2025-01-31 16:03:32 -05:00
brian.long 342213e47d updated tomcat; jdk-hotswap; mvn plugins 2025-01-31 16:02:45 -05:00
brian.long 07ff4f5635 upgraded tomcat to v10 2024-08-07 11:29:49 -04:00
brian.long 063c1123b5 upgraded various versions 2024-08-07 11:27:14 -04:00
brian.long e142e32d64 added post resource loading 2024-03-14 12:19:24 -04:00
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 240 additions and 91 deletions
+43
View File
@@ -0,0 +1,43 @@
# 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 | When |
| -------------------------------------- |:---------:|:------------:|:----:|
| `/var/lib/tomcat/dev/classes` | Classpath | Yes | Before WAR |
| `/var/lib/tomcat/dev/classes-extra1` | Classpath | Yes | Before WAR |
| `/var/lib/tomcat/dev/classes-extra2` | Classpath | Yes | Before WAR |
| `/var/lib/tomcat/dev/classes-extra3` | Classpath | Yes | Before WAR |
| `/var/lib/tomcat/dev/classes-extra4` | Classpath | Yes | Before WAR |
| `/var/lib/tomcat/dev/classes-extra5` | Classpath | Yes | Before WAR |
| `/var/lib/tomcat/dev/classes-extra6` | Classpath | Yes | Before WAR |
| `/var/lib/tomcat/dev/classes-extra7` | Classpath | Yes | Before WAR |
| `/var/lib/tomcat/dev/post-rsrc` | Classpath | Yes | After WAR |
| `/var/lib/tomcat/dev/post-rsrc-extra1` | Classpath | Yes | After WAR |
| `/var/lib/tomcat/dev/post-rsrc-extra2` | Classpath | Yes | After WAR |
| `/var/lib/tomcat/dev/post-rsrc-extra3` | Classpath | Yes | After WAR |
| `/var/lib/tomcat/dev/lib` | JARs | No | Before WAR |
| `/var/lib/tomcat/dev/lib-extra1` | JARs | No | Before WAR |
| `/var/lib/tomcat/dev/lib-extra2` | JARs | No | Before WAR |
| `/var/lib/tomcat/dev/lib-extra3` | JARs | No | Before WAR |
| `/var/lib/tomcat/dev/lib-extra4` | JARs | No | Before WAR |
| `/var/lib/tomcat/dev/lib-extra5` | JARs | No | Before WAR |
| `/var/lib/tomcat/dev/lib-extra6` | JARs | No | Before WAR |
| `/var/lib/tomcat/dev/lib-extra7` | JARs | No | Before WAR |
| `/var/lib/tomcat/dev/post-lib` | JARs | No | After WAR |
| `/var/lib/tomcat/dev/post-lib-extra1` | JARs | No | After WAR |
| `/var/lib/tomcat/dev/post-lib-extra2` | JARs | No | After WAR |
| `/var/lib/tomcat/dev/post-lib-extra3` | JARs | No | After WAR |
| `/var/lib/tomcat/dev/web` | Web | Yes | Before WAR |
| `/var/lib/tomcat/dev/web-extra1` | Web | No | Before WAR |
| `/var/lib/tomcat/dev/web-extra2` | Web | NO | Before WAR |
| `/var/lib/tomcat/dev/web-extra3` | Web | NO | Before WAR |
| `/var/lib/tomcat/dev/web-extra4` | Web | No | Before WAR |
| `/var/lib/tomcat/dev/web-extra5` | Web | No | Before WAR |
| `/var/lib/tomcat/dev/web-extra6` | Web | No | Before WAR |
| `/var/lib/tomcat/dev/web-extra7` | Web | No | Before WAR |
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.
+92 -15
View File
@@ -3,43 +3,121 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.inteligr8</groupId>
<artifactId>tomcat-rad</artifactId>
<version>9-1.3</version>
<version>${base.version}-tomcat-${tomcat.version}</version>
<name>Apache Tomcat for Rapid Application Development</name>
<packaging>pom</packaging>
<properties>
<!-- The release version of the Java DCEVM Hotswap Docker image -->
<!-- See: https://bitbucket.org/inteligr8/java-dcevm-hotswap-docker -->
<java-dcevm-hotswap.version>11.0.10-1.4.1</java-dcevm-hotswap.version>
<base.version>2.3</base.version>
<!-- The release version of the Java Hotswap Docker image -->
<!-- See: https://git.inteligr8.com/inteligr8/jdk-hotswap-image -->
<!-- See: https://repos.inteligr8.com/nexus/service/rest/repository/browse/inteligr8-docker-public/v2/inteligr8/jdk-hotswap/tags/ -->
<jdk-hotswap.version>2.0.3-jbr17</jdk-hotswap.version>
<!-- The version of Apache Tomcat to serve as the basis of this Docker image -->
<!-- See: https://tomcat.apache.org/download-90.cgi -->
<tomcat.version>9.0.44</tomcat.version>
<tomcat.majorVersion>9</tomcat.majorVersion>
<tomcat.mirror.baseUrl>https://apache.osuosl.org/tomcat</tomcat.mirror.baseUrl>
<!-- See: https://tomcat.apache.org/download-10.cgi -->
<tomcat.version>10.1.55</tomcat.version>
<tomcat.mirror.baseUrl>https://archive.apache.org/dist/tomcat</tomcat.mirror.baseUrl>
<!-- 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>
<!-- using version properties so they can be overridden by child projects or Maven executions -->
<maven-resources-plugin.version>3.5.0</maven-resources-plugin.version>
<maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
<kubernetes-maven-plugin.version>1.19.0</kubernetes-maven-plugin.version>
<regex-maven-plugin.version>1.0.7</regex-maven-plugin.version>
</properties>
<build>
<resources>
<resource>
<directory>src/main/containerd</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/resources</targetPath>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<version>${kubernetes-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>com.inteligr8</groupId>
<artifactId>regex-maven-plugin</artifactId>
<version>${regex-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.inteligr8</groupId>
<artifactId>regex-maven-plugin</artifactId>
<executions>
<execution>
<id>determine-tomcat-major-version</id>
<phase>validate</phase>
<goals>
<goal>replace-property</goal>
</goals>
<configuration>
<property>tomcat.version</property>
<newProperty>tomcat.majorVersion</newProperty>
<regexes>
<regex>
<pattern>([^.]+).*</pattern>
<replacement>$1</replacement>
</regex>
</regexes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<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 -->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>4.4.0</version>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
<build>
<contextDir>${project.build.directory}/resources</contextDir>
<dockerFile>Containerfile</dockerFile>
<tags>
<tag>${base.version}-tomcat${tomcat.majorVersion}</tag>
</tags>
</build>
</image>
</images>
<contextDir>${basedir}</contextDir>
<buildStrategy>docker</buildStrategy>
<verbose>true</verbose>
</configuration>
<executions>
@@ -60,7 +138,6 @@
<!-- 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>
@@ -72,7 +149,7 @@
<profile>
<id>no-docker</id>
<properties>
<fabric8.build.jib>true</fabric8.build.jib>
<jkube.build.strategy>jib</jkube.build.strategy>
</properties>
</profile>
</profiles>
@@ -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
ENV JAVA_MEMORY_INIT=128m
@@ -22,28 +22,21 @@ RUN cd /usr/local/share/tomcat && \
# Add directories for dynamic injection points
RUN cd /var/lib/tomcat/dev && \
mkdir classes classes-extra1 classes-extra2 classes-extra3 classes-extra4 classes-extra5 classes-extra6 classes-extra7 && \
mkdir post-rsrc post-rsrc-extra1 post-rsrc-extra2 post-rsrc-extra3 && \
mkdir lib lib-extra1 lib-extra2 lib-extra3 lib-extra4 lib-extra5 lib-extra6 lib-extra7 && \
mkdir post-lib post-lib-extra1 post-lib-extra2 post-lib-extra3 && \
mkdir web web-extra1 web-extra2 web-extra3 web-extra4 web-extra5 web-extra6 web-extra7
# Add our Docker container initialization script
COPY docker-entrypoint.sh /usr/local/bin
ADD --chmod=755 maven/setenv.sh ${CONTAINERD_ENTRYPOINT_PATH}/40-setenv-${artifactId}.sh
# Add our Apache Tomcat configuration
# This gives us dynamic injection points into the running webapps
COPY tomcat-context.xml /var/lib/tomcat/conf/context.xml
ADD hotswap-agent.properties /var/lib/tomcat/lib
ADD --chmod=644 maven/tomcat-context.xml /var/lib/tomcat/conf/context.xml
ADD --chmod=644 maven/hotswap-agent.properties /var/lib/tomcat/lib
# Listening for HTTP (not HTTPS) traffic
EXPOSE 8080
# Listening for Java debugger traffic
EXPOSE 8000
# Running as ROOT user for now
#USER tomcat
# Execute the Docker container initialization script
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint.sh" ]
# Start the Apache Tomcat web container using the Catalina script
CMD [ "/usr/local/share/tomcat/bin/catalina.sh", "run" ]
@@ -7,7 +7,18 @@
# 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=/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; \
/var/lib/tomcat/dev/post-rsrc; \
/var/lib/tomcat/dev/post-rsrc-extra1; \
/var/lib/tomcat/dev/post-rsrc-extra2; \
/var/lib/tomcat/dev/post-rsrc-extra3
# Watch for changes in a directory (resources only). If not set, changes of resources won't be observed.
#
@@ -19,7 +30,18 @@ extraClasspath=/var/lib/tomcat/dev/classes
# 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=/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; \
/var/lib/tomcat/dev/post-rsrc; \
/var/lib/tomcat/dev/post-rsrc-extra1; \
/var/lib/tomcat/dev/post-rsrc-extra2; \
/var/lib/tomcat/dev/post-rsrc-extra3
# Load static web resources from different directory.
#
@@ -27,11 +49,18 @@ watchResources=/var/lib/tomcat/dev/classes
# 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/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
# 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.
#
@@ -1,4 +1,3 @@
#!/bin/bash
#!/bin/sh
CATALINA_OPTS="${JAVA_OPTS} ${CATALINA_OPTS}"
exec "$@"
JAVA_OPTS=""
@@ -40,6 +40,10 @@
<PreResources base="/var/lib/tomcat/dev/classes-extra5" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/classes" />
<PreResources base="/var/lib/tomcat/dev/classes-extra6" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/classes" />
<PreResources base="/var/lib/tomcat/dev/classes-extra7" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/classes" />
<PostResources base="/var/lib/tomcat/dev/post-rsrc" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/classes" />
<PostResources base="/var/lib/tomcat/dev/post-rsrc-extra1" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/classes" />
<PostResources base="/var/lib/tomcat/dev/post-rsrc-extra2" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/classes" />
<PostResources base="/var/lib/tomcat/dev/post-rsrc-extra3" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/classes" />
<!-- Injection point for JARs -->
<PreResources base="/var/lib/tomcat/dev/lib" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/lib" />
<PreResources base="/var/lib/tomcat/dev/lib-extra1" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/lib" />
@@ -49,6 +53,10 @@
<PreResources base="/var/lib/tomcat/dev/lib-extra5" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/lib" />
<PreResources base="/var/lib/tomcat/dev/lib-extra6" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/lib" />
<PreResources base="/var/lib/tomcat/dev/lib-extra7" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/lib" />
<PostResources base="/var/lib/tomcat/dev/post-lib" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/lib" />
<PostResources base="/var/lib/tomcat/dev/post-lib-extra1" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/lib" />
<PostResources base="/var/lib/tomcat/dev/post-lib-extra2" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/lib" />
<PostResources base="/var/lib/tomcat/dev/post-lib-extra3" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/WEB-INF/lib" />
<!-- Injection points for web -->
<PreResources base="/var/lib/tomcat/dev/web" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/" />
<PreResources base="/var/lib/tomcat/dev/web-extra1" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/" />