How to deploy Driver JDBC Postgresql on JBoss EAP for OpenShift using Galleon

Solution Verified - Updated

Environment

  • Red Hat OpenShift Container Platform
    • 4.x
  • Red Hat Enterprise Application Platform (EAP)
    • 8.x
    • 7.4
    • jboss-eap74-openjdk11-openshift:7.4.0 or later
  • Galleon layers
    • feature-pack 1.0.0.Final

Issue

  • How to configure Driver JDBC on JBoss EAP for OpenShift using Galleon?
  • How to use the S2I process to provision a JBoss EAP server on OpenShift with the Postgresql Driver installed through Galleon?

Resolution

To configure Driver JDBC Postgresql during build image, it is necessary to add some components:

  • GALLEON_PROVISION_LAYERS

    • Environment variable to provide a custom server with reduced resources and only load what is needed to support the features to be used in JBoss EAP
      • jaxrs-server,postgresql-driver
  • GALLEON_PROVISION_FEATURE_PACKS

    • Build environment variable for provisioning a JBoss EAP server with a custom Galleon feature pack on OpenShift.
      • org.jboss.eap:eap-datasources-galleon-pack:7.4.0.GA-redhat-00003
  • POSTGRESQL_DRIVER_VERSION

    • Build environment variable to specify the postgresql driver version to retrieve the driver artifact from the remote Maven repository when provision the Postgresql driver for server.
      • 42.2.19

Note: To more information about Provision a custom JBoss EAP for OpenShift, it is necessary to consult the official Red Hat documentation.

Run the command bellow:


oc new-app  --template=eap74-basic-s2i \
-p IMAGE_STREAM_NAMESPACE=openshift \
-p EAP_IMAGE_NAME=jboss-eap74-openjdk11-openshift:7.4.0 \
-p EAP_RUNTIME_IMAGE_NAME=jboss-eap74-openjdk11-runtime-openshift:7.4.0 \
-p SOURCE_REPOSITORY_URL=https://github.com/jboss-developer/jboss-eap-quickstarts.git \
-p SOURCE_REPOSITORY_REF=7.4.x \
-p GALLEON_PROVISION_LAYERS=jaxrs-server,postgresql-driver \
-p CONTEXT_DIR=helloworld-html5 \
--build-env POSTGRESQL_DRIVER_VERSION=42.2.19 \
--build-env GALLEON_PROVISION_FEATURE_PACKS="org.jboss.eap:eap-datasources-galleon-pack:7.4.0.GA-redhat-00003"

After running the deploy, it is possible to see information about the driver loading in the pod logs:


21:33:55,018 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 24) WFLYJCA0005: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 42.2)

21:33:55,019 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = postgresql

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.