Chapter 4. Reference
4.1. Source-to-Image (S2I)
The Red Hat JBoss Web Server for OpenShift image includes S2I scripts and Maven.
4.1.1. Using maven artifact repository mirrors with JWS for OpenShift
A Maven repository holds build artifacts and dependencies, such as the project jars, library jars, plugins or any other project specific artifacts. It also defines locations to download artifacts from while performing the S2I build. Along with using the Maven Central Repository, some organizations also deploy a local custom repository (mirror).
Benefits of using a local mirror are:
- Availability of a synchronized mirror, which is geographically closer and faster.
- Greater control over the repository content.
- Possibility to share artifacts across different teams (developers, CI), without the need to rely on public servers and repositories.
- Improved build times.
A Maven repository manager can serve as local cache to a mirror. Assuming that the repository manager is already deployed and reachable externally at http://10.0.0.1:8080/repository/internal/, the S2I build can use this repository. To use an internal Maven repository, add the MAVEN_MIRROR_URL environment variable to the build configuration of the application.
For a new build configuration, use the --build-env option with oc new-app or oc new-build:
$ oc new-app \ https://github.com/jboss-openshift/openshift-quickstarts.git#master \ --image-stream=jboss-webserver31-tomcat8-openshift \ --context-dir='tomcat-websocket-chat' \ --build-env MAVEN_MIRROR_URL=http://10.0.0.1:8080/repository/internal/ \ --name=jws-wsch-app
For an existing build configuration:
Identify the build configuration which requires the
MAVEN_MIRROR_URLvariable:$ oc get bc -o name buildconfig/jwsAdd the
MAVEN_MIRROR_URLenvironment variable tobuildconfig/jws:$ oc env bc/jws MAVEN_MIRROR_URL="http://10.0.0.1:8080/repository/internal/" buildconfig "jws" updatedVerify the build configuration has updated:
$ oc env bc/jws --list # buildconfigs jws MAVEN_MIRROR_URL=http://10.0.0.1:8080/repository/internal/-
Schedule a new build of the application using
oc start-build
During application build, Maven dependencies are download from the repository manager, instead of the default public repositories. Once the build has finished, the mirror contains all the dependencies retrieved and used during the build.
4.1.2. Scripts included on the Red Hat JBoss Web Server for OpenShift image
run- runs Catalina (Tomcat)
assemble-
uses Maven to build the source, create package (
.war) and move it to the$JWS_HOME/webappsdirectory.
4.1.3. JWS for OpenShift compatible environment variables
The build configuration can be modified by including environment variables to the Source-to-Image build command (see Section 4.1.1, “Using maven artifact repository mirrors with JWS for OpenShift”). The valid environment variables for the Red Hat JBoss Web Server for OpenShift images are:
| Variable Name | Description | Example Value :leveloffset: +3 |
|---|---|---|
| ARTIFACT_DIR |
| target |
| HTTP_PROXY_HOST | Hostname or IP address of a HTTP proxy for Maven to use. | 192.168.1.1 |
| HTTP_PROXY_PORT | TCP Port of a HTTP proxy for Maven to use. | 8080 |
| HTTP_PROXY_USERNAME |
If supplied with | myusername |
| HTTP_PROXY_PASSWORD |
If supplied with | mypassword |
| HTTP_PROXY_NONPROXYHOSTS | If supplied, a configured HTTP proxy will ignore these hosts (a comma-separated lists of hosts, IP addresses or domains). | *.example.net,some.example.org |
| MAVEN_ARGS | Overrides the arguments supplied to Maven during build. | -e -Popenshift -DskipTests -Dcom.redhat.xpaas.repo.redhatga package |
| MAVEN_ARGS_APPEND | Appends user arguments supplied to Maven during build. | -Dfoo=bar |
| MAVEN_MIRROR_URL | URL of a Maven mirror/repository manager to configure. | http://10.0.0.1:8080/repository/internal/ |
| MAVEN_CLEAR_REPO | Optionally clear the local Maven repository after the build. | true
:leveloffset: 3 |
4.2. Valves on JWS for OpenShift
4.2.1. JWS for OpenShift compatible environmental variables (valve component)
You can define the following environment variables to insert the valve component into the request processing pipeline for the associated Catalina container.
| Variable Name | Description | Example Value | Default Value |
|---|---|---|---|
| ENABLE_ACCESS_LOG | Enable the Access Log Valve to log access messages to the standard output channel. | true | false |
4.3. Checking Logs
To view the OpenShift logs or the logs provided by a running container’s console:
$ oc logs -f <pod_name> <container_name>
Access logs are stored in /opt/webserver/logs/.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.