Creating a custom module in EAP 7's OCP image

Solution Verified - Updated

Environment

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

Issue

  • How to create a custom module in EAP 7 in OCP image?
  • What are the options to create a custom module in EAP 7 in OCP image?

Resolution

The following options are available:

  1. When not using Bootable JAR to package the application:

    Add a folder named modules on the application sources. All the files under the modules directory are copied to the EAP_HOME/modules/ directory in the JBoss EAP for the OpenShift image during the S2I build process. See eap_s2i_process documentation.

  2. If using Bootable JAR to package the application (notice Bootable JAR is currently only available for EAP XP):

    One can configure the JBoss EAP JAR Maven plug-in that builds the Bootable JAR to add custom content to the image by using the extra-server-content-dirs setting. We have some examples about it upstream, see for example Content from github.com is not included.here.
    This setting copies the content of the directory "extra-content" to the server packaged inside of the Bootable JAR, one could do the same by distributing the custom module with the application source code and making it later available inside the Bootable JAR.

  3. For both package types:

    One can build a custom Galleon pack that includes the modules as a Galleon layer. This is an advanced method that can cover complex use cases. EAP uses this method to supply database drivers and configurations, see here Content from github.com is not included.eap-datasources-galleon-pack.
    This EAP Datasources galleon pack is a custom Galleon pack that contains drivers and configurations for common databases and makes them available as Galleon layers.
    The documentation about how to build a custom Galleon pack is available here

Summarized in the following table:

Method's nameDescriptionObservationsExample
S2I methodAdd a folder named modules on the application sources ; all the files under the modules directory are copied to the EAP_HOME/modules/ directory in the JBoss EAP for the OpenShift image during the S2I build processWhen not using Bootable JAR to package the applicationExample here
Bootable JAR via Maven for EAP XPConfigure the JBoss EAP JAR Maven plug-in that builds the Bootable JAR to add custom content to the image by using the extra-server-content-dirs settingWhen using Bootable JAR to package the applicationExample Content from github.com is not included.here
Custom Galleon packOne can build a custom Galleon pack that includes the modules you want on a Galleon layerused for both package types: S2I or Bootable JarExample here

Root Cause

Notice for future EAP versions the use of templates will be replaced by deploying applications using Helm Charts. EAP Helm charts are still under tech preview, you can find them Content from jbossas.github.io is not included.here.

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
Why EAP image doesn't have jars?JBoss EAP 7 thin client
Components

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.