Chapter 8. Build and run microservices applications on the OpenShift image for JBoss EAP XP


You can build and run your microservices applications on the OpenShift image for JBoss EAP XP.

Note

JBoss EAP XP is supported only on OpenShift 4 and later versions.

Use the following workflow to build and run a microservices application on the OpenShift image for JBoss EAP XP by using the source-to-image (S2I) process.

Note

Default cloud-default-mp-config layer provide a standalone configuration file, which is based on the standalone-microprofile-ha.xml file. For more information about the server configuration files included in JBoss EAP XP, see the Standalone server configuration files section.

This workflow uses the microprofile-config quickstart as an example. The quickstart provides a small, specific working example that can be used as a reference for your own project. See the microprofile-config quickstart that ships with JBoss EAP XP 5.0.0 for more information.

Additional resources

8.1. Preparing OpenShift for application deployment

Prepare OpenShift for application deployment.

Prerequisites

You have installed an operational OpenShift instance. For more information, see the Installing and Configuring OpenShift Container Platform Clusters book on Red Hat Customer Portal.

Procedure

  1. Log in to your OpenShift instance using the oc login command.
  2. Create a new project in OpenShift.

    A project allows a group of users to organize and manage content separately from other groups. You can create a project in OpenShift using the following command.

    Copy to Clipboard Toggle word wrap
    $ oc new-project PROJECT_NAME

    For example, for the microprofile-config quickstart, create a new project named eap-demo using the following command.

    Copy to Clipboard Toggle word wrap
    $ oc new-project eap-demo

8.2. Building and Deploying JBoss EAP XP Application Images using S2I

Follow the source-to-image (S2I) workflow to build reproducible container images for a JBoss EAP XP application. These generated container images include the application deployment and ready-to-run JBoss EAP XP servers.

The S2I workflow takes source code from a Git repository and injects it into a container that’s based on the language and framework you want to use. After the S2I workflow is completed, the src code is compiled, the application is packaged and is deployed to the JBoss EAP XP server.

Prerequisites

  • You have an active Red Hat customer account.
  • You have a Registry Service Account. Follow the instructions on the Red Hat Customer Portal to create an authentication token using a registry service account.
  • You have downloaded the OpenShift secret YAML file, which you can use to pull images from Red Hat Ecosystem Catalog. For more information, see OpenShift Secret.
  • You used the oc login command to log in to OpenShift.
  • You have installed Helm. For more information, see Installing Helm.
  • You have installed the repository for the JBoss EAP Helm charts by entering this command in the management CLI:

    Copy to Clipboard Toggle word wrap
    $ helm repo add jboss-eap https://jbossas.github.io/eap-charts/

Procedure

  1. Create a file named helm.yaml using the following YAML content:

    Copy to Clipboard Toggle word wrap
    build:
      uri: https://github.com/jboss-developer/jboss-eap-quickstarts.git
      ref: XP_5.0.0.GA
      contextDir: microprofile-config
      mode: s2i
    deploy:
      replicas: 1
  2. Use the following command to deploy your JBoss EAP XP application on Openshift.

    Copy to Clipboard Toggle word wrap
    $ helm install microprofile-config -f helm.yaml jboss-eap/eap-xp5
Note

This procedure is very similar to Building application images using source-to-image in OpenShift. For more information about that procedure see Using JBoss EAP on OpenShift Container Platform.

Verification

  • Access the application using curl.

    Copy to Clipboard Toggle word wrap
    $ curl https://$(oc get route microprofile-config --template='{{ .spec.host }}')/config/value

    You get the output MyPropertyFileConfigValue confirming that the application is deployed.

8.3. Completing post-deployment tasks for JBoss EAP XP source-to-image (S2I) application

Depending on your application, you might need to complete some tasks after your OpenShift application has been built and deployed.

Examples of post-deployment tasks include the following:

  • Exposing a service so that the application is viewable from outside of OpenShift.
  • Scaling your application to a specific number of replicas.

Procedure

  1. Get the service name of your application using the following command.

    Copy to Clipboard Toggle word wrap
    $ oc get service
  2. Optional: Expose the main service as a route so you can access your application from outside of OpenShift. For example, for the microprofile-config quickstart, use the following command to expose the required service and port.

    Copy to Clipboard Toggle word wrap
    $ oc expose service/microprofile-config --port=8080
  3. Get the URL of the route.

    Copy to Clipboard Toggle word wrap
    $ oc get route
  4. Access the application in your web browser using the URL. The URL is the value of the HOST/PORT field from previous command’s output.

    Note

    For JBoss EAP XP 5.0.0 GA distribution, the Microprofile Config quickstart does not reply to HTTPS GET requests to the application’s root context. This enhancement is only available in the {JBossXPShortName101} GA distribution.

    For example, to interact with the Microprofile Config application, the URL might be http://HOST_PORT_Value/config/value in your browser.

    If your application does not use the JBoss EAP root context, append the context of the application to the URL. For example, for the microprofile-config quickstart, the URL might be http://HOST_PORT_VALUE/microprofile-config/.

  5. Optionally, you can scale up the application instance by running the following command. This command increases the number of replicas to 3.

    Copy to Clipboard Toggle word wrap
    $ oc scale deploymentconfig DEPLOYMENTCONFIG_NAME --replicas=3

    For example, for the microprofile-config quickstart, use the following command to scale up the application.

    Copy to Clipboard Toggle word wrap
    $ oc scale deployment/microprofile-config --replicas=3

Additional Resources

For more information about JBoss EAP XP Quickstarts, see the Use the Quickstarts section in the Using MicroProfile in JBoss EAP guide.

Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat, Inc.