Search

Chapter 9. Deploying JBoss Data Grid for OpenShift with Custom Configuration Files

download PDF

You can use the OpenShift ConfigMap API to create a deployment that uses custom configuration instead of using the source-to-image (S2I) build process.

Note
  • Changes to the configuration via ConfigMap do not cause pods to redeploy automatically. You must manually redeploy pods if you update standalone.xml.
  • JBoss Data Grid for OpenShift deployments that you create with custom configuration files do not support shared persistent volumes that you configure with the DATAGRID_SPLIT environment variable.

9.1. Setting Up the Configuration Files and Custom Template

Create a ConfigMap that contains your configuration files and mount it to a specific directory as follows:

  1. Mount your configuration files, the ConfigMap content, in the following directory:

    /opt/datagrid/standalone/configuration/user

    At a minimum, this directory must contain standalone.xml to configure JBoss Data Grid. This directory can also contain logging.properties, application-role.properties, and other properties files that are available with the JBoss Data Grid distribution.

    Note the following requirements for your custom configuration:

    • You must explicitly define all cache and endpoint configuration in standalone.xml. You cannot use environment variables to configure caches or endpoints after you create a deployment.
    • Your cache container must be named clustered so that the default ReadinessProbe works.

      <cache-container name="clustered">
        ...
      </cache-container>
    • To encrypt client to server traffic, you must configure the server identity in standalone.xml. You cannot use environment variables to configure HTTPS after you create a deployment.
  2. Create a custom template for your JBoss Data Grid for OpenShift deployment.

    1. Ensure that the template exposes the required ports and services.
    2. Set the USER_CONFIG_MAP environment variable to a value of true.
Tip

Add placeholders to your custom standalone.xml if you want to make environment variables available in your deployment.

For example, the following is a placeholder for the JGROUPS_PING_PROTOCOL:

<!-- ##JGROUPS_PING_PROTOCOL## -->

Refer to clustered-openshift.xml to review the default XML file for JBoss Data Grid for OpenShift. This file contains all the available placeholders.

You can find examples for deployments with custom configuration in the following files:

9.2. Creating Deployments with Custom Configuration

To deploy JBoss Data Grid for OpenShift with a custom configuration, do the following:

  1. On your master host(s), log in as a cluster administrator or a user with project administrator access to the openshift namespace.

    $ oc login -u system:admin
  2. Import your custom template into the openshift namespace.

    $ oc create -n openshift -f path/to/template.yaml
  3. Create a ConfigMap from the directory where your custom configuration resides.

    • To create a ConfigMap with standalone.xml only, do the following:

      $ oc create configmap datagrid-config --from-file=./standalone.xml
    • To create a ConfigMap with standalone.xml and other configuration files, do the following:

      $ oc create configmap datagrid-config \
        --from-file=path/to/configuration

      Where path/to/configuration is the local directory that contains the configuration files.

      The ConfigMap name should match the name that you specify in your custom template. The example template uses the name datagrid-config.

  4. Deploy JBoss Data Grid for OpenShift with your custom configuration.

    $ oc new-app user-config

    The application name should match the name that you specify in your custom template. The example template uses the name user-config.

    When you deploy JBoss Data Grid for OpenShift, the configuration files are copied to the /opt/datagrid/standalone/configuration directory for the application.

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.

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.

© 2024 Red Hat, Inc.