Generate Docker Containerized Run Time and Design Time for Oracle StreamExplorer, Event Processor and JDeveloper using Vagrant, Puppet and VirtualBox

The objective of this article: prepare an environment for experimenting with Oracle StreamExplorer using two Docker containers inside a Linux VM running on my Windows laptop. And with the smallest number of manual steps possible – as to make the environment provisioning process highly repeatable.

Download installation files for Java (JDK 7u79), Oracle Event Processor and StreamExplorer and for JDeveloper (the one that is part of the SOA Suite Quick Install); these files are moved to the /files directory in the project cloned from GitHub

The directory structure after cloning the project:

The files directory contains these files:

The steps to produce the environment with the DockerDesktopHostVM with two Docker Containers with StreamExplorer/OEP and JDeveloper respectively are these:

1. Use Vagrant to create two base containers (my-base-container and my-desktop-base-container) in doing so also create the VirtualBox DockerDesktopHostVM virtual machine with Ubuntu 14.04 plus Lubuntu desktop. This is onde by running two statements from the root of the project directory:

vagrant up my-desktop-base-container

and

vagrant up my-base-container

The first statement makes Vagrant prepare the container we will use for running JDeveloper:

Step 9 in the Dockerfile is different from the my-base-container: in this step we install the Xterm libraries that allow for exposing the GUI.

The second statement produces the my-base-container, a headless Ubuntu 14.04 container inside the dockerdesktophostvm.

the last section of this vagrant operation shows some interesting details: port 9002 is exposed (that is the port OEP will be running on) and two directories on the host are mapped into the container and will be available as /stage and /puppet when we start provisioning the container using Puppet.

2. Connect into both containers and use Puppet to do the detailed provisioning and configuration

With vagrant global-status we learn the identifier for the dockerdesktophostvm and using vagrant ssh and that identifier, we can open a terminal session into the dockerdesktophostvm. With docker ps -a we find the container identifiers for the two containers we had Vagrant build earlier on.

Using docker exec -it <container identifier> bash we open a session in the container.

We can now run a container based on one of these images. When we do so for image me/sx_12_1_3:1.0, we need to expose the port OEP is running on (9002) and ensure that the OEP server started for the sx_domain. The statement used in the dockerdesktophostvm to run the SX/OEP container is:

The -p switch takes care of port mapping between dockerdesktophostvm (9202) and the Docker container (9002). OEP/SX can be accessed in the host at port 9202. The -w parameter specifies the working directory where the command to be executed will be executed. The -u switch indicates the Linux user as which the command should be executed. With –name we can set a name for the container that makes it easier to recognize and to link to or use volumes from. Finally the start-up script for OEP is startwlevs.sh

After running the container with this command, we can access StreamExplorer from the Vagrant host at http://10.10.10.30:9202/sx. Note that 10.10.10.30 is the IP address for the dockerdesktophostvm on the private network defined in the DockerHostVagrantFile.

In order to work with JDeveloper – a GUI application – we need to run the container from within the DockerDesktopHostVM that is capable of sharing its X-Windowing with the container. The command we need to use for running the container is somewhat complex. It has to forward the display system, link to the OracleStreamExplorer-container that was started earlier on, run the JDevelopet startup script etc.

Note the –link parameter that makes the container OracleStreamExplorer available and accessible inside the container using the alias sx.

This figure shows how the JDeveloper GUI is launched inside the dockerdesktophostvm when the Docker container is run using this statement:

In JDeveloper we need a connection to the OEP/SX server running in the OracleStreamExplorer container – to stop and start the server, deploy applications etc. This connection is created in the regular way:

The name of the host is sx – thanks to the link configuration between the Docker containers. Note that we access the container on the regular port – ignoring the port forwarding to the host (9002 => 9202)

Once the connection is created, we can inspect the remote OEP server:

The Simple Docker UI shows two containers running

and can provide more useful details if we like

Summary

The picture says it all.

We start with a host that contains nothing but Vagrant and VirtualBox and a bunch of virgin installation files. We run a few scripts, wait for 20-30 minutes and we have a fairly complex environment for doing StreamExplorer development. And with hardly any effort, we can repeat the process and recreate this environment. An environment that is so virtualized and isolated that we can throw it away at any time without impacting our host machine.