Chapter 3. Tutorials 3.1. Prerequisite Before undertaking these tutorials, you must configure your environment correctly. See the OpenShift Primer for instructions. 3.2. Deploy your project using the Red Hat JBoss Data Virtualization for OpenShift image Use this workflow to create and deploy a project. As an example, the tutorial uses the dynamicvdb-datafederation quickstart which combines data from a relational source (H2) and a Microsoft Excel file. After deploying it, you will learn how to switch data sources. Create a new project: Create a service account to be used for the Red Hat JBoss Data Virtualization for OpenShift deployment: Add the view role to the service account: The Red Hat JBoss Data Virtualization for OpenShift template requires SSL and JGroups keystores. (These keystores are required even if the application will not use https.) The following commands will prompt you for passwords: Generate a secure key for the SSL keystore: Generate a secure key for the JGroups keystore: Use the SSL and JGroup keystore files to create the keystore secret for the project: Create a secret with the datasources.env file: Link the keystore and environment secrets to the service account: Log in to the OpenShift Web Console: https://127.0.0.1:8443 Click jdv-app-demo . Click Add to Project . Click Browse Catalog . Enter datavirt in the Filter by keyword search bar. Click basic-s2i . Enter these parameters: Git Repository URL : https://github.com/jboss-openshift/openshift-quickstarts Git Reference : master CONTEXT_DIR : datavirt64/dynamicvdb-datafederation/app Click Deploy . Switch to using a MySQL data source instead of H2: 3.3. How to use a cache as a materialization target Having deployed the dynamicvdb-datafederation quickstart, you can now deploy a Red Hat JBoss Data Grid instance. This allows you to quickly query the cache for data, without having to go back to the original sources. You can use any of the Red Hat JBoss Data Grid for OpenShift templates, but it is better to use non-persistent templates as these provide you with clustering and high availability functionality. To obtain them, click here: https://github.com/jboss-container-images/jboss-datavirt-6-openshift-image/tree/datavirt64/resources/openshift/templates Enter the jdv-app-demo project: Create a service account for JDG for OpenShift: Add view role permissions to the service account: Create the keystore secret for the project: Link the keystore secret to the service account: Log in to the OpenShift Web Console . Click the jdv-app-demo project space. Click Add to Project . Enter datagrid in the Filter by keyword search bar. Click the datagrid71-https template. In the DATAVIRT_CACHE_NAMES environment variable field, enter stockCache . In the CACHE_TYPE_DEFAULT environment variable field, enter replicated . Enter these parameters: USERNAME : jdg PASSWORD : JBoss.123 JDG User Roles/Groups (ADMIN_GROUP): admin,___schema_manager HOTROD_AUTHENTICATION : true CONTAINERSECURITYROLE_MAPPER : identity-role-mapper CONTAINER_SECURITY_ROLES :"admin=ALL,jdg=ALL" Click Deploy . Set JDG as the materialization target:

Commands:
oc new-project jdv-app-demo
oc create serviceaccount datavirt-service-account
oc policy add-role-to-user view system:serviceaccount:jdv-app-demo:datavirt-service-account
keytool -genkeypair -alias https -storetype JKS -keystore keystore.jks
keytool -genseckey -alias jgroups -storetype JCEKS -keystore jgroups.jceks
oc secret new datavirt-app-secret keystore.jks jgroups.jceks
git clone https://github.com/jboss-openshift/openshift-quickstarts/blob/master/datavirt/dynamicvdb-datafederation/datasources.env
oc secrets new datavirt-app-config datasources.env
oc secrets link datavirt-service-account datavirt-app-secret datavirt-app-config
oc env dc/datavirt-app QS_DB_TYPE=mysql5
oc project jdv-app-demo
oc create serviceaccount datagrid-service-account
oc policy add-role-to-user view system:serviceaccount:jdv-app-demo:datagrid-service-account
oc secret new datagrid-app-secret jgroups.jceks
oc secrets link datagrid-service-account datagrid-app-secret
oc env bc/datavirt-app DATAGRID_MATERIALIZATION=true