Skip to content

jamf/jamfpro

Repository files navigation

JamfPro Tomcat Docker Image

Please Note

The Dockerhub image has moved to the Jamf namespace and tags will pushed here: Dockerhub Tags

Description

Basic example Docker image based upon upstream Tomcat image to run a manually downloaded JamfPro ROOT.war from JamfNation.

Note

This repository is provided as an example of how to construct a very basic Docker image to run a JamfPro server. Please refer to this JamfNation post - Apache Tomcat Versions Installed by the Jamf Pro Installer - to determine which Tomcat versions are explictly supported for a particular version of JamfPro.

Features

  • Creates and runs Tomcat as user:group tomcat (non-root)
  • Correct pathing for JamfPro file logs
  • Logs to stdout of JamfPro logs in addition to catalina logs
  • JMX connection information
  • Remote database connection in DataBase.xml

Docker Build Options

Override the version of Tomcat used:

docker build --build-arg "TOMCAT_VERSION=8.5.85-jdk11" -t jamfpro .

Replace the server.template file prior to building to override the server.xml Tomcat file.

Environment Variable Options

STDOUT_LOGGING [ true ] / false

DATABASE_HOST [ localhost ]
DATABASE_NAME [ jamfsoftware ]
DATABASE_USERNAME [ jamfsoftware ]
DATABASE_PASSWORD [ jamfsw03 ]
DATABASE_PORT [ 3306 ]
JDBC_PARAMETERS [ ]

JMXREMOTE true / [ false ]
JMXREMOTE_PORT
JMXREMOTE_RMI_PORT
JMXREMOTE_SSL
JMXREMOTE_AUTHENTICATE
RMI_SERVER_HOSTNAME
JMXREMOTE_PASSWORD_FILE

CATALINA_OPTS
JAVA_OPTS [ -Djava.awt.headless=true ]

PRIMARY_NODE_NAME -- Enable clustering
  This MUST be the ip address of the primary as recognized by Tomcat
  There is no direct JamfPro primary <--> secondary communication so the ip need not be reachable by the secondary directly

POD_NAME -- Enable Kubernetes clustering via downward API
POD_IP -- Enable Kubernetes clustering via downward API

MEMCACHED_HOST -- Enable Memcached caching, assumes port 11211 by default

server.xml template overrides:

tomcat_executor_max_threads - 150
tomcat_executor_min_threads - 4
tomcat_connector_port - 8080
tomcat_connection_timeout - 61000
tomcat_connector_proxy_port - 443
tomcat_connector_server - Jamf
tomcat_connector_max_parameter_count - 300000
tomcat_host_app_base - webapps
tomcat_host_unpack_wars - true
tomcat_host_auto_deploy - true
tomcat_host_start_stop_threads - 4
tomcat_host_stuck_threads_threshold - 600

Data Persistence

This image requires that either a /data/ROOT.war be bind-mounted and exist, or the /usr/bin/tomcat/webapps/ROOT directory exist. A ROOT.war will be auto-unpacked and configured based upon the above environment variables, or if the ROOT directory already exists, nothing will be unpacked but logging paths, database information, JMX, and Java opts will be set.

File Override Config

The DataBase.xml file can be optionally mounted into the container's /config directory, this will override any environment variables set.

Example

Run a basic JamfPro instance with port 8080 exposed locally on port 8080, setup remote database, bind-mounted ROOT.war, and bind-mounted webapps directory.

docker run -p 8080:8080 -d \
-e DATABASE_USERNAME=root \
-e DATABASE_PASSWORD=jamfsw03 \
-e DATABASE_HOST=host.docker.internal \
-v $(pwd)/ROOT.war:/data/ROOT.war \
-v $(pwd)/webapps:/usr/local/tomcat/webapps \
jamf/jamfpro:0.0.18

Valid image tags can be found on Dockerhub Tags or Github Releases.

Kubernetes Deployment

When enabling clustering the Tomcat manifest should include both POD_NAME and POD_IP environment variables which can be accessed via the Kubernetes downward API. The environment variable PRIMARY_NODE_NAME should be set to whichever pod will become the primary node. An example of utilizing the downward API in a manifest:

- name: POD_NAME
valueFrom:
  fieldRef:
    fieldPath: metadata.name
- name: POD_IP
valueFrom:
  fieldRef:
    fieldPath: status.podIP