此内容没有您所选择的语言版本。

Chapter 4. Reference


4.1. Source-to-Image (S2I)

The Red Hat JBoss Web Server for OpenShift image includes S2I scripts and Maven.

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
Copy to Clipboard Toggle word wrap

For an existing build configuration:

  1. Identify the build configuration which requires the MAVEN_MIRROR_URL variable:

    $ oc get bc -o name
    
    buildconfig/jws
    Copy to Clipboard Toggle word wrap
  2. Add the MAVEN_MIRROR_URL environment variable to buildconfig/jws:

    $ oc env bc/jws MAVEN_MIRROR_URL="http://10.0.0.1:8080/repository/internal/"
    
    buildconfig "jws" updated
    Copy to Clipboard Toggle word wrap
  3. Verify the build configuration has updated:

    $ oc env bc/jws --list
    
    # buildconfigs jws
    MAVEN_MIRROR_URL=http://10.0.0.1:8080/repository/internal/
    Copy to Clipboard Toggle word wrap
  4. Schedule a new build of the application using oc start-build
Note

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.

run
runs Catalina (Tomcat)
assemble
uses Maven to build the source, create package (.war) and move it to the $JWS_HOME/webapps directory.

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:

Expand

Variable Name

Description

Example Value

:leveloffset: +3

ARTIFACT_DIR

.war, .ear, and .jar files from this directory will be copied into the deployments directory.

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 HTTP_PROXY_PASSWORD, use credentials for HTTP proxy.

myusername

HTTP_PROXY_PASSWORD

If supplied with HTTP_PROXY_USERNAME, use credentials for HTTP proxy.

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

You can define the following environment variables to insert the valve component into the request processing pipeline for the associated Catalina container.

Expand
Variable NameDescriptionExample ValueDefault 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>
Copy to Clipboard Toggle word wrap

Access logs are stored in /opt/webserver/logs/.

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat