posts

Running Oracle BPM 12c on AWS using Vagrant and Chef

Posted on
devops oracle fmw bpm chef vagrant

In this post, I will show how to create an AWS EC2 Instance with an Oracle BPM 12c Quickstart Domain created. And I will use previous post for related tasks.

Lets see how to achieve this and make this process reusable. These are the steps:

  • Create an AWS EC2 instance (with Vagrant)
  • Connect to an NFS instance to get the installer (with Chef)
  • Install Oracle BPM 12c Quickstart and create a Domain (with Chef)

GitHub repository: Here

 Create an AWS EC2 instance

I’ve created a Red Hat instance using Vagrant. This instance should be connected to my NFS instance that has all the Oracle’s installers (to create an NFS instance on AWS EC2: go here).

This is the NFS instance:

NFS instance

And the “/data” directory is shared. It includes Oracle XE and Oracle FMW installers:

NFS directories

 Vagrant configuration

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
	# Load properties files
	box_props = YAML.load_file("box.properties")
	aws_props = YAML.load_file("aws.properties")

	# Basic metadata
	config.vm.box = "#{box_props['box']['name']}"
	config.vm.box_url = "file://#{box_props['box']['base_location']}"

	# AWS Configuration
	config.vm.provider :aws do |aws, override|
		aws.access_key_id = "#{aws_props['keys']['access_key_id']}"
		aws.secret_access_key = "#{aws_props['keys']['secret_access_key']}"
		aws.keypair_name = "jeqo"

		aws.instance_type = "m3.medium"
		aws.region = "sa-east-1"
		aws.availability_zone = "sa-east-1a"
		aws.ami = "ami-0511a418"

		override.ssh.username = "ec2-user"
		override.ssh.private_key_path = "#{aws_props['keys']['key_pair_location']}"

		aws.tags = {
		  'Name' => box_props['box']['name']
		}

		aws.block_device_mapping = [{
			'DeviceName' => '/dev/sda1',
			'Ebs.VolumeSize' => box_props['box']['disk_size']
		}]

		aws.security_groups = "jeqo-group"

		config.ssh.pty = true
	end

	# Install Chef Client
	config.omnibus.chef_version = :latest

	# Increase Swap size
	config.vm.provision "shell" do |s|
		s.path	= "increase_swap.sh"
		s.args   = "'#{box_props['box']['additional_swap']}'"
	end

	# Run Provisioning with Chef
	config.vm.provision "chef_client" do |chef|
		chef.chef_server_url = "https://api.opscode.com/organizations/jeqo"
		chef.validation_client_name = "jeqo-validator"
		chef.validation_key_path = "#{box_props['chef']['repo_location']}/.chef/jeqo-validator.pem"
		chef.node_name = "#{box_props['box']['name']}"
		chef.add_role "nfs-client"
		chef.add_role "oracle_db-xe"
		chef.add_role "demo-bpm_bam-12c"
		chef.json = {
			"nfs-client" => {
				"server-host" => "127.0.0.1"
			},
			"oracle-xe" => {
				"url" => "file:///data/oracle-xe/oracle-xe-11.2.0-1.0.x86_64.rpm"
			},
			"bpm_qs-12c" => {
				"url" => "file:///data/oracle-fmw/bpm_qs-12c/fmw_12.1.3.0.0_bpmqs_Disk1_1of1.zip"
			}
		}
	end
end

Running this file with:

vagrant up --provider=aws

You will create a new instance on AWS EC2.

 Connect to an NFS instance

The first recipe that will be executed is:

...
  chef.add_role "nfs-client"
...

This call the following Chef role:

{
  "name" : "nfs-client",
  "description" : "Role applied to the system that should be an NFS client tools.",
  "json_class" : "Chef::Role",
  "default_attributes" : {
    "nfs-client" : {
      "server-host" : "localhost",
      "local-directory" : "/data",
      "remote-directory" : "/data"
    }
  },
  "run_list" : [
    "recipe[nfs-utils::nfs-client]"
  ]
}

To update the server-host from your Vagrant configuration, add these lines:

...
chef.json = {
  "nfs-client" => {
    "server-host" => "123.1.1.12"
  },
  ...

And when your instance started, a new directory “/data” will sync the NFS shared directories.

 Install Oracle BPM 12c Quickstart

To install BPM, you can download my shared “oracle-fmw” cookbook from Chef Supermarket. It is explained in this post.

Vagrant configuration calls this Chef role:

{
  "name" : "demo-bpm_bam-12c",
  "json_class" : "Chef::Role",
  "default_attributes" : {
    "domain-12c": {
      "name": "demo-bpm_bam-domain",
      "mode": "Compact",
      "apps": [
        {"name" : "SOA", "enabled" : true},
        {"name" : "BPM", "enabled" : true},
        {"name" : "BAM", "enabled" : true},
        {"name" : "OSB", "enabled" : false}
      ],
      "machines": [
      ],
      "admin_server": {
        "base_name" : "AdminServer",
        "new_name" : "bpm_bpm-server",
        "port" : "7001"
      },
      "managed_servers": [
      ],
      "db_repo_host": "localhost",
      "db_repo_port": "1521",
      "db_repo_sid": "xe",
      "db_repo_prefix": "DEMO",
      "db_repo_password": "welcome1"
    },
    "rcu-12c": {
      "db_schema_prefix": "DEMO",
      "db_dba_user": "SYS",
      "db_dba_role": "SYSDBA",
      "db_dba_password": "welcome1",
      "db_schemas_password": "welcome1",
      "db_hostname": "localhost",
      "db_port": "1521",
      "db_service": "xe",
      "components": [
        "SOAINFRA",
        "OPSS",
        "IAU",
        "MDS",
        "WLS",
        "UCSUMS",
        "IAU_APPEND",
        "IAU_VIEWER"
      ]
    }
  },
  "run_list" : [
    "recipe[oracle-fmw::install-bpm_qs-12c]",
    "recipe[oracle-fmw::create-rcu_repository-12c]",
    "recipe[oracle-fmw::create-domain-12c]"
  ]
}

This includes will run three recipes: “install-bpm_qs-12c” , “create-rcu_repository-12c”, “create-domain-12c”. And includes Domain information (“domain-12c”), and RCU info (“rcu-12c”).

These process takes 30 min. approx. And now we can login with “oracle-fmw” user (password: welcome1), and start the server:

Start server

Server started

That’s it.