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-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
$ oc get bc -o name buildconfig/jws
MAVEN_MIRROR_URLenvironment variable to
$ oc env bc/jws MAVEN_MIRROR_URL="http://10.0.0.1:8080/repository/internal/" buildconfig "jws" updated
Verify 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
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
- runs Catalina (Tomcat)
uses Maven to build the source, create package (
.war) and move it to the
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|
| || |
Hostname or IP address of a HTTP proxy for Maven to use.
TCP Port of a HTTP proxy for Maven to use.
If supplied with
If supplied with
If supplied, a configured HTTP proxy will ignore these hosts (a comma-separated lists of hosts, IP addresses or domains).
Overrides the arguments supplied to Maven during build.
-e -Popenshift -DskipTests -Dcom.redhat.xpaas.repo.redhatga package
Appends user arguments supplied to Maven during build.
URL of a Maven mirror/repository manager to configure.
Optionally clear the local Maven repository after the build.
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 the Access Log Valve to log access messages to the standard output channel.
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/.