Chapter 9. Using Data Grid Deployment Configuration Templates
9.1. Data Grid Deployment Configuration Templates
Data Grid provides a set of templates that can help you deploy Data Grid for OpenShift with different configurations.
As of Data Grid 7.3, these deployment configuration templates are deprecated. You should use cache-service
or datagrid-service
service templates instead. For more information see Red Hat Data Grid Supported Configurations.
Template | Description |
---|---|
| Run Data Grid for OpenShift without authentication or encryption. |
| Run Data Grid for OpenShift with an HTTPS route to securely access caches. Requires an OpenShift secret for encrypting network traffic. |
| Run Data Grid for OpenShift with a MySQL database as an ephemeral cache store. Requires an OpenShift secret for encrypting network traffic. |
| Run Data Grid for OpenShift with a MySQL database as a persistent cache store. Requires an OpenShift secret for encrypting network traffic. |
| Run Data Grid for OpenShift with a PostgreSQL database as an ephemeral cache store. Requires an OpenShift secret for encrypting network traffic. |
| Run Data Grid for OpenShift with a PostgreSQL database as a persistent cache store. Requires an OpenShift secret for encrypting network traffic. |
| Run Data Grid for OpenShift with a partitioned data directory that preserves metadata for cache entries when the pod restarts. |
9.2. Importing Deployment Configuration Templates
Import the Data Grid for OpenShift deployment configuration templates into OpenShift as follows:
- Log in to your OpenShift cluster.
Import a specific template or all templates.
Import a specific template:
$ oc create -f \ https://raw.githubusercontent.com/jboss-container-images/jboss-datagrid-7-openshift-image/7.3-v1.8/templates/datagrid73-mysql.json
Import all templates:
$ for resource in datagrid73-image-stream.json \ datagrid73-basic.json \ datagrid73-https.json \ datagrid73-mysql-persistent.json \ datagrid73-mysql.json \ datagrid73-partition.json \ datagrid73-postgresql.json \ datagrid73-postgresql-persistent.json do oc create -f \ https://raw.githubusercontent.com/jboss-container-images/jboss-datagrid-7-openshift-image/7.3-v1.8/templates/${resource} done
TipUse
oc create
to import new templates. Useoc replace --force
to overwrite existing templates.Specify the namespace into which to import the templates with the
-n
option. For example,-n openshift
imports resources into the globalopenshift
namespace and requires administrative permissions.
Import the Data Grid image.
$ oc -n openshift import-image jboss-datagrid73-openshift:1.9
Verify the templates are available on OpenShift.
$ oc get templates -n openshift | grep datagrid73
9.3. Importing OpenShift Secrets
Some Data Grid for OpenShift deployment configuration templates require HTTPS and JGroups keystores.
Data Grid for OpenShift provides HTTPS and JGroups keystores that you can import for evaluation purposes. However, you should not use this secret in production environments.
Import the secret with the keystores into your project namespace as follows:
$ oc create \ -f https://raw.githubusercontent.com/jboss-openshift/application-templates/master/secrets/datagrid-app-secret.json
For more information, see:
9.4. Deploying Data Grid for OpenShift
-
Create a new deployment with the
new-app
command. -
Specify a template with the
--template
option. Set environment variables to configure the deployment with the
-e
option.For example, to create a deployment with the datagrid73-basic template that includes a cache named
mycache
that starts eagerly, run the following command:$ oc new-app --template=datagrid73-basic \ -p USERNAME=${USERNAME} \ -p PASSWORD=${PASSWORD} \ -p CACHE_NAMES=mycache \ -e MYCACHE_CACHE_START=EAGER
See Environment Variables for information about supported environment variables.
9.5. Configuring Data Grid for OpenShift
After you create a Data Grid for OpenShift deployment, you can configure it with environment variables.
For example, you have a deployment configuration (dc
) named datagrid-app
with a cache named mycache
. Configure mycache
to start lazily as follows:
$ oc env dc/datagrid-app -e MYCACHE_CACHE_START=LAZY
When you modify a deployment configuration, the replication controller deploys a new version. Get the updated deployment configuration as follows:
$ oc get pods NAME READY STATUS RESTARTS AGE datagrid-app-2-<id> 0/1 Running 0 58s datagrid-app-2-deploy 1/1 Running 0 59s
Verify configuration changes as follows:
$ oc env pods/datagrid-app-2-<id> --list # pods datagrid-app-2-<id>, container datagrid-app CACHE_NAMES=mycache MYCACHE_CACHE_START=LAZY PASSWORD=${PASSWORD} USERNAME=${USERNAME} ...