C Configuring Virtual Environments with Static IP Addresses

This appendix describes how to configure Oracle Service Bus when you are deploying in a virtual environment that includes an Oracle Coherence cluster and the virtual machines use static IP addresses.

When using static IP addresses, you need to configure well-known addresses (WKAs) for unicast addressing for the cluster. You also need to ensure that the arguments used during server startup include the Coherence overrides for Service Bus.

C.1 Step 1: Create the Directory Structure

Create the following directory structure in the root directory of the computer on which the WebLogic Admin Server is running.

/ovab
   /scripts.d
       /properties
       /post-config.d

If there are permission problems in creating a directory under the root directory, you can create it as a user with root credentials. The directories and the files you place in them must be readable by the user who runs the OVAB introspection.

C.2 Step 2: Create the Properties File

The properties file defines two properties that specify the Coherence overrides for Service Bus.

To create the properties file:

  1. Create a file named osb.userprops in the /ovab/scripts.d/properties directory that you created in step 1.

  2. Add the following text to the file, substituting a comma-separated list of the actual server IP addresses for the WKA addresses:

    coherence.wkaaddresses=Host1,Host2,Host3,Host4..,HostN
    coherence.wkaport=7890
    
    Property Description

    coherence.wkaaddresses

    Comma separated list of the IP addresses of the servers in the Oracle Service Bus cluster

    coherence.port

    7890


  3. Save and close the file.

  4. Change the permissions on the file so all users have execute permissions.

These custom properties will be available in the OVAB deployment plan editor for all the appliances present in the assembly. These properties need to be edited only for the Service Bus cluster appliance.

C.3 Step 3: Create the Configuration File

A sample configuration script is provided for the bash shell.

To create the configuration file:

  1. Create a file named osb-postconfig.sh in the /ovab/scripts.d/post-config.d directory that you created in step 1.

  2. Add the text in Example C-1, "Sample Configuration File".

  3. Save and close the file.

  4. Change the permissions on the file so all users have execute permissions.

Example C-1 Sample Configuration File

#!/bin/bash
DEBUG_FILE=/tmp/osb-postconfig-$$.debug
/bin/rm -f $DEBUG_FILE
DEBUG=1
 
debug() {
    if [ x$DEBUG=x1 ]; then
        echo $1 >> $DEBUG_FILE
    fi
}
 
CUSTOM_PROPS_DIR=$AB_CUSTOMPROPS_DIR
debug "CUSTOM_PROPS_DIR=$CUSTOM_PROPS_DIR"
OSB_PROPS_FILE=$CUSTOM_PROPS_DIR/osb.userprops
debug "OSB_PROPS_FILE=$OSB_PROPS_FILE"
OPWD=$PWD
cd $CUSTOM_PROPS_DIR/../..
CONTENT_RESDIR=$PWD
 
debug "CONTENT_RESDIR=$CONTENT_RESDIR"
if [ ! -f ./rehydrate.properties ]; then
    debug "Rehydrate properties not found"
    exit 1
fi
 
DOMROOT=$(grep WlsDomainRoot ./rehydrate.properties | sed 's/^.*=//')
if [ -z "$DOMROOT" ]; then
    debug "Domain root cannot be identified"
    exit 2
fi
 
OSB_DOMENV_FILE=$DOMROOT/bin/setOSBDomainEnv.sh
if [ ! -f $OSB_DOMENV_FILE ]; then
    debug "OSB domain env file $OSB_DOMENV_FILE not found"
    exit 3
fi
# Change to root
cd /
 
MYIP=$(/sbin/ip -f inet addr | awk '/eth0:/ { getline; sub(/\/..*$/,"",$2); print $2}')
 
if [ -z "$MYIP" ]; then
    echo "VM IP address cannot be found for the eth0 interface"
    exit 4
fi
 
MYHOST=$(hostname)
 
debug "MYIP = $MYIP"
 
START_ARGS=$(awk -v ip=$MYIP -v host=$MYHOST '
   BEGIN {nhosts = 0 }
   /coherence.wkaaddresses[     ]*=/ {
        sub(/coherence.wkaaddresses[    ]*=/,"", $0)
        n = split ($0, addr, /,/)
        for (i = 1; i <= n && i < 10; ++i) {
             a = addr[i] ""
             gsub(/[    ]*/,"",a)
             wka_arg = sprintf("%s -DOSB.coherence.wka%d=%s ", wka_arg, i, a )
        }
        nhosts=i - 1
        host_arg = " -DOSB.coherence.localhost=" ip
 
   }
   /coherence.wkaport[     ]*=/ {
        sub(/coherence.wkaport[    ]*=/,"", $0)
        port = $0
        for (i = 1; i <= nhosts && i < 10; ++i) {
             port_arg = sprintf("%s -DOSB.coherence.wka%d.port=%d ", port_arg, i, port )
        }
        port_arg = sprintf("%s -DOSB.coherence.localhost.port=%d ", port_arg, port )
   }
   END {
      start_args=sprintf("\"$EXTRA_JAVA_PROPERTIES %s %s %s\"", wka_arg, host_arg, port_arg)
      print start_args
   }
' $OSB_PROPS_FILE)
 
debug "START_ARGS = $START_ARGS"
 
if [ -z "$START_ARGS" ]; then
    debug "No updates needed - Coherence cluster configuration not desired"
    exit 0
fi
 
debug "Updating $OSB_DOMENV_FILE"
echo "EXTRA_JAVA_PROPERTIES=$START_ARGS" >> $OSB_DOMENV_FILE
debug "Done"