184 DB2 Deployment Guide
Preparing IBM_DB gem and redistributable DB2 ODBC and CLI driver files
You can obtain the IBM_DB2 gem file from any of the methods described in
“Installation procedure for Linux, UNIX, and Windows” on page182. For this
example, we have taken the gem file named ibm_db-0.9.0.gem from IBM Data
Server Client. We have assumed that Ruby, RubyGems, and Rails are installed
on the target system and the user has sufficient read and write permissions to
install IBM_DB gem. We place the IBM_DB gem file under ruby_deploy/gem.
You also have to prepare the DB2 ODBC and CLI driver files. We discuss how to
prepare the redistributable driver files in “Preparing the redistributable driver files”
on page 159. The DB2 ODBC and CLI driver files are also required for deploying
the Ruby application that accesses DB2 databases. In this example, we gather
the required DB2 driver files under ruby_deploy/odbcdrv and zip them in a
package itso_cli.tar.gz.
Preparing the Ruby application package
This step is to identify all the Ruby application files. In real life, the application is
usually under some type of library control system and can be gathered easily. In
our example, we only have a simple Ruby application file itso_rubyapp.rb for
demonstration purpose. We place it under /puby_deploy/bin.
Preparing the deployment package
We create a deployment script, ruby_app_install, to automate the deployment
process. The script copies the application file to a specified path and installs the
gem file. It also extracts ODBC and CLI driver files to specified path and
performs environmental configuration.
Example 4-27 shows the deployment script. There are two command line options
for the scr ipt:
򐂰The flag -p specifies the location where application to be deployed.
򐂰The flag -r registers required system variables.
Example 4-27 Code of script ruby_app_install
#!/usr/bin/ksh
##########################################################################
#
# Deploy application and ODBC CLI driver files to target path
#
# ruby_app_install -p <installpath> -r
#
# -p specify the location where application and ODBC drv files to be deployed
# -r specify to configure system variable for ODBC and CLI driver
#
# example: ruby_app_install -p /home/db2app/myapp -r"