Friday, May 9, 2014

Docker and Red Hat JBoss Data Virtualization

I will be starting a Data Virtualization workshop blog series next week with a financials demo.  Part of the setup and introduction involves using Data Virtualization, mySQL and Postgres.  Instead of going through all the different install/configuration steps in all the different Platforms we decided to us a docker image to get started quickly with running all the products (DV, MySQL, Postgres, JDK).

Today I wanted to go through a quick example of getting the image from the public repository or building it locally.  Then some examples of interacting with Data Virtualization in the image.  I wanted to give a shout out to Cojan van Ballegooijen from the Netherlands for his Docker work.

I. Overview
II. Building the Image
III. Downloading the Image
IV. Interacting with the Products

Overview

Docker -
Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application. The same container that a developer builds and tests on a laptop can run at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more.

Data Virtualization -
JBoss Data Virtualization is complete data provisioning, federation, integration and management solution that enables organizations to gain actionable and unified information.  Red Hat JBoss Data Virtualization enables agile data utilization in 3 easy steps:
  • Connect: Access data from multiple, heterogeneous data sources.
  • Compose: Easily create reusable, business-friendly logical data models and views by combining and transforming data.
  • Consume: Make unified data easily consumable through open standard interfaces.
More info for Docker: https://www.docker.io/learn_more/
More info for Data Virtualization: http://www.jboss.org/products/datavirt.html

Building the Image

Step 1: Clone the DVWorkshop Repository. The dv-docker is the main folder we will be using.
https://github.com/DataVirtualizationByExample/DVWorkshop.git

Step 2: Install Docker to your local machine or Virtual Machine according to your platform.  More detail is on the docker.io site. In my case I installed Docker on my Fedora VirtualBox Virtual Machine.

Step 3: Download the Data Virtualization product from jboss.org/products.

Step 4: Place the jboss-dv-installer-6.0.0.GA-redhat-4.jar in the dv-docker/software folder

Step 5: Start Docker from root if it isn't already running

# systemctrl start docker

Step 6: From your normal login (in my case kpeeples) check permissions of docker

docker info

If you get

2014/05/09 15:06:51 dial unix /var/run/docker.sock: permission denied

then use the following command to fix the permissions

$ sudo chmod a+rw /var/run/docker.sock

Step 7: Run the build, which runs docker build -t jbossdv600 .  NOTE: if you receive an error on mysqld start on RHEL 6 the use the --no-cache option with the docker build.  See http://docs.docker.io/reference/commandline/cli/#build

./build.sh

Step 8:  My output from the build can be seen in this text file - https://drive.google.com/folderview?id=0B5kKwcd4kOq9VUNycWtkQVZJS1U&usp=sharing

Step 9:  Look at the image list

$ docker images

Step 10: Look at the container list

$ docker ps

Step 11: Connect to the image in interactive mode

$ docker run -P -i -t jbossdv600 /bin/bash

Step 12: Start the services (DV, MySQL, Postgres, MongoDB)

 # /home/jboss/run.sh &

Downloading the Image


Note: The tar image has been removed because you must download and accept the licensing agreement for now.  A Red Hat Docker image repository is in process.

Note: I am testing the download of the image so if you have any issues then send me a message.
Note: This is only if you rather download the image instead of build it.

Step 1: Sign up for an account on docker.io

Step 2: Login into docker

$ sudo docker login

Step 3: Pull the Repository

docker pull kpeeples/jbossdv600

Step 4:  Look at the image list

$ docker images

Step 5: Look at the container list

$ docker ps

Step 6: Connect to the image in interactive mode

$ docker run -P -i -t jbossdv600 /bin/bash

Step 7: Start the services (DV, MySQL, Postgres, MongoDB)

 # /home/jboss/run.sh &

Verify Data Virtualization is running

Step 1: Get the ContainerID

docker ps

Step 2: Get the IP Address where MY_CID is the container ID

docker inspect --format '{{ .NetworkSettings.IPAddress }}' MY_CID

Step 3: Browse to Data Virtualization where MY_IP is the IP from above

http://MY_IP:8080/

Step 4: Browse to Data Virtualization Dashboard where MY_IP is the IP from above with user as user and user as password

http://MY_IP:8080/dashboard/

In the Workshop series we will  walk through connecting to the databases externally and internally.