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.
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:
- 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.
- 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.
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.
- 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 usingssh. - Once connected, run the command
sudo bashto 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. - 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
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
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
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
-
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
runlevelcommand 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. - 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.
-
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
- In the first phase, unZIP the ihs.tar which contains the SPiN scripts, then copy all installation packages to the specific directory for SPiN.
- Call a perl script. The role of this script is to set the
webserver-ihs-http-portvariable 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;
- 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
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
To create an instance:
- Select the image from your private catalog.
Figure 6. Select the image
- Provide a name and keys.
Figure 7. Provide name and keys
- Enter the port number.
Figure 8. Enter port number
- 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.
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.
Learn
-
For more on how to perform tasks in the IBM SmartCloud Enterprise:
- Upload and download files from a Windows instance.
- Install IIS web server on Windows 2008 R2.
- Create an IBM Cloud instance with the Linux command line.
- Create an IBM Cloud instance with the Windows command line.
- Extend your corporate network with the IBM Cloud.
- High availability apps in the IBM Cloud.
- Parameterize cloud images for custom instances on the fly.
- Windows-targeted approaches to IBM Cloud provisioning.
-
In the developerWorks cloud developer resources, discover and share knowledge and experience of application and services developers building their projects for cloud deployment.
-
The next steps: Find out how to access IBM SmartCloud Enterprise.
Get products and technologies
-
See the product images
available on the IBM SmartCloud Enterprise.
Discuss
-
Join a cloud computing group on developerWorks.
-
Read all the great cloud blogs on developerWorks.
-
Join the developerWorks community, a professional network and unified set of community tools for connecting, sharing, and collaborating.

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.




