Chapter 5. Reference

5.1. Version Details

The table below lists versions of technologies used in this image.

Table 5.1. Technologies used and their version

TechnologyVersion

OpenJDK

8

Jolokia

1.3.5

Maven

3.3.9-2.8

5.2. Information Environment Variables

The following information environment variables are designed to convey information about the image and should not be modified by the user:

Table 5.2. Information Environment Variables

Variable NameDescriptionExample Value

HOME

-

/home/jboss

JAVA_DATA_DIR

-

/deployments/data

JAVA_HOME

-

/usr/lib/jvm/java-1.8.0

JAVA_VENDOR

-

openjdk

JAVA_VERSION

-

1.8.0

JBOSS_IMAGE_NAME

Image name, same as Name label

redhat-openjdk-18/openjdk18-openshift

JBOSS_IMAGE_RELEASE

Image release, same as Release label.

2

JBOSS_IMAGE_VERSION

Image version, same as Version label.

1.0

JOLOKIA_VERSION

-

1.3.5

MAVEN_VERSION

-

3.3.9-2.8.el7

PATH

-

$PATH:"/usr/local/s2i"

5.3. Configuration Environment Variables

Configuration environment variables are designed to conveniently adjust the image without requiring a rebuild, and should be set by the user as desired.

Table 5.3. Configuration Environment Variables

Variable NameDescriptionExample Value

AB_JOLOKIA_AUTH_OPENSHIFT

Switch on client authentication for OpenShift TLS communication. The value of this parameter can be a relative distinguished name which must be contained in a presented client certificate. Enabling this parameter will automatically switch Jolokia into https communication mode. The default CA cert is set to /var/run/secrets/kubernetes.io/serviceaccount/ca.crt

true

AB_JOLOKIA_CONFIG

If set uses this file (including path) as Jolokia JVM agent properties (as described in Jolokia’s reference manual). If not set, the /opt/jolokia/etc/jolokia.properties file will be created using the settings as defined in this document, otherwise the rest of the settings in this document are ignored.

/opt/jolokia/custom.properties

AB_JOLOKIA_DISCOVERY_ENABLED

Enable Jolokia discovery. Defaults to false.

true

AB_JOLOKIA_HOST

Host address to bind to, the default address is 0.0.0.0.

127.0.0.1

AB_JOLOKIA_HTTPS

Switch on secure communication with https. By default self-signed server certificates are generated if no serverCert configuration is given in AB_JOLOKIA_OPTS. NOTE: If the values is set to an empty string, https is turned off. If the value is set to a non empty string, https is turned on.

true

AB_JOLOKIA_OFF

If set disables activation of Jolokia (i.e. echos an empty value). By default, Jolokia is enabled. NOTE: If the values is set to an empty string, https is turned off. If the value is set to a non empty string, https is turned on.

true

AB_JOLOKIA_OPTS

Additional options to be appended to the agent configuration. They should be given in the format "key=value, key=value, …​ "

backlog=20

AB_JOLOKIA_PASSWORD

Password for basic authentication. By default authentication is switched off.

mypassword

AB_JOLOKIA_PASSWORD_RANDOM

If set, a random value is generated for AB_JOLOKIA_PASSWORD, and it is saved in the /opt/jolokia/etc/jolokia.pw file.

true

AB_JOLOKIA_PORT

Port to use (Default: 8778)

5432

AB_JOLOKIA_USER

User for basic authentication. Defaults to 'jolokia'

myusername

ARTIFACT_COPY_ARGS

Arguments to use when copying artifacts from the output directory to the application directory. Useful to specify which artifacts will be part of the image. It defaults to -r hawt-app/ when a hawt-app directory is found on the build directory, otherwise jar files only will be included (.jar).

-r hawt-app/*

ARTIFACT_DIR

Path to target/ where the jar files are created for multi-module builds. These are added to MAVEN_ARGS

/plugins

CONTAINER_CORE_LIMIT

A calculated core limit as described in CFS Bandwidth Control

2

CONTAINER_MAX_MEMORY

Memory limit given to the container. This value must be in bytes.

536870912 (which results into -Xmx256 (default ratio is 50%))

GC_ADAPTIVE_SIZE_POLICY_WEIGHT

The weighting given to the current Garbage Collection (GC) time versus previous GC times.

90

GC_MAX_HEAP_FREE_RATIO

Maximum percentage of heap free after GC to avoid shrinking.

40

GC_MAX_METASPACE_SIZE

The maximum metaspace size.

100

GC_MIN_HEAP_FREE_RATIO

Minimum percentage of heap free after GC to avoid expansion.

20

GC_TIME_RATIO

Specifies the ratio of the time spent outside the garbage collection (for example, the time spent for application execution) to the time spent in the garbage collection.

4

HTTP_PROXY

The location of the http proxy, this will be used for both Maven builds and Java runtime

127.0.0.1:8080

http_proxy

The location of the http proxy, this takes precedence over HTTP_PROXY and will be used for both Maven builds and Java runtime

http://127.0.0.1:8080

HTTPS_PROXY

The location of the https proxy, this takes precedence over http_proxy and HTTP_PROXY and will be used for both Maven builds and Java runtime

myuser@127.0.0.1:8080

https_proxy

The location of the https proxy, this takes precedence over http_proxy, HTTP_PROXY, and HTTPS_PROXY and will be used for both Maven builds and Java runtime

myuser:mypass@127.0.0.1:8080

JAVA_APP_DIR

The directory where the application resides. All paths in your application are relative to this directory.

myapplication/

JAVA_APP_JAR

A jar file with an appropriate manifest so that it can be started with Java -jar if no JAVA_MAIN_CLASS is set. In all cases this jar file is added to the classpath, too.

Configuration dependent.

JAVA_APP_NAME

Name to use for the process

demo-app

JAVA_ARGS

Arguments passed to the Java application

hello_world

JAVA_CLASSPATH

The classpath to use. If JAVA_LIB_DIR is set, the startup script checks for a file JAVA_LIB_DIR/classpath. If it is not set, the startup script checks for a file JAVA_APP_DIR/classpath and use its content as classpath. If this file doesn’t exists all jars in the application directory are added (classes:JAVA_APP_DIR/*).

Configuration dependent.

JAVA_DEBUG

If set remote debugging will be switched on

true

JAVA_DEBUG_PORT

Port used for remote debugging. Default: 5005

9009

JAVA_DIAGNOSTICS

Set this to get some diagnostics information to standard out when things are happening

true

JAVA_LIB_DIR

Directory holding the Java jar files as well an optional classpath file which holds the classpath. Either as a single-line classpath (colon separated) or with jar files listed line-by-line. If not set JAVA_LIB_DIR is the same as JAVA_APP_DIR.

Configuration dependent.

JAVA_MAIN_CLASS

A main class to use as argument for Java. When this environment variable is given, all jar files in JAVA_APP_DIR are added to the classpath as well as JAVA_LIB_DIR.

com.example.MyMainClass

JAVA_MAX_MEM_RATIO

It is used when no -Xmx option is given in JAVA_OPTIONS. This is used to calculate a default maximal Heap Memory based on a containers restriction. If used in a Docker container without any memory constraints for the container then this option has no effect. If there is a memory constraint then -Xmx is set to a ratio of the container available memory as set here. The default is 50 which means 50% of the available memory is used as an upper boundary. You can skip this mechanism by setting this value to 0 in which case no -Xmx option is added.

40

JAVA_OPTIONS

JVM options passed to the Java command

-verbose:class

MAVEN_ARGS

Arguments to use when calling Maven, replacing the default value -e -Popenshift -DskipTests -Dcom.redhat.xpaas.repo.redhatga -Dfabric8.skip=true package. Also read Default Maven settings with Maven Arguments

-e -Popenshift -DskipTests -Dcom.redhat.xpaas.repo.redhatga package

MAVEN_ARGS_APPEND

Additional Maven arguments

-X -am -pl

MAVEN_CLEAR_REPO

If set then the Maven repository is removed after the artifact is built. This is useful for keeping the created application image small, but prevents incremental builds. The default is false

true

MAVEN_MIRROR_URL

The base URL of a mirror used for retrieving artifacts

http://10.0.0.1:8080/repository/internal/

NO_PROXY

A comma-separated lists of hosts, IP addresses or domains that can be accessed directly, this will be used for both Maven builds and Java runtime

foo.example.com,bar.example.com

no_proxy

A comma-separated lists of hosts, IP addresses or domains that can be accessed directly, this takes precedence over NO_PROXY and will be used for both Maven builds and Java runtime

*.example.com

Varies depending on the configuration, therefore no generic example is provided.

Note

Other environment variables not listed above that can influence the product can be found in JBOSS documentation.

5.4. Exposed Ports

Port NumberDescription

8080

HTTP

8443

HTTPS

8778

Jolokia Monitoring

5.5. Configuring Maven Settings

5.5.1. Default Maven Settings with Maven Arguments

The default value of MAVEN_ARGS environment variable contains the -Dcom.redhat.xpaas.repo.redhatga property. This property activates a profile with the https://maven.repository.redhat.com/ga/ repository within the default jboss-settings.xml file, which resides in the Java S2I for OpenShift image.

When specifying a custom value for the MAVEN_ARGS environment variable, if a custom source_dir/configuration/settings.xml file is not specified, the default jboss-settings.xml in the image is used.

To specify which Maven repository will be used within the default jboss-settings.xml, there are two properties:

  1. The -Dcom.redhat.xpaas.repo.redhatga property, to use the https://maven.repository.redhat.com/ga/ repository.
  2. The -Dcom.redhat.xpaas.repo.jbossorg property to use the https://repository.jboss.org/nexus/content/groups/public/ repository.

5.5.2. Providing Custom Maven Settings

To specify a custom settings.xml file along with Maven arguments, create the source_dir/configuration directory and place the settings.xml file inside.

Sample path should be similar to: source_dir/configuration/settings.xml.