Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

SmartCloud tip: Deploy products using rapid deployment service

Dominique Vernier, IT Architect, IBM
Dominique Vernier photo
In recent years, Dominique Vernier focused on Java technologies and cloud architecture. He also has been working in information technology for quite a while where he earned a broad knowledge in such technologies and products as messaging, database, SOA, EAI, client/server, C/C++, and existing frameworks. Dominique also has extensive knowledge in industry areas such as telecom, CRM, logistics, and insurance. He is the author/co-author of four patents having to do with state engines and resource management. At present, Dominique is in charge of the IBM SmartCloud Enterprise solutions on the IBM GTS Global Team.

Summary:  Based on Simple Product Installation (SPiN), a platform-agnostic IBM scripting language), the rapid deployment service (RDS) lets users quickly deploy products, minimizes the need for a specialist to install complex products, and reduces the number of human errors that can occur during installation. Learn how to set up an RDS asset on IBM SmartCloud Enterprise.

View more SmartCloud Enterprise tips

Date:  29 Apr 2011
Level:  Intermediate PDF:  A4 and Letter (492 KB | 15 pages)Get Adobe® Reader®
Also available in:   Chinese  Korean  Japanese  Portuguese

Activity:  7484 views
Comments:  

Rapid deployment service (RDS) is a service that lets a user deploy products on the cloud platform whether the products are virtualized or not. The service leverages Simple Product Installation (SPiN), an IBM® scripting language that is platform agnostic. With RDS, highly customizable, complex assets can be quickly deployed with a minimum of specialist intervention; the automation features of RDS reduces the number of human errors that can occur during installation.

This article shows you how to customize an image on IBM SmartCloud Enterprise to use RDS to install, on the fly, an IBM HTTP server using a port number provided at the instance creation time, and not hard-coded in the image. A similar technique can be used to create other RDS installation-based images.

For more information on customizing an image on the IBM SmartCloud Enterprise so that it can launch scripts (and to learn how to set up an instance to use for the purposes of this article), read "Parameterize cloud images for custom instances on the fly."

Getting the RDS files provides information on the files you need and where to find them. You also need access to the IBM SmartCloud Enterprise to test the features described in this article.

Background concepts

When you create an image on the IBM SmartCloud Enterprise, it is stored on the Rational® Asset Catalog as a new asset attached to your account. This asset is in your private community, meaning in your private catalog. Once the asset is in your catalog, you can promote it to your enterprise community and make it available in your enterprise catalog. Since this asset is in the Rational Asset Catalog, which is based on Rational Asset Manager, you can upload files on this asset or overwrite existing files of this asset, similar to what you do with Rational Asset Manager.

In a standard IBM SmartCloud Enterprise image asset, there are two main files:

  1. Parameters.xml: This file contains a description of the parameters that should appear in the request window during the instance request. It is used to build the panel during the instance creation. The parameters.xml file is then copied in the /etc/cloud directory of the server with the actual values.
  2. Scripts.txt: This file is not in the asset by default but if you add it under the activation-scripts directory of the asset, it can be used to indicate where each file under that directory should be uploaded in your instance. This is very useful because it lets you upload a number of files/scripts in your instance at an early stage of the instance boot.

One other file that is very useful in this context is the cloud-startupx.sh file. The x is equal to 3 or 5 depending on the run level of your instance:

  • cloud-startup3.sh
  • cloud-startup5.sh

Regardless of the run level you choose, this file contains commands that are launched at boot time of the instance and therefore can be hooked to launch RDS.

With the parameters.xml, the scripts.txt, and the cloud-startupx.sh files, you have all the needed tools to build any installation/setup process at boot time and to use RDS as the installation method.

After you've set up cloud-startupx.sh, add a section to it to look for the file parameters.xml.done, a file you add after the first RDS installation is complete. The parameters.xml.done file prevents the RDS install process from running every time you boot.

In this example of RDS, you will install an IBM HTTP Server on a platform and customize the port number on which the server should listen to. In this case, use a SuSE Linux® 11 SP1 platform.

Variant or invariant tasks

A variant task is one that requires parameters and therefore is best handled with parameterization. Examples from this article include setting up the VNC password or creating the user.

An invariant task is one that doesn't require parameters (like requesting an operating system instance); this one can be done the easy, static way.

After reading "Parameterize cloud images for custom instances on the fly," you will understand that there are different ways to set up an image, and this mainly depends on which task you estimate as being the variant and which the invariant.

You can pre-load a maximum number of files in the initial instance and then take an image of it that can be used as a base image for your future instance creation requests. By doing it that way, you reduce the amount of data to upload at the instance creation time, but the caveat here is that you lose flexibility. You will have to create a new base image each time you want to change a single pre-loaded file and I don't want to imagine the development nightmare.

The right balance is somewhere in the middle, but for this proof of concept article, I uploaded single files to the Rational Asset Catalog. Feel free to pre-load some files in your image if it's in the interest of your use-case, but as a general rule don't pre-upload scripts — otherwise the effort spent in the development of your image will increase significantly.

Now, let's get started.


Create the base image

  1. Since the SuSE image starts on run level 3 and you have to install Java 1.6.0 using yast (which uses the network to upload the installation package), you can't do it at the boot time. Create an instance from a plain SuSE platform, then connect to it using ssh.
  2. Once connected, run the command sudo bash to get root access and then run the following command to install Java™:
    yast2 -install java-1_6_0-ibm

    Java is required to run RDS and it is the only prerequisite.
  3. Create an image from this instance. The base image is stored in Rational Asset Manager under My dashboard.

    Figure 1. Create an image from your instance
    Create and image from your instance

To access Rational Asset Manager from the IBM Cloud portal, on the Control Panel tab click View Asset Catalog.


Figure 2. Access Rational Asset Manager
Access Rational Asset Manager

Download the asset

Once the image is created, select the asset from the Rational Asset Catalog and download it to your local disk.


Figure 3. Download the asset
Download the asset

Set up parameters.xml

Define the port number to which the server should listen in the parameters.xml file. Modify the parameters.xml to add a field tag. The parameters.xml file will look something like this after adding the port field:


Listing 1. The parameters.xml file

<?xml version="1.0" encoding="UTF-8"?>
<parameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:noNamespaceSchemaLocation=
 "platform:/resource/com.ibm.ccl.devcloud.client/schema/parameters.xsd">
	<firewall>
		<rule>
			<source>0.0.0.0/0</source>
			<minport>1</minport>
			<maxport>65535</maxport>
		</rule>
	</firewall>
	<field name="webserver-ihs-http-port" label="IHS HTTP Port" type="number">
		<values>
			<value>80</value>
		</values>
	</field>
</parameters>

Notice in the file the field tag uses webserver-ihs-http-port as the name. That is the variable name used in the RDS property file to define the port value. Using the same name makes it easier to automatically customize the RDS property file.


Create the cloud-startupx.sh file

  1. Depending on the run level of your instance, create a cloud-startup3.sh or cloud-startup5.sh file. You can test the run level by issuing the runlevel command at the command prompt of your instance. Once you define the run level, you can copy the corresponding cloud-startupx.sh on your local disk. These files are located in the /etc/init.d directory.
  2. Modify this file until you've got something like this:

    Listing 2. The modified cloud-startupx.sh file
    
    # Required-Stop:
    # Should-Stop:
    # Default-Start:     3
    # Default-Stop:
    # Short-Description: Cloud startup
    # Description:       Extract and set user password
    ### END INIT INFO
    
    case "$1" in
        start)
            echo "== Cloud Starting"
            if [ ! -e /etc/cloud/idcuser_pw_randomized ]; then
                echo "Randomizing idcuser password"
                echo idcuser:`< /dev/urandom tr -dc _A-Z-a-z-0-9 |head -c16` 
                                                                 | /usr/sbin/chpasswd
                touch /etc/cloud/idcuser_pw_randomized
            fi
            if [ ! -e /etc/cloud/parameters.xml.done ]; then
                . /etc/cloud/launchRDS.sh /etc/cloud build-IHS.sh
                cp /etc/cloud/parameters.xml /etc/cloud/parameters.xml.done
            fi
            ;;
        stop)
            echo "== Cloud Stopping"
           ;;
        *)
            echo "Usage: $0 {start|stop}"
            exit 1
            ;;
    esac
    
    #Attach Dynamic disk
    modprobe acpiphp
    

    The added code:

            if [ ! -e /etc/cloud/parameters.xml.done ]; then
                . /etc/cloud/launchRDS.sh /etc/cloud build-IHS.sh
                cp /etc/cloud/parameters.xml /etc/cloud/parameters.xml.done
            fi
    

    The added code checks to see if the parameters.xml.done file is not present because if this file is already present, that means that the RDS installation is already done and should not be done again. If the parameters.xml.done is not present, launch the RDS installation through the launchRDS.sh file, and then create the parameters.xml.done file.


Launch RDS installation

  1. Before launching SPiN, you have to launch some other commands, but let's put the SPiN call and these commands in the same script (launchRDS.txt):

    Listing 3. The SPiN call and other necessary commands
    
    #Prepare SpiN package
    tar --directory=$1 -xvf $1/ihs.tar
    cp $1/7.0.0.7-WS-UPDI-LinuxIA32.tar $1/spinPackage2/software/was/v7/maint
    cp $1/7.0.0-WS-IHS-LinuxX32-FP0000007.pak $1/spinPackage2/software/was/v7/maint
    cp $1/7.0.0-WS-PLG-LinuxX32-FP0000007.pak $1/spinPackage2/software/was/v7/maint
    cp $1/7.0.0-WS-WASSDK-LinuxX32-FP0000007.pak $1/spinPackage2/software/was/v7/maint
    cp $1/C1G32ML.tar $1/spinPackage2/software/was/v7/nd
    cp $1/C1G33ML.tar $1/spinPackage2/software/was/v7/nd
    
    #Create wasadm group
    groupadd wasadm
    
    #Add directory
    mkdir -p $1/spinPackage2/software/WebSphere/Plugins
    touch $1/spinPackage2/software/WebSphere/Plugins/empty.txt
    
    #Adapt the Spin property file.
    echo "Adapt props"
    perl $1/replaceProperty.pl 
         $1/spinPackage2/custom-spin/RDSDemo-WebSphere-V7-ND-ihsOnly.props
           webserver-ihs-http-port
    
    #Start installation
    echo "Start install"
    cd $1/spinPackage2
    ./$2
    
    #Setup firewall
    cp /etc/sysconfig/SuSEfirewall2 /etc/sysconfig/SuSEfirewall2.bak
    /sbin/SuSEfirewall2 stop
    perl $1/replace.pl $1/SuSEfirewall2 webserver-ihs-http-port
    cp $1/SuSEfirewall2 /etc/sysconfig/SuSEfirewall2
    /sbin/SuSEfirewall2 start
    

  2. In the first phase, unZIP the ihs.tar which contains the SPiN scripts, then copy all installation packages to the specific directory for SPiN.
  3. Call a perl script. The role of this script is to set the webserver-ihs-http-port variable with the value provided in the parameters.xml file.

    Listing 4. replaceProperty.txt
    
    #!/user/bin/perl 
    use strict; 
    use warnings; 
    my $cmd=""; 
    if(-e $ARGV[0]) 
    { 
        $cmd = "cp $ARGV[0] $ARGV[0].bak"; 
        `$cmd`; 
    } 
    else 
    { 
        print "File does not exist.\n"; 
        exit; 
    } 
    
    my @result =`perl /usr/bin/extract-parameters.pl $ARGV[1]
     /etc/cloud/parameters.xml`; 
    chomp(@result); 
    open(INPUT,"$ARGV[0].bak") or die "Cannot open file: $!\n"; 
    open(OUTPUT,">$ARGV[0]"); 
    
    while(<INPUT>){ 
        $_ =~ s/^$ARGV[1]=.*/$ARGV[1]=@result/g; 
        print $_; 
        print OUTPUT $_; 
    } 
    
    close INPUT; 
    close OUTPUT;
    

  4. Once that is done, call the SPiN installation and finally open the port in the firewall.

This is the basic installation; all scripts are provided in the ihs.tar file except the SPiN scripts and the IBM HTTP Server assembly. (See Getting the RDS files for information on where to find those files.)


Upload scripts on the Rational Asset Catalog

Follow the documentation provided in "Parameterize cloud images for custom instances on the fly" to learn how to upload a file in the asset.

The modified parameters.xml file is uploaded and listed in the root directory of the content of the asset (as shown):


Figure 4. Upload the parameters.xml file
Upload the parameters.xml file

Other files such as RDS asset, scripts, assembly files, and fix packs in the activation_scripts directory are also listed.


Figure 5. Upload other files
Upload other files

Create an instance

To create an instance:

  1. Select the image from your private catalog.

    Figure 6. Select the image
    Select the image

  2. Provide a name and keys.

    Figure 7. Provide name and keys
    Provide name and keys

  3. Enter the port number.

    Figure 8. Enter port number
    Enter port number

  4. Agree and Submit.

It takes some time to Submit the request because the provisioning engine has to upload the asset from RAM and the asset contains all the assembly files. You can test it by accessing the HTTP Server on the provided IP address using the specified port.

And that's all there is to it.


Getting the RDS files

Find more information about RDS.

RDS already has a number of product installation assets in its product library. These assets can be customized to meet customer requirements.

The necessary IBM HTTP Server eAssembly files and the RDS package asset are only delivered under license; you can download the eAssembly files from Extreme-leverage and RDS.

This article demonstrates a proof of concept: Using RDS to install products and accelerate the image creation process. If you have a business case where you'd like to apply this method, please contact the RDS team. They'll show you how RDS can be delivered in an automated provisioning environment.


Resources

Learn

Get products and technologies

Discuss

About the author

Dominique Vernier photo

In recent years, Dominique Vernier focused on Java technologies and cloud architecture. He also has been working in information technology for quite a while where he earned a broad knowledge in such technologies and products as messaging, database, SOA, EAI, client/server, C/C++, and existing frameworks. Dominique also has extensive knowledge in industry areas such as telecom, CRM, logistics, and insurance. He is the author/co-author of four patents having to do with state engines and resource management. At present, Dominique is in charge of the IBM SmartCloud Enterprise solutions on the IBM GTS Global Team.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Cloud computing
ArticleID=654332
ArticleTitle= SmartCloud tip: Deploy products using rapid deployment service
publish-date=04292011