(English) Cook a SOA/BPM Development Environment with Chef in 8 minutes!

After have installed Oracle SOA Suite once and over again, you start to finding out that these are boilerplate tasks and do not generate much value, because this are only the initial step to implement solutions with SOA and BPM.

In this post I will show you how to automate these steps using Chef.

Chef is a software provisioning tool that enable transform infrastructure as code.

The goal is prepare a development environment with Oracle BPM Suite on Windows including the following components installed and configured:

  • Oracle WebLogic Server 10.3.6
  • Oracle SOA Suite 11.1.1.7 (SOA, BPM and BAM)
  • a BPM Domain with one server with SOA and BPM (Admin Server) and other server with BAM (optional)

Chef

Chef, as its name says, is a tool that enable us to create and use “Cookbooks” which includes “Recipes”. Each “Recipe” includes a set of procedures called “Resources”. This “Resources” are the more basic elements in Chef and represent a combination of a Component and a desired Status. For example:

Literal:

We require the Apache HTTP Service started.

With Chef:

Then, as a Chef, we can combine several recipes to cook our infrastructure. This list of recipes and its order are called “Run Lists”.

Chef has two approaches to execute recipes: “Client/Server” and “Chef Solo”. Opscode offer a cloud service to host our Chef Server or we can install our own Chef Server. The Chef Client has two possible ways to work, as a Server client, or as a standalone tool called “Chef Solo”. I recommend the Chef Solo approach to start learning Chef.

As Chef there are some really good tools, like Puppet and Ansible, that can help you with provisioning tasks.

Requisites:

  • JDK 7 installed.
  • Oracle XE installed
  • SOA database schemas created with RCU
  • Chef Client installed

Steps

I have created the recipes to install Oracle WebLogic Server and Oracle SOA Suite, and other recipe to create a domain.

Chef directory structure

After install Chef Client, we can use the Knife tool to create a cookbook:

For example, in this case we create a Cookbook for Fusion Middleware domains, where we will save our recipes to create or modify domains:

The main directories are:

  • recipes: where our recipes are
  • attributes: files with properties used by recipes
  • templates: able to be combined with attributes to create new files.

Cookbooks

In this post, I have created 3 cookbooks:

  • oracle-weblogic: includes the recipes to install and configure WLS.
  • oracle-soa-suite: the same for SOA Suite.
  • oracle-fmw-domain: recipes to create and modify Fusion Middleware’s domains.

Recipes

Each Cookbook could have several recipes. For example, in WebLogic’s cookbook I can create a recipe to install 10g version, another recipe to upgrade to 11g, anothe to install some patch and so on.

Cookbook Recipe Name Description
oracle-weblogic install-wls-10.3.6 oracle-weblogic::install-wls-10.3.6 Installs WLS
oracle-soa-suite install-soa-11.1.1.7 oracle-soa-suite::install-soa-11.1.1.7 Installs Oracle SOA Suite
oracle-fmw-domain create-domain-soabpm-dev oracle-fmw-domain::create-domain-soabpm-dev Creates a SOA Development Domain

Let’s go to check how the recipe’s code is to run the “Run List” and create our development environment.

Resources

Resource: Template

As any template, this resource is used to create new files based on recipe attributes. For exaple: To install WLS in silent-mode, we need to create a XML file with information about directories, JDK path, etc.

A template like this:

And each <%= @variable_name %> will be replaced with recipe variables:

And these values come from attributes file:

Resource: Execute

Another important resource is Execute which let you execute commands on OS. For example: the commands to start the installation, etc.

Here, we define the command that trigger the SOA Suite installation called “run_command”, only if the SOA directory doesn’t exist.

Execution

To start the installation, first we must have Chef Client installed and then we must check the attributes to align these with our requirements.

To do this, we should enter WebLogic cookbook and then enter attributes directory:

In the same manner, we can enter SOA Cookbook attributes directory and check the files:

To define the domain attributes, enter FMW Domains/attributes and check the files:

At the end, we should validate Chef executables are included in the PATH environment variable to execute the script “install_soabpm.cmd” that contains the following commands:

Where solo.rb contains Chef basic parameters and the JSON file contains the “run list” to execute recipes:

To start the installation we should open a command-line as Adminsitrator and run the “install_soabpm.cmd”:

After about 8 minutes you can start your BPM server :-)

Conclusions

With Chef or Puppet tools and Vagrant (who provides VMs) is possible to automate almost all the installation and configuration tasks required to prepare environments dynamically, transforming knowledge into reusable code and this code could be improved over time.

Resources

The source code is shared on GitHub
The best resources I found to learn Chef: link