Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Develop and test a Quarkus client on Red Hat CodeReady Containers with Red Hat Data Grid 8.0

June 19, 2020
Durgesh Anaokar
Related topics:
JavaArtificial intelligenceKubernetesQuarkus

Share:

    This article is about my experience installing Red Hat Data Grid (RHDG) on Red Hat CodeReady Containers (CRC) so that I could set up a local environment to develop and test a Quarkus Infinispan client. I started by installing CodeReady Containers and then installed Red Hat Data Grid. I am also on a learning path for Quarkus, so my last step was to integrate the Quarkus Infinispan client into my new development environment.

    Initially, I tried connecting the Quarkus client to my locally running instance of Data Grid. Later, I decided I wanted to create an environment where I could test and debug Data Grid on Red Hat OpenShift 4. I tried installing Data Grid on OpenShift 4 in a shared environment, but maintaining that environment was challenging. Through trial-and-error, I found that it was better to install Red Hat Data Grid on CodeReady Containers and use that for my local development and testing environment.

    In this quick tutorial, I guide you through setting up a local environment to develop and test a Quarkus client—in this case, Quarkus Infinispan. The process consists of three steps:

    1. Install and run CodeReady Containers.
    2. Install Data Grid on CodeReady Containers.
    3. Integrate the Quarkus Infinispan client into the new development environment.

    Step 1: Install and run CodeReady Containers

    To start, download the current version of CodeReady Containers. If you need installation instructions, see this guide from the CodeReady Containers development team.

    After I installed CodeReady Containers, I ran the following command to set it up and start it in the same sequence:

    # crc setup
    # crc start
    

    Starting your CRC installation automatically starts OpenShift. You can check the logs at https://api.crc.testing:6443 to confirm that OpenShift is running. In the logs, you will also see the following login details:

    [INFO]"To access the cluster, first set up your environment by following 'crc oc-env' instructions"
    [INFO]"Then you can access it by running 'oc login -u developer -p developer https://api.crc.testing:6443'"
    [INFO]"To login as an admin, run 'oc login -u kubeadmin -p 8rynV-SeYLc-h8Ij7-YPYcz https://api.crc.testing:6443'"
    

    That's it for the first step.

    Step 2: Install Red Hat Data Grid on CodeReady Containers

    Next, you want to install the Data Grid Operator on Red Hat OpenShift Container Platform (OCP). You can use either the command-line interface (CLI) or the OCP user interface (UI). I chose to use the UI for my installation. Here are the installation steps:

    1. Log in to the OCP console, as shown in Figure 1.
      A screenshot of the login dialog for OCP.
      Figure 1. Log in to the OpenShift Container Platform console.
    2. Create a project to install the Data Grid Operator, as shown in Figure 2.
      A screenshot of the OCP project dialog.
      Figure 2. Create a project to install the Data Grid Operator.
    3. Create an instance of the Data Grid Operator. Doing this also creates the Data Grid pod, as shown in Figure 3.
      A screenshot of the dialog to create an instance of the Data Grid Operator.
      Figure 3. Create an instance of the Data Grid Operator
    4. Check the running pods on OCP:
      $ oc get pods
      NAME                                    READY   STATUS      RESTARTS   AGE
      example-infinispan-0                    1/1     Running     0          6d4h
      infinispan-operator-77cd666d7d-xjqcj    1/1     Running     0          6d4h
      

    Gather information for your next installation

    After you confirm that Data Grid is installed, take note of the service IP for the Data Grid service. You will need this information when you install the Quarkus Infinispan client.

    $ oc get svc
    NAME                           TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)     AGE
    example-infinispan             ClusterIP   172.30.51.239   <none>        11222/TCP   6d4h
    

    Next, check the user ID for Data Grid and the clustered-openshift.xml:

    $ oc rsh example-infinispan-0
    sh-4.4$ cat /opt/infinispan/server/conf/users.properties
    #$REALM_NAME=default$
    #Tue Jun 09 03:58:58 GMT 2020
    developer=RSRKP8snxVdCbQP3
    operator=brw2JVxLQw1gsF4M
    

    Finally, check the configuration files details for your sasl-mechanism:

    $ oc rsh example-infinispan-0
    sh-4.4$ cat /opt/infinispan/server/conf/infinispan.xml
    

    Figure 4 shows the correct output:

    A screenshot of the output.
    Figure 4. The output from a successful Red Hat Data Grid installation.

    Install and run the Quarkus Infinispan client

    Finally, you can install and run the Quarkus Infinispan client.

    1. Download the client from Quarkus.io, as shown in Figure 5.
      A screenshot of the download page on Quarkus.io.
      Figure 5. Download the Quarkus Infinispan client from Quarkus.io.
    2. Once you have Quarkus Infinispan, extract the client code. Test the code against your local Data Grid instance to ensure that it is working.
    3. Assuming the code works, add the following values to the Infinispan client's application.properties file (see the pod/service directory for these values):
      # The IP should be CLUSTER-IP shown by oc get svc for RHDG deployment
      Quarkus.infinispan-client.server-list=172.30.51.239:11222
      
      #The following would be the authentication details for the RHDG installed
      Quarkus.infinispan-client.auth-username=developer
      Quarkus.infinispan-client.auth-password=RSRKP8snxVdCbQP3
      Quarkus.infinispan-client.use-auth=true
      Quarkus.infinispan-client.sasl-mechanism=DIGEST-MD5 #you can choose the sasl machenism and set it here
      Quarkus.kubernetes-client.trust-certs=true
      Quarkus.infinispan-client.client-intelligence=BASIC
      
      #The following properties are required to push the build to OCP
      Quarkus.openshift.expose=true
      Quarkus.kubernetes.deployment-target=openshift
      Quarkus.s2i.base-jvm-image=registry.access.redhat.com/openjdk/openjdk-11-rhel7
      
    4. After you have updated the application.properties file, run this command at the project's base directory:
      ./mvnw clean package -DQuarkus.kubernetes.deploy=true
      

      The application will be deployed to CodeReady Containers, and you should see the following logs:

      [INFO] [io.Quarkus.kubernetes.deployment.KubernetesDeployer] Deploying to openshift server: https://api.crc.testing:6443/ in namespace: testrhdg.
      [INFO] [io.Quarkus.kubernetes.deployment.KubernetesDeployer] Applied: ServiceAccount infinispan-client-quickstart.
      [INFO] [io.Quarkus.kubernetes.deployment.KubernetesDeployer] Applied: Service infinispan-client-quickstart.
      [INFO] [io.Quarkus.kubernetes.deployment.KubernetesDeployer] Applied: ImageStream infinispan-client-quickstart.
      [INFO] [io.Quarkus.kubernetes.deployment.KubernetesDeployer] Applied: ImageStream openjdk-11-rhel7.
      [INFO] [io.Quarkus.kubernetes.deployment.KubernetesDeployer] Applied: BuildConfig infinispan-client-quickstart.
      [INFO] [io.Quarkus.kubernetes.deployment.KubernetesDeployer] Applied: DeploymentConfig infinispan-client-quickstart.
      [INFO] [io.Quarkus.kubernetes.deployment.KubernetesDeployer] Applied: Route infinispan-client-quickstart.
      [INFO] [io.Quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 120321ms
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  02:06 min
      [INFO] Finished at: 2020-06-10T07:04:53+05:30
      [INFO] ------------------------------------------------------------------------
      

    Check your installation

    You can run additional checks to ensure that the Infinispan client is running in your development environment. First, check the new pods that were created with the Quarkus Infinispan build:

    $ oc get pods
    NAME                                    READY   STATUS      RESTARTS   AGE
    example-infinispan-0                    1/1     Running     0          6d22h
    infinispan-client-quickstart-1-build    0/1     Completed   0          2m50s
    infinispan-client-quickstart-1-deploy   0/1     Completed   0          72s
    infinispan-client-quickstart-1-hlwg6    1/1     Running     0          66s
    infinispan-operator-77cd666d7d-xjqcj    1/1     Running     0          6d22h
    

    Second, check the route for the newly deployed service and access it:

    $ oc get routes
    NAME                           HOST/PORT                                                PATH   SERVICES                       PORT    TERMINATION   WILDCARD
    infinispan-client-quickstart   infinispan-client-quickstart-testrhdg.apps-crc.testing   /      infinispan-client-quickstart   8081                  None
    

    Now you can access the client in any web browser at http://infinispan-client-quickstart-testrhdg.apps-crc.testing/infinispan, or on the command line, and play with it. As an example, you could add more interfaces to the client code, which would allow you to perform different operations with Red Hat Data Grid.

    Conclusion

    In this article, I showed you what I did to create a client for Infinispan with the help of Quarkus. I also showed you how to run the client on OpenShift 4.x for an installed Red Hat Data Grid 8.0 instance. There might be a more sophisticated way to implement the same solution or find values from the OpenShift cluster. I hope sharing my experience will be helpful to others.

    Download the source code for these examples from my Infinispan Client Quickstart on GitHub.

    Last updated: June 25, 2020

    Recent Posts

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    • How to integrate vLLM inference into your macOS and iOS apps

    • How Insights events enhance system life cycle management

    • Meet the Red Hat Node.js team at PowerUP 2025

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue