Welcome!

Blog Feed Post

Creating an Autoconfiguring IBM UrbanCode Deploy Agent in Skytap

Skytap recently announced the availability of the Skytap Automation Pack for IBM UrbanCode Deploy. You can read about it in this Skytap blog post from earlier this year.

You'll recall that this plugin adds the following functionality into the IBM UrbanCode Deploy Application Process web UI to create and manipulate templates and configurations in Skytap:

  • Skytap Cloud Authentication
  • Add Configuration to Project
  • Add Template to Project
  • Change Configuration State
  • Connect to Network in another Configuration (ICNR)
  • Connect to VPN Tunnel
  • Create Configuration from Template
  • Create Published Service
  • Create Published URL
  • Create Template from Configuration
  • Delete Configuration
  • Get VM ID
  • List Published URL for Configuration
  • List VM Published Service
  • Merge Template into Configuration
  • Set VM User Data

In this blog post we’ll explore how to use some of the advanced capabilities available in Skytap Cloud along with the functions available in the Skytap Automation Pack for IBM UrbanCode Deploy. This will enable us to create a Linux autoconfiguring IBM UrbanCode Deploy Agent and save it as a reusable Skytap Environment Template.

Prerequisite Software

As we begin this exercise, the following software must already be installed on a CentOS 6.4 VM in a Skytap Environment:

  • The IBM UrbanCode Deploy Agent software
  • The “curl” command package to enable interaction with the Skytap API
  • Install into /usr/local/bin, “jq”, a a command line JSON processor to enable parsing Skytap Environment metadata returned from the Skytap API.  This application is available from http://stedolan.github.io/jq

Managing Self-Registration of IBM UrbanCode Deploy Agents

When the IBM UrbanCode Deploy Agent service starts on a compute engine, it seeks to register itself with an IBM UrbanCode Deploy Server. As part of this registration process, each agent that is registered with an IBM UrbanCode Deploy Server must have a unique name by which it will be referenced by the IBM UrbanCode Deploy Server. Both the server to which the agent registers itself, as well as the name it will be assigned upon registration, are specified on the IBM UrbanCode Deploy Agent in the configuration file located at < IBM UrbanCode Deploy Agent Install Path >/conf/agent/installed.properties. In our case, this path is as follows:

/opt/ibm-ucd/agent/conf/agent/installed .properties

The default contents of this configuration file are as follows (items in italics are set during the agent install process):

IBM\ UrbanCode\ Deploy/java.home=/usr/java/jdk1.7.0_51/jre

locked/agent.brokerUrl=failover\:(ah3\://localhost\:7918)

locked/agent.home=/opt/ibm-ucd/agent

locked/agent.http.proxy.host=

locked/agent.http.proxy.port=

locked/agent.id=< randomized id string >

locked/agent.jms.remote.host=localhost

locked/agent.jms.remote.port=7918

locked/agent.keystore=../conf/ibm-ucd.keystore

locked/agent.keystore.pwd=pbe{< randomized key string >}

locked/agent.mutual_auth=false

locked/agent.name=< hostname >

Proper operation of an IBM UrbanCode Deploy agent depends on the following prerequisites:

  1. Each IBM UrbanCode Deploy agent connecting to a common IBM UrbanCode Deploy server must have a unique agent name.  This agent name is set in the “locked/agent.name=…” parameter in the installed.properties file you see above.

  2. The IBM UrbanCode Deploy server to which an agent is to connect must be specified in the “locked/agent.jms.remote.host=…” parameter in the installed.properties file you see above.

In order to ensure proper operation of our Skytap IBM UrbanCode Depoy Autoconfiguring Agent, we will set these parameters during the initial boot of the agent VM. To enable this operation we will alter the installed.properties files as follows:

locked/agent.brokerUrl=failover\:(ah3\://xxxUCD_SERVERxxx\:7918)

locked/agent.jms.remote.host=xxxUCD_SERVERxxx

locked/agent.jms.remote.port=7918

locked/agent.http.proxy.host=

locked/agent.http.proxy.port=

IBM\ UrbanCode\ Deploy/java.home=/usr/java/jdk1.7.0_51/jre

locked/agent.home=/opt/ibm-ucd/agent

locked/agent.mutual_auth=false

locked/agent.keystore=../conf/ibm-ucd.keystore

locked/agent.keystore.pwd=pbe{some-unique-random-string}

locked/agent.name=xxxINSTALLED_AGENT_NAMExxx

The entries in bold above will be changed upon boot of the Skytap VM to the appropriate value:

xxxUCD_SERVERxxx will be changed to the hostname of the IBM Urbancode Deploy Server to which the Skytap IBM UrbanCode Depoy Autoconfiguring Agent is to connect

xxxINSTALLED_AGENT_NAMExxx will be changed to a unique name to allow multiple Skytap IBM UrbanCode Depoy Autoconfiguring Agents to register with a common IBM UrbanCode Deploy server. Note that in the Skytap environment, using the hostname as the agent name does not guarantee uniqueness because Skytap Environments that are created from the same Skytap Template will have the same hostname.

We will save this modified “installed.properties” file as our reference file, “installed.properties.orig” for use in the Skytap IBM UrbanCode Depoy Autoconfiguring Agent startup script later in this article.

Configuring Skytap User Data

We will use the Skytap VM User Data to specify values to be used for the “xxxUCD_SERVERxxx” and “xxxINSTALLED_AGENT_NAMExxx” fields in the Skytap IBM UrbanCode Depoy Autoconfiguring Agent installed.properties file:

It the above screenshot, we see a value of “Skytap-Agent” assigned to a “UCD-Group” variable. We will use this UCD-Group variable as a mnemonic identifier string to prepend to the unique ID assigned to the Skytap IBM UrbanCode Depoy Autoconfiguring Agent that is registered with the IBM UrbanCode Deploy Server. In practice, we could preconfigure several different autoconfiguring agent Skytap Templates to serve as database servers, application servers, etc. Use of this mnemonic string allows us to easily discern the role of the agent once it is registered with the IBM UrbanCode Deploy Server. 

In the above screenshot, we also see a value of “10.0.0.1” assigned to the “UCD-Server” variable. This value is the IP address of the IBM UrbanCode Deploy Server.

You can read more about the Skytap VM User Data feature here.

The IBM UrbanCode Deploy Agent Boot-time Startup Script

The script to startup the Skytap IBM UrbanCode Depoy Autoconfiguring Agent process at system boot is located in the file < IBM UrbanCode Deploy Agent Install Path >/bin/init/ibm-ucdagent. In our case this file is located as follows:

/opt/ibm-ucd/agent/bin/init/ibm-ucdagent

Recall that we modified the installed.properties file to parameterize the values required to dynamically configure the agent and saved this modified file as “installed.properties.orig” for use in the Skytap IBM UrbanCode Depoy Autoconfiguring Agent startup script. Prior to starting the Skytap IBM UrbanCode Depoy Autoconfiguring Agent we must alter the startup script to use the Skytap REST API to retrieve from the Skytap VM User Data, the IBM UrbanCode Deploy Server designation and the UCD-Group mnemonic string to use in creating a unique name for the Skytap IBM UrbanCode Depoy Autoconfiguring Agent. 

Creating the Skytap IBM UrbanCode Deploy Autoconfiguring Agent Name

Since the Skytap IBM UrbanCode Depoy Autoconfiguring Agent name must be unique, we can use the Skytap VM ID, which is guaranteed to be unique in the Skytap environment, for this purpose. This VM ID, along with the UCD-Group mnemonic string specified in the VM User Metadata are both accessible via the Skytap REST API. By concatenating these values together in the form - we can construct a name that is both descriptive and unique.

Modifying the Skytap IBM UrbanCode Deploy Autoconfiguring Agent Startup Script

The modifications we make to the Skytap IBM UrbanCode Depoy Autoconfiguring Agent startup script are made in the start() routine of the script. These modifications as well as annotations in the comments are seen below.

start() {

  touch $agent_pid

  echo -n "Starting ibm-ucdagent: "

# -- Skytap Autoconfig Section Begin ------------------------------------------

#

# This pause is necessary to allow initial boot-time system processes time to start up

#

  sleep 15

#

#Set the home directory of the “installed.properties file

#

  PROPFILE_HOME="$AGENT_HOME/conf/agent"

#

# Save any existing installed.properties file with a time-date stamp for future reference, if required

#

  mv -f ${PROPFILE_HOME}/installed.properties ${PROPFILE_HOME}/installed.properties.`date +%F-%T`

#

# create a fresh copy of the installed.properties file from a parameterized installed.properties file 

#  (saved in installed.properties.orig)

  cp ${PROPFILE_HOME}/installed.properties.orig ${PROPFILE_HOME}/installed.properties

#

# remove any previous intermediate ConfigData that might be left from a previous run of this script

#

  rm -f /tmp/ConfigData_*

#

# issue a call to the Skytap API to get the Skytap Configuration metadata for this VM and save it in 

#  in an intermediate file

#

  curl -s -X GET "http://gw/skytap" -H "Content-Type: application/json" -H "Accept: application/json"  >/tmp/ConfigData_$$

#

# use the jq command line JSON parser along with some sed pattern matching and text substitution

#  to extract the VM ID from the metadata retrieved from the SkytapAPI

#

vmID=`cat /tmp/ConfigData_$$ | /usr/local/bin/jq .id | sed s/\"//g`

#

# remove any previous intermediate UserData file that might be left from a previous run of this script

#

rm -f /tmp/UserData_*

#

# use the jq command line JSON parser along with some sed pattern matching and text substitution

#   to extract the UserData field from the VM Metadata

#

cat /tmp/ConfigData_* | /usr/local/bin/jq .user_data | sed s/\\\\r\\\\n/\"\\n\"/g > /tmp/UserData_$$

#

# Now use some grep, awk and sed pattern matching and text parsing to extract the UCD-Group and 

#    UCD-Server designations from the VM User Data

#

ucdGroup=`grep UCD-Group /tmp/UserData_$$ | awk -F= '{print $2}' | sed s/\"//g`

ucdServer=`grep UCD-Server /tmp/UserData_$$ | awk -F= '{print $2}' | sed s/\"//g`

#

# echo what we found to the boot log

#

echo "Installed Agent Name: ${ucdGroup}-${vmID}"

echo "UCD Server: ${ucdServer}"

#

# Now use sed pattern matching and substitution to modify the installed.properties file

#

# first set the Agent Name and save to an intermediate file

#

  sed s/xxxINSTALLED_AGENT_NAMExxx/`echo ${ucdGroup}-${vmID}`/ < ${PROPFILE_HOME}/installed.properties > ${PROPFILE_HOME}/new.installed.properties

#

# next use that intermediate file as input and set the IBM UrbanCode Deploy Server to which

#  the agent is to connect and save to another intermediate file

#

  sed s/xxxUCD_SERVERxxx/`echo ${ucdServer}`/ < ${PROPFILE_HOME}/new.installed.properties > ${PROPFILE_HOME}/newer.installed.properties

#

#  move the modified file into place overwriting the existing installed.properties file (Note the –f

#   argument to suppress any warning or user prompt)

#

  mv -f ${PROPFILE_HOME}/newer.installed.properties ${PROPFILE_HOME}/installed.properties

# -- Skytap Autoconfig Section End ------------------------------------------

# AMD -- Made lock location variable.

  if [ -f $agent_lock ]; then

    if [ -f $agent_pid ]; then

The steps in the above script that create intermediate files could be combined, and the intermediate files reduced or eliminated, but these files are useful for debugging or further study of the process and have been left in for purposes of this writeup.

Notable steps in the script include the use of the curl command to interact with the Skytap API to retrieve information about the currently running Skytap VM. In particular, note that the running Skytap VM can get information about itself via the Skytap API  without requiring authentication.

Enable the Boot-time Startup of the IBM UrbanCode Deploy Agent

To enable the Skytap IBM UrbanCode Depoy Autoconfiguring Agent startup script to run at boot time, add it to the /etc/init.d directory as follows:

ln –s /opt/ibm-ucd/agent/bin/init/ibm-ucdagent /etc/init.d

For our CentOS system, we also need to issue the appropriate chkconfig command to enable the script to run at system boot:

chkconfig –-add ibm-ucdagent

Different procedures may be required for alternate Linux implementations.

Testing the Skytap IBM UrbanCode Deploy Autoconfiguring Agent

Now that we have put all the pieces in place, we can test our Skytap IBM UrbanCode Depoy Autoconfiguring Agent. To do this, we must first shutdown our Autoconfiguring Agent Skytap Environment. Do this by navigating to the Configuration Details page that contains the Skytap IBM UrbanCode Depoy Autoconfiguring Agent and click the “Shutdown” button on the Agent VM:

When the agent VM has shutdown, we will open a browser window to the UrbanCode Server and navigate to the Resources->Agents tab:

In the above screenshot we can see that there is already one agent named “host1.skytap.example” running, the one hosted on our IBM UrbanCode Deploy Server VM.

Now we start our Skytap IBM UrbanCode Depoy Autoconfiguring Agent VM by clicking the “Run” button on the Agent VM:

After the VM has started, we will see the VM Status is “running”:

Reviewing the IBM UrbanCode Deploy Server web interface, we should see the Autoconfiguring Agent appear in the “Agents” tab:

To enable reuse of this IBM UrbanCode Skytap Autoconfiguring Agent we will first stop the VM:

Once it has stopped, we can press the “Save as Template” button in the Skytap Configuration Details page:

Complete the Template Creation dialog:

When the template has been created, we will see the following screen:

The template will appear in the template listing page for “My” templates and available for reuse:

In my next blog post, I’ll discuss how to use the Skytap Automation Pack for IBM UrbanCode Deploy to instantiate, configure and use the Skytap IBM UrbanCode Depoy Autoconfiguring Agent Template in a complex IBM UrbanCode Deploy process.

Summary

We’ve explored an advanced scenario where we created a Skytap Environment containing an IBM UrbanCode Deploy Agent that automatically configures itself at boot-time for successful registration and use by and IBM UrbanCode Deploy Server. 

Install the software prerequisites on a VM in a Skytap Environment

Modify the Skytap IBM UrbanCode Depoy Autoconfiguring Agent “installed.properties” file to parameterize the IBM UrbanCode Deploy Server to which the agent is to connect and establish a unique agent name

Modify the Skytap User Data associated with the Skytap IBM UrbanCode Depoy Autoconfiguring Agent to specify the IBM UrbanCode Deploy Server to which the agent process is to connect and to specify an identifier string to prepend to the agent name.

Modify the Skytap IBM UrbanCode Depoy Autoconfiguring Agent startup script to modify the parameterized “installed.properties” file prior to starting the agent process

Save the modified Skytap Environment as a Skytap Template to allow reuse.

The principles demonstrated in this exercise and the additional Skytap actions provided by the Skytap Cloud Automation Pack for IBM UrbanCode Deploy can easily be expanded further into even more complex scenarios to satisfy even the most intricate and complex deployment requirements.

The next blog post will expand on this topic to demonstrate how to use the Skytap Automation Pack for IBM UrbanCode Deploy in conjuction with the Skytap IBM UrbanCode Depoy Autoconfiguring Agent Template we created in this discussion to dynamically provision a complex deployment environment.

Please contact Skytap (1-888-759-8278  or http://www.skytap.com) if you want more information about Skytap or the Skytap Cloud Automation Pack for IBM UrbanCode Deploy.

Read the original blog entry...

More Stories By Skytap Blog

Author: Noel Wurst is the managing content editor at Skytap. Skytap provides SaaS-based dev/test environments to the enterprise. Skytap solution removes the inefficiencies and constraints that companies have within their software development lifecycle. As a result, customers release better software faster. In this blog, we publish engaging, thought provoking stories that revolve around agile enterprise applications and cloud-based development and testing.

Latest Stories
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
SYS-CON Events announced today that MobiDev, a client-oriented software development company, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MobiDev is a software company that develops and delivers turn-key mobile apps, websites, web services, and complex software systems for startups and enterprises. Since 2009 it has grown from a small group of passionate engineers and business...
SYS-CON Events announced today that GrapeUp, the leading provider of rapid product development at the speed of business, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company, specialized in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market acr...
SYS-CON Events announced today that Ayehu will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara California. Ayehu provides IT Process Automation & Orchestration solutions for IT and Security professionals to identify and resolve critical incidents and enable rapid containment, eradication, and recovery from cyber security breaches. Ayehu provides customers greater control over IT infras...
What's the role of an IT self-service portal when you get to continuous delivery and Infrastructure as Code? This general session showed how to create the continuous delivery culture and eight accelerators for leading the change. Don Demcsak is a DevOps and Cloud Native Modernization Principal for Dell EMC based out of New Jersey. He is a former, long time, Microsoft Most Valuable Professional, specializing in building and architecting Application Delivery Pipelines for hybrid legacy, and cloud ...
With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend 21st Cloud Expo October 31 - November 2, 2017, at the Santa Clara Convention Center, CA, and June 12-14, 2018, at the Javits Center in New York City, NY, and learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
Automation is enabling enterprises to design, deploy, and manage more complex, hybrid cloud environments. Yet the people who manage these environments must be trained in and understanding these environments better than ever before. A new era of analytics and cognitive computing is adding intelligence, but also more complexity, to these cloud environments. How smart is your cloud? How smart should it be? In this power panel at 20th Cloud Expo, moderated by Conference Chair Roger Strukhoff, pane...
21st International Cloud Expo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Me...
Join us at Cloud Expo June 6-8 to find out how to securely connect your cloud app to any cloud or on-premises data source – without complex firewall changes. More users are demanding access to on-premises data from their cloud applications. It’s no longer a “nice-to-have” but an important differentiator that drives competitive advantages. It’s the new “must have” in the hybrid era. Users want capabilities that give them a unified view of the data to get closer to customers and grow business. The...
DevOps at Cloud Expo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to w...
The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...
In this presentation, Striim CTO and founder Steve Wilkes will discuss practical strategies for counteracting fraud and cyberattacks by leveraging real-time streaming analytics. In his session at @ThingsExpo, Steve Wilkes, Founder and Chief Technology Officer at Striim, will provide a detailed look into leveraging streaming data management to correlate events in real time, and identify potential breaches across IoT and non-IoT systems throughout the enterprise. Strategies for processing massive ...
SYS-CON Events announced today that Cloud Academy named "Bronze Sponsor" of 21st International Cloud Expo which will take place October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara, CA. Cloud Academy is the industry’s most innovative, vendor-neutral cloud technology training platform. Cloud Academy provides continuous learning solutions for individuals and enterprise teams for Amazon Web Services, Microsoft Azure, Google Cloud Platform, and the most popular cloud com...
Cloud Expo, Inc. has announced today that Andi Mann and Aruna Ravichandran have been named Co-Chairs of @DevOpsSummit at Cloud Expo Silicon Valley which will take place Oct. 31-Nov. 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. "DevOps is at the intersection of technology and business-optimizing tools, organizations and processes to bring measurable improvements in productivity and profitability," said Aruna Ravichandran, vice president, DevOps product and solutions marketing...
In his session at Cloud Expo, Alan Winters, an entertainment executive/TV producer turned serial entrepreneur, presented a success story of an entrepreneur who has both suffered through and benefited from offshore development across multiple businesses: The smart choice, or how to select the right offshore development partner Warning signs, or how to minimize chances of making the wrong choice Collaboration, or how to establish the most effective work processes Budget control, or how to ma...