Overview

OpenShift Origin provides S2I enabled Wildfly images for building and running Java applications. The Wildfly S2I builder image assembles your application source with any required dependencies to create a new image containing your Java application. This resulting image can be run either by OpenShift Origin or by Docker.

Versions

Currently, OpenShift Origin supports version 10.1 and 10.0 of Wildfly.

Images

These images are available on DockerHub. To download them:

$ docker pull openshift/wildfly-101-centos7
$ docker pull openshift/wildfly-100-centos7

To use these images, you can either access them directly from DockerHub or push them into your OpenShift Origin Docker registry. Additionally, you can create an image stream that points to the image, either in your Docker registry or at the external location. Your OpenShift Origin resources can then reference the ImageStream. You can find example image stream definitions for all the provided OpenShift Origin images.

Configuration

The Wildfly image supports a number of environment variables which can be set to control the configuration and behavior of the Wildfly application server.

To set these environment variables as part of your image, you can place them into a .s2i/environment file inside your source code repository, or define them in the environment section of the build configuration’s sourceStrategy definition.

You can also set environment variables to be used with an existing image when creating new applications, or by updating environment variables for existing objects such as deployment configurations.

Environment variables that control build behavior must be set as part of the s2i build configuration or in the .s2i/environment file to make them available to the build steps.

Table 1. Wildfly Environment Variables
Variable name Description

MAVEN_ARGS

Overrides the default arguments passed to Maven during the build process.

MAVEN_ARGS_APPEND

This value will be appended to either the default Maven arguments, or the value of MAVEN_ARGS if MAVEN_ARGS is set.

MAVEN_OPTS

Contains JVM parameters to Maven. Will be appended to JVM arguments that are calculated by the image itself (e.g. heap size), so values provided here will take precedence.

JAVA_GC_OPTS

When set to a non-null value, this value will be passed to the JVM instead of the default garbage collection tuning values defined by the image.

CONTAINER_CORE_LIMIT

When set to a non-null value, the number of parallel garbage collection threads will be set to this value.

USE_JAVA_DIAGNOSTICS

When set to a non-null value, various JVM related diagnostics will be turned on such as verbose garbage collection tracing.

CONTAINER_CORE_LIMIT

When set to a non-null value, the number of parallel garbage collection threads will be set to this value.

AUTO_DEPLOY_EXPLODED

When set to true, Wildfly will automatically deploy exploded war content. When unset or set to false, a .dodeploy file must be touched to trigger deployment of exploded war content.

MYSQL_DATABASE

If set, WildFly will attempt to define a MySQL datasource based on the assumption you have an OpenShift service named mysql defined. It will attempt to reference the following environment variables which are automatically defined if the mysql service exists: MYSQL_SERVICE_PORT, MYSQL_SERVICE_HOST, MYSQL_PASSWORD, and MYSQL_USER.

POSTGRESQL_DATABASE

If set, WildFly will attempt to define a PostgreSQL datasource based on the assumption you have an OpenShift service named postgresql defined. It will attempt to reference the following environment variables which are automatically defined if the postgresql service exists: POSTGRESQL_SERVICE_PORT, POSTGRESQL_SERVICE_HOST, POSTGRESQL_PASSWORD, and POSTGRESQL_USER.

Accessing Logs

Access logs are streamed to standard output and as such they can be viewed using the oc logs command. Error logs are stored in the /tmp/error_log file, which can be viewed using the oc rsh command to access the container.

Hot Deploying

Hot deployment allows you to quickly make and deploy changes to your application without having to generate a new S2I build. Hot deployment for war files is already enabled, but to enable hot deployment of exploded war content, you must set the AUTO_DEPLOY_EXPLODED environment variable to true. For example, see the oc new-app command. You can use the oc set env command to update environment variables of existing objects.

Deployed content is stored under /wildfly/standalone/deployments.

You should only use this option while developing or debugging; it is not recommended to turn this on in your production environment.