JBoss EAP 7 Galleon provisioning via provisioning.xml or pom.xml in eap-maven-plugin

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.x
  • Red hat OpenShift Container Platform (OCP)
    • 4.x

Issue

  • How to use provisioning.xml on galleon process for JBoss EAP S2I?
  • How to use eap-maven-plugin deployment on galleon process for JBoss EAP S2I?

Resolution

As explained on the solution JBoss EAP 7 thin image, the EAP image is a thin client and the jars can be set during deployment via Galleon, either environment variables (process described on JBoss EAP S2I build template options ) or via provisioning.xml file or via a pom.xml, which contains eap-maven-plugin.
All those options can be called via OCP's buildconfig: Dockefile with Galleon environment variables, provisioning.xml build, or pom.xml with eap-maven-plugin.

Options pom.xml vs provioning.xml:

Provisioning.xml

  • Provisioning.xml can be set in the pom.xml: User can specify it in the galleon/provisioning.xml file inside the project source via provisioning-file option.
  • Provisioning.xml can be set in the GALLEON build via the environment variable set GALLEON_USE_LOCAL_FILE=true

pom.xml

  • Pom.xml will be located in the source repository to be used for the build.

settings.xml

  • settings.xml used in EAP 7/8 for advanced manipulation on the Maven settings.

Below there will be two full examples:

Eap-maven-plugin in pom.xml

Below is an example with eap-maven-plugin:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.jboss.eap.demo</groupId>
    <artifactId>Example</artifactId>
    <packaging>war</packaging>
    <version>1.0</version>
    <name>Galleon POM usage </name>

    <properties>
        <!-- This env variable is defined in the EAP S2I builder image -->
        <version.eap.plugin>${env.PROVISIONING_MAVEN_PLUGIN_VERSION}</version.eap.plugin>
    </properties>

    <dependencies>
        <dependency>
            <groupId>jakarta.platform</groupId>
            <artifactId>jakarta.jakartaee-api</artifactId>
            <version>${jakarta.jakartaee-api.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <repositories>
        <!-- keep this repository the first -->
        <repository>
            <id>jboss-public-maven-repository</id>
            <name>JBoss Public Maven Repository</name>
            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </snapshots>
            <layout>default</layout>
        </repository>
        <repository>
            <id>redhat-ga-maven-repository</id>
            <name>Red Hat GA Maven Repository</name>
            <url>https://maven.repository.redhat.com/ga/</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </snapshots>
            <layout>default</layout>
        </repository>
    </repositories>
    <pluginRepositories>
        <!-- keep this repository the first -->
        <pluginRepository>
            <id>jboss-public-maven-repository</id>
            <name>JBoss Public Maven Repository</name>
            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>redhat-ga-maven-repository</id>
            <name>Red Hat GA Maven Repository</name>
            <url>https://maven.repository.redhat.com/ga/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>${version.maven.war.plugin}</version>
            </plugin>
            <plugin>
                <groupId>org.jboss.eap.plugins</groupId>
                <artifactId>eap-maven-plugin</artifactId>
                <version>${version.eap.plugin}</version>
                <configuration>
                    <channels>
                        <channel>
                            <manifest>
                                <groupId>org.jboss.eap.channels</groupId>
                                <artifactId>eap-8.0</artifactId>
                            </manifest>
                        </channel>
                    </channels>
                    <feature-packs>
                        <feature-pack>
                            <location>org.jboss.eap:wildfly-ee-galleon-pack</location>
                        </feature-pack>
                        <feature-pack>
                            <location>org.jboss.eap.cloud:eap-cloud-galleon-pack</location>
                        </feature-pack>
                    </feature-packs>
                    <layers>
                        <layer>jaxrs-server</layer>
                    </layers>
                    <galleon-options>
                        <jboss-fork-embedded>true</jboss-fork-embedded>
                    </galleon-options>
                    <runtime-name>ROOT.war</runtime-name>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Another example can be found Content from github.com is not included.here.

Provisioning.xml

Below some example with provisioning.xml file:

Examples:

Example 1 - feature-pack:

The following provisioning.xml file example with feature-pack:

<?xml version="1.0" ?>
<installation xmlns="urn:jboss:galleon:provisioning:3.0">
    <feature-pack location="eap-s2i@maven(org.jboss.universe:s2i-universe)">
        <default-configs inherit="false"/>
        <packages inherit="false"/>
    </feature-pack>
    <config model="standalone" name="standalone.xml">
        <layers>
            <include name="jaxrs-server"/>
        </layers>
    </config>
    <options>
        <option name="optional-packages" value="passive+"/>
    </options>
</installation>

Example 2 - feature-pack/layers:

The following provisioning.xml file example with feature-pack/layers:

<?xml version="1.0" ?>        
          <installation xmlns="urn:jboss:galleon:provisioning:3.0">
              <feature-pack location="eap-s2i@maven(org.jboss.universe:s2i-universe)">
                  <default-configs inherit="false"/>
                  <packages inherit="false"/>
              </feature-pack>
              <config model="standalone" name="standalone.xml">
                  <layers>
                      <include name="cloud-server"/>
                      <include name="sso"/> <!-- sso decorator layer -->
                      <include name="postgresql-datasource"/>
                  </layers>
              </config>
              <options>
                  <option name="optional-packages" value="passive+"/>
              </options>
          </installation>

Example 3 - Setting parameters via feature spec - not supported:

Example changing parameters via param name:

    <?xml version="1.0" ?>
    <layer-spec xmlns="urn:jboss:galleon:layer-spec:1.0" name="postgresql-datasource">
        <dependencies>
            <layer name="postgresql-driver"/>
        </dependencies>
        <feature spec="subsystem.datasources.data-source">
            <param name="use-ccm" value="true"/>
            <param name="data-source" value="PostgreSQLDS"/>

Example 4 - Setting properties on undertow subsystem:

The Galleon feature syntax below possible however not supported - meaning Red Hat support team cannot support:

...
<config model="standalone" name="standalone.xml">
<layers>
<include name="cloud-server"/>
<include name="sso"/> <!-- sso decorator layer -->
<include name="postgresql-datasource"/>
</layers>
<feature spec="subsystem.undertow">
  <feature spec="subsystem.undertow.server">
    <param name="server" value="default-server" />
    <feature spec="subsystem.undertow.server.http-listener">
      <param name="http-listener" value="default"/>
      <param name="proxy-address-forwarding" value="true"/>
    </feature>
   </feature>
 </feature>               
</config>
...

The examples above with param name (via Galleon syntax for set an attribute) is similar to what one would do on the JBoss CLI - and internally, in fact, Galleon generates a CLI script that is applied during provisioning.

Deployment

The deployment can be done as below, where the provisioning.xml is inside galleon/provisioning.xml:

oc new-app --template=eap74-basic-s2i  \
  -p SOURCE_REPOSITORY_URL=https://github.com/jboss-container-images/jboss-eap-modules.git \
  -p SOURCE_REPOSITORY_REF=master \
  -p CONTEXT_DIR=tests/examples/test-app-jaxrs

Root Cause

The S2I via Galleon can be done via environment variables in Galleon build or via pom.xml (with or without provisioning.xml file).
The following options can be done:

  • The pom.xml can define only the sources.
  • The pom.xml can define only the sources but also the Galleon settings, given the EAP Maven plugin is used.
  • The pom.xml can defined a provioning.xml file via provisioning-file option, given the EAP Maven plugin is used.
  • In case Galleon Dockerfile build, so then provioning.xml can be set as provisioning-file via GALLEON_USE_LOCAL_FILE.

Whereas the deployment of EAP 7 can be done via EAP Operator or template (example above), Healm charts is tech preview for EAP 7.
Galleon usage is not unrestricted and has limitations for instance:

  • feature spec | param name usage is not support (see above).
  • The EAP S2I feature-pack only contains certain modules JBoss EAP modules, .e.g no Galleon feature-spec for Keycloak subsystems, so feature spec cannot be used.

The Maven EAP plugin can work together with other plugins, such as assembly or dependency plugin, to build the final artifact, for artifact injection see the solution Importing artifacts inside EAP during Galleon provisioning.

Diagnostic Steps

IssueSolution
Deploy applications with EAP 7 OperatorHow to deploy an application in JBoss EAP 7 in OCP 4
Custom module in EAP 7 in OCPCreating a custom module in EAP 7's OCP image
Custom configuration in EAP 7 in OCPWhat are the options to use a custom runtime EAP configurations
EAP 7 trimming using GalleonAfter installing EAP openshift trimmed with Galleon cannot find openshift-launch.sh
EAP 7 Operator service creationJBoss EAP 7 Operator creates LoadBalancer service
Import artifacts inside EAP provisioningImporting artifacts inside EAP during Galleon provisioning
EAP 7 XP bootable jarEAP 7 XP bootable jar in OCP 4
Why EAP image doesn't have jars?JBoss EAP 7 thin client
About Oracle DBGetting error installing Oracle Driver JDBC on JBoss EAP for OpenShift using Galleon
Authentication via settings.xml in S2IAuthentication required on Maven during deploy a JBoss EAP Source-to-Image (S2I) Application to OpenShift environment
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.