Install - Java Dynamic Agent on Containerized Wildfly or JBoss App


Installation Steps

  1. Download the latest vFunction Sudoless Controller Installation TGZ
  2. Create a folder for vFunction artifacts in the Artifact Repository accessible by the Docker Build
  3. Add the vFunction Sudoless Controller Installation TGZ to the Artifact Repository
  4. Create a vFunction specific branch to add the vFunction artificats to the Application’s Dockerfile
  5. Find and note the base path to your Wildfly Application Server
### This should return the location of the bin/standalone.conf which should be in the Wildfly base path
find / -name 'standalone.conf' -type f
  1. Find and note the location and version of the wildfly-common-VERSION.jar on your Wildfly Application Server
find / -name wildfly-common-*.jar -type f
  1. Find and note the location and version of the jboss-logmanager-VERSION.jar on your Wildfly Application Server
find / -name jboss-logmanager-*.jar -type f
  1. Modify the Application’s Dockerfile. Note that this can be done by adding Environment Variables for vFunction or by modifying an Installation.yaml

Environment Variables for Dockerfile

FROM jboss/wildfly:25.0.0.Final

USER root

COPY EXISTING_WORKFLOW
RUN EXISTING_WORKFLOW

### vFunction Workflow
### If necessary, modify based on step #7 above
ENV WILDFLY_BASE=/opt/jboss/wildfly

### If necessary, modify based on step #8 & #9 above
ARG WILDFLY_COMMON_VER=1.5.4
ARG JBOSS_LOGMANAGER_VER=2.1.18

COPY ARTIFACT_REPOSITORY/vfunction/vfunction-controller-sudo-less-installation*.tgz /tmp/vfunction-controller-sudo-less-installation.tgz

ENV VF_CONTROLLER_DEFAULT_JAVA_AGENT_APPLICATION_SERVER="wildfly"
ENV VF_CONTROLLER_DEFAULT_JAVA_AGENT_APPLICATION_JAVA_VERSION=11

### See https://kb.vfunction.com/installations/configurable-settings/mono-dynamic-agent/java/linux for more details about each of the settings below
ENV VF_CONTROLLER_DEFAULT_JAVA_CONTROLLER_HOST="http://vfunction.myorg.com"
ENV VF_CONTROLLER_DEFAULT_JAVA_CONTROLLER_NAME="docker-agent"
ENV VF_CONTROLLER_DEFAULT_JAVA_CONTROLLER_ORG_ID="1111-11-11-1111"
ENV VF_CONTROLLER_DEFAULT_JAVA_CONTROLLER_APP_ID="1111-11-11-1111"
ENV VF_CONTROLLER_DEFAULT_JAVA_CONTROLLER_CLIENT_ID="1111-11-11-1111"
ENV VF_CONTROLLER_DEFAULT_JAVA_CONTROLLER_CLIENT_SECRET="1111-11-11-1111"
ENV VF_CONTROLLER_DEFAULT_JAVA_CONTROLLER_INSTANCE_ID="container"
ENV VF_CONTROLLER_DEFAULT_JAVA_CONTROLLER_TAGS="prod"

RUN cd /tmp/ && tar -xvzf /tmp/vfunction-controller-sudo-less-installation.tgz  && \
 rm -rf /tmp/vfunction-controller-sudo-less-installation.tgz  && \
 bash /tmp/vfunction/opt/vfunction/controller-installation/install.sh -i default-java -n  && \
 cat /tmp/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/vmargs-examples/wildfly >> $WILDFLY_BASE/bin/standalone.conf  && \
 chmod -R 777 /tmp/vfunction  && \
 chown -R jboss:root /tmp/vfunction/  && \
 sed -i "s~<your-wildfly-base-path>~$WILDFLY_BASE~g" $WILDFLY_BASE/bin/standalone.conf  && \
 sed -i "s~wildfly-common-<version>.jar~wildfly-common-${WILDFLY_COMMON_VER}.Final.jar~g" $WILDFLY_BASE/bin/standalone.conf  && \
 sed -i "s~jboss-logmanager-<version>.jar~jboss-logmanager-${JBOSS_LOGMANAGER_VER}.Final.jar~g" $WILDFLY_BASE/bin/standalone.conf

USER jboss

ENTRYPOINT [ EXISTING_WORKFLOW ]

Installation.yaml for Dockerfile

  1. Create the installation.yaml
controller:
  name: #VF UI identifier for this instance
  host: #VF Server URL
  org_id: #Taken from VF UI's Installation Instructions dialog box
  app_id: #Taken from VF UI's Installation Instructions dialog box
  client_id: #Taken from VF UI's Installation Instructions dialog box
  client_secret: #Taken from VF UI's Installation Instructions dialog box
  instance_id: #Use the same string as the NAME
  type: java
  instrconf_additions:
    inclusions:
#      - a.b.c.
    exclusions:
#      - a.b.c.
  tags:
    - tag1 #Create Tags for the Environment, e.g. Integration, Prod, Stage, QA
  client_certificate:
    crt: |
      -----BEGIN CERTIFICATE-----
      ...
      -----END CERTIFICATE-----      
    key: |
      -----BEGIN PRIVATE KEY-----
      ...
      -----END PRIVATE KEY-----      

server_application:
#  name:
#  include_classes: com.
#  allowed_users:
#  new_user_default_password:

agent:
  ### Disable JDBC DB Tracking ###
  disable_jdbc: false
  ### Disable Spring Tracking ###
  disable_spring: false
  ### Optional application servers: weblogic, websphere85, websphere9, liberty, tomcat, wildfly, payara, other ###
  application_server: wildfly
  ### Indicate the application java version when greater than 8. (optional - default to 8) ###
  application_java_version: 11
  ### Add process ID to log file name (true/false). Default is false ###
#  add_pid_to_log_file: false
  override_properties:
  1. Add the installation.yaml to the build
  2. Modify the Dockerfile to add the installation.yaml to the build
FROM jboss/wildfly:25.0.0.Final

USER root

COPY EXISTING_WORKFLOW
RUN EXISTING_WORKFLOW

### vFunction Workflow
### If necessary, modify based on step #7 above
ENV WILDFLY_BASE=/opt/jboss/wildfly

### If necessary, modify based on step #8 & #9 above
ARG WILDFLY_COMMON_VER=1.5.4
ARG JBOSS_LOGMANAGER_VER=2.1.18

COPY ARTIFACT_REPOSITORY/vfunction/vfunction-controller-sudo-less-installation*.tgz /tmp/vfunction-controller-sudo-less-installation.tgz
COPY ARTIFACT_REPOSITORY/vfunction/installation.yaml /tmp/installation.yaml

RUN cd /tmp/ && tar -xvzf /tmp/vfunction-controller-sudo-less-installation.tgz  && \
 rm -rf /tmp/vfunction-controller-sudo-less-installation.tgz  && \
 cp /tmp/installation.yaml /tmp/vfunction/etc/sysconfig/vfunction/installation/instances/default-java/installation.yaml   && \
 bash /tmp/vfunction/opt/vfunction/controller-installation/install.sh -i default-java -n  && \
 cat /tmp/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/vmargs-examples/wildfly >> $WILDFLY_BASE/bin/standalone.conf  && \
 chmod -R 777 /tmp/vfunction  && \
 chown -R jboss:root /tmp/vfunction/  && \
 sed -i "s~<your-wildfly-base-path>~$WILDFLY_BASE~g" $WILDFLY_BASE/bin/standalone.conf  && \
 sed -i "s~wildfly-common-<version>.jar~wildfly-common-${WILDFLY_COMMON_VER}.Final.jar~g" $WILDFLY_BASE/bin/standalone.conf  && \
 sed -i "s~jboss-logmanager-<version>.jar~jboss-logmanager-${JBOSS_LOGMANAGER_VER}.Final.jar~g" $WILDFLY_BASE/bin/standalone.conf

USER jboss

ENTRYPOINT [ EXISTING_WORKFLOW ]
  1. Build and deploy the Application
  2. Confirm that the Application comes up and functions as expected
  3. If any issues arise:

Sample JVM Parameters

In the Dockerfile examples above, the JVM Parameters are cat’d into the standalone.conf. In case this is not the correct location for these JVM Parameters or to just review them, they are listed out below:

# vFunction
BASE_DIR="/tmp/vfunction"
INSTANCE="default-java"
WILDFLY_BASE_PATH=""
WILDFLY_COMMON_VER=1.5.4
JBOSS_LOGMANAGER_VER=2.1.18

VFUN_OPTS="-agentpath:$BASE_DIR/opt/vfunction/agent/libJVMTIAgent.so=conf=$BASE_DIR/etc/sysconfig/vfunction/agent/instances/$INSTANCE/native-conf.json -javaagent:$BASE_DIR/opt/vfunction/agent/runtime-agent.jar=ConfigLocation=$BASE_DIR/etc/sysconfig/vfunction/agent/instances/$INSTANCE/vfunction-runtime-override.properties -Dcom.vfunction.logging.logFile=$BASE_DIR/var/log/vfunction/instances/$INSTANCE/vfagent.log"

export JAVA_OPTS="$VFUN_OPTS -Dsun.util.logging.disableCallerCheck=true -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/a:$WILDFLY_BASE_PATH/modules/system/layers/base/org/wildfly/common/main/wildfly-common-$WILDFLY_COMMON_VER.jar -Xbootclasspath/a:$WILDFLY_BASE_PATH/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-$JBOSS_LOG_MANAGER_VER.jar $JAVA_OPTS"