Creating a custom module in EAP 7's OCP image
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:
-
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/ directoryin the JBoss EAP for the OpenShift image during the S2I build process. See eap_s2i_process documentation. -
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-dirssetting. 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. -
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 name | Description | Observations | Example |
|---|---|---|---|
| S2I method | 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 | When not using Bootable JAR to package the application | Example here |
| Bootable JAR via Maven for EAP XP | 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 | When using Bootable JAR to package the application | Example Content from github.com is not included.here |
| Custom Galleon pack | One can build a custom Galleon pack that includes the modules you want on a Galleon layer | used for both package types: S2I or Bootable Jar | Example 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
| Issue | Solution |
|---|---|
| Deploy applications with EAP 7 Operator | How to deploy an application in JBoss EAP 7 in OCP 4 |
| Custom module in EAP 7 in OCP | Creating a custom module in EAP 7's OCP image |
| Custom configuration in EAP 7 in OCP | What are the options to use a custom runtime EAP configurations |
| EAP 7 trimming using Galleon | After installing EAP openshift trimmed with Galleon cannot find openshift-launch.sh |
| EAP 7 Operator service creation | JBoss EAP 7 Operator creates LoadBalancer service |
| Why EAP image doesn't have jars? | JBoss EAP 7 thin client |
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.