websphere cloudburst script packages

Upload: wscloud

Post on 29-May-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 WebSphere CloudBurst Script Packages

    1/23

    2010 IBM Corporation

    Building script packages for theWebSphere CloudBurst Appliance

    Dustin Amrhein ([email protected])

  • 8/9/2019 WebSphere CloudBurst Script Packages

    2/23

    IBM Software Group | WebSphere software

    1

    Agenda

    Script package overview

    Building script packages

    Troubleshooting

  • 8/9/2019 WebSphere CloudBurst Script Packages

    3/23

    IBM Software Group | WebSphere software

    2

    Customizing environments in WebSphere CloudBurst

    Customization comes in three different forms: Custom images (extend/capture)

    Script packages

    Deployment time parameters

    http://www.ibm.com/developerworks/websphere/techjournal/0907_amrhein/0907_amrhein.html

  • 8/9/2019 WebSphere CloudBurst Script Packages

    4/23

    IBM Software Group | WebSphere software

    3

    What is a script package?

    Two main elements

    File (archive, shell script, wsadmin

    script, etc.)

    Execution characteristics

    Execution characteristics provide

    the where/how/when

    Where to place the script package

    on the virtual machine

    How to invoke the script package

    When to invoke the script package

  • 8/9/2019 WebSphere CloudBurst Script Packages

    5/23

    IBM Software Group | WebSphere software

    4

    Different execution modes

    Three different points of invocation for a script package

    Virtual system creation: Invoked once virtual system starts.

    Most common execution mode

    Example: Create a JDBC Data Source

    Virtual system deletion: Invoked during removal of a virtual system.

    Example: Remove IP/hostname from a web server registry.

    User-initiated: Invoked at the users discretion.

    User can invoke multiple times

    Example: Update a deployed application

  • 8/9/2019 WebSphere CloudBurst Script Packages

    6/23

    IBM Software Group | WebSphere software

    5

    Agenda

    Script package overview

    Building script packages

    Troubleshooting

  • 8/9/2019 WebSphere CloudBurst Script Packages

    7/23

    IBM Software Group | WebSphere software

    6

    Different kinds of users require different approaches

    Do you have significant existing scripting resources?

    Package existing scripts into script package form

    No functional changes necessary (especially for wsadmin scripts)

    Main effort is around parameterization of scripts (either adjusting touse env. variables supplied by WebSphere CloudBurst or byparameterizing in the first place)

    Do you have little to no existing scripting resources?

    If you do not want to invest in scripting, Rational AutomationFramework for WebSphere integrated with WebSphere CloudBurst is

    likely the best approach

    Alternatively, novice users can write their own scripts with the rightapproach

  • 8/9/2019 WebSphere CloudBurst Script Packages

    8/23

    IBM Software Group | WebSphere software

    7

    General guideline for script package development

    1. Identify: Identify target topology and configuration

    2. Deploy: Deploy WebSphere CloudBurst pattern that represents targettopology

    3. Develop and Test: Develop and test scripts on virtual machinescreated from step #2 (Command Assistance in WAS v7 makes thiseasy)

    4. Package: Package up resulting scripts and artifacts in script package

    format

    5. Modify and Redeploy: Load script package(s) into appliance, modifypattern, redeploy

  • 8/9/2019 WebSphere CloudBurst Script Packages

    9/23

    IBM Software Group | WebSphere software

    8

    Lets put this iterative process to work

    Target environment and configuration:

    Deployment manager, two custom nodes

    Application server clusters on two custom nodes

    Application installed to cluster

    WebSphere CloudBurst requirements

    Simple pattern for topology and cluster configuration

    Script package to install application

  • 8/9/2019 WebSphere CloudBurst Script Packages

    10/23

    IBM Software Group | WebSphere software

    9

    Creating and deploying the target topology

  • 8/9/2019 WebSphere CloudBurst Script Packages

    11/23

    IBM Software Group | WebSphere software

    10

    Developing and testing the script

    WebSphere Application Server v7 provides a HUGE advantagein this step Command Assistance

    Command Assistance provides the eventual action

    Shown in dialog prior to saving configuration

  • 8/9/2019 WebSphere CloudBurst Script Packages

    12/23

    IBM Software Group | WebSphere software

    11

    Okay, now what?

    AdminApp.install('JaxWSServicesSamples.ear', '[ -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -appname JaxWSServicesSamples -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -MapModulesToServers [["JAX-WS Services Samples Gallery Web Application" SampleGallerySei.war,WEB-INF/web.xml WebSphere:cell=CloudBurstCell_1,cluster=AppCluster_1 ][

    SampleClientSei SampleClientSei.war,WEB-INF/web.xmlWebSphere:cell=CloudBurstCell_1,cluster=AppCluster_1 ][ SampleServicesSeiSampleServicesSei.war,WEB-INF/web.xmlWebSphere:cell=CloudBurstCell_1,cluster=AppCluster_1 ][ SampleMTOMClientSampleMTOMClient.war,WEB-INF/web.xmlWebSphere:cell=CloudBurstCell_1,cluster=AppCluster_1 ][ SampleMTOMServiceSampleMTOMService.war,WEB-INF/web.xmlWebSphere:cell=CloudBurstCell_1,cluster=AppCluster_1 ]] -MapWebModToVH [[ "JAX-WS Services Samples Gallery Web Application" SampleGallerySei.war,WEB-INF/web.xml default_host ]]]'

  • 8/9/2019 WebSphere CloudBurst Script Packages

    13/23

    IBM Software Group | WebSphere software

    12

    Identify parameters for your scripts

    Parameterize based on standard environment variables

    Cell name, node names, cluster names, etc.

    Parameterize based on expected usage

    Decouple application binaries from script package with parameter that

    provides application binaries location

    Parameterize based on expected users

    Operations team: Parameterize the entire installation argumentsconfiguration

    Applications team: Parameterize very basic information (i.e.

    application name)

  • 8/9/2019 WebSphere CloudBurst Script Packages

    14/23

    IBM Software Group | WebSphere software

    13

    Determine script package format

    Script packages can be a simple file or an archive

    For wsadmin scripts, it is helpful to wrap them in shell scripts and

    create an archive

    Shell script passes in arguments to wsadmin script, thus reducing the

    amount of information directly defined in WebSphere CloudBurst

    Shell script can be an orchestrator if multiple other scripts are

    necessary

    Archives also allow you to package cbscript.json definition files

  • 8/9/2019 WebSphere CloudBurst Script Packages

    15/23

    IBM Software Group | WebSphere software

    14

    Shell script calling wsadmin script

    WORKING_DIR=/tmp/installapp

    chmod -R 777 $WORKING_DIRecho APPLICATION_LOCATION = $APPLICATION_LOCATION >

    $WORKING_DIR/installApp.logecho APPLICATION_NAME = $APPLICATION_NAME >> $WORKING_DIR/installApp.log

    CLUSTER_NAME=$WEB_CLUSTER_PREFIX"_1"

    echo CLUSTER_NAME = $CLUSTER_NAME >> $WORKING_DIR/installApp.log

    su virtuser -c "$WAS_PROFILE_ROOT/bin/wsadmin.sh -lang jython -f

    /tmp/installapp/install_app.jy /tmp/installapp/ $WORKING_DIR $CELL_NAME$CLUSTER_NAME $APPLICATION_LOCATION $APPLICATION_NAME"

  • 8/9/2019 WebSphere CloudBurst Script Packages

    16/23

    IBM Software Group | WebSphere software

    15

    The wsadmin script to install an applicationdownloadLoc = sys.argv[1]cellName = sys.argv[2]

    clusterName = sys.argv[3]binURL = sys.argv[4]appName = sys.argv[5]appLocation = copyZip(binURL)

    AdminApp.install(appLocation, '[ -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -appname ' + appName + ' -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall

    warn -noprocessEmbeddedConfig -filepermission

    .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -MapModulesToServers [["JAX-WS Services Samples Gallery Web Application"SampleGallerySei.war,WEB-INF/web.xml WebSphere:cell=' + cellName +',cluster=' + clusterName + ' ][ SampleClientSeiSampleClientSei.war,WEB-INF/web.xml WebSphere:cell=' + cellName +',cluster=' + clusterName + ' ][ SampleServicesSeiSampleServicesSei.war,WEB-INF/web.xml WebSphere:cell=' + cellName +

    ',cluster=' + clusterName + ' ][ SampleMTOMClientSampleMTOMClient.war,WEB-INF/web.xml WebSphere:cell=' + cellName +',cluster=' + clusterName + ' ][ SampleMTOMServiceSampleMTOMService.war,WEB-INF/web.xml WebSphere:cell=' + cellName +',cluster=' + clusterName + ' ]] -MapWebModToVH [[ "JAX-WS ServicesSamples Gallery Web Application" SampleGallerySei.war,WEB-INF/web.xmldefault_host ]]]')

    AdminConfig.save()

  • 8/9/2019 WebSphere CloudBurst Script Packages

    17/23

    IBM Software Group | WebSphere software

    16

    The cbscript.json to define the script package

    [

    {"name": "Install application","version": "1.0.0","description": "This script package

    installs an application","command": "/bin/sh

    /tmp/installapp/installApp.sh","log":

    "${WAS_PROFILE_ROOT}/logs/wsadmin.traceout",

    "location": "/tmp/installapp","timeout": "0","commandargs": "","keys":[

    {"scriptkey": "APPLICATION_LOCATION","scriptvalue": "",

    "scriptdefaultvalue": ""

    },{"scriptkey": "APPLICATION_NAME","scriptvalue": "",

    "scriptdefaultvalue": ""}

    ]}]

  • 8/9/2019 WebSphere CloudBurst Script Packages

    18/23

    IBM Software Group | WebSphere software

    17

    Update pattern and redeploy

    Package the three components into a single archive, load into

    catalog, and refresh

    No user input required due to use of cbscript.json

    Update pattern with the script package and deploy

  • 8/9/2019 WebSphere CloudBurst Script Packages

    19/23

    IBM Software Group | WebSphere software

    18

    Verify the results

  • 8/9/2019 WebSphere CloudBurst Script Packages

    20/23

    IBM Software Group | WebSphere software

    19

    Agenda

    Script package overview

    Building script packages

    Troubleshooting

  • 8/9/2019 WebSphere CloudBurst Script Packages

    21/23

    IBM Software Group | WebSphere software

    20

    And if things dont go as planned

    Standard debugging techniques apply For wsadmin scripts, check PROFILE_HOME/logs/wsadmin.traceout

    For shell scripts, easy to use echo commands to create logs

    Log into virtual machine to collect logs, or download from virtualsystem view in WebSphere CloudBurst

    Collects log you specify in script package definition

  • 8/9/2019 WebSphere CloudBurst Script Packages

    22/23

    IBM Software Group | WebSphere software

    21

    21

    Get started with scripting via the Samples Gallery

    Free sample code to speed up your adoption path

    Sample script packages for common configuration actions

    Sample CLI scripts for useful automation tasks

    Go there now! http://bit.ly/wcaSamplesGallery

  • 8/9/2019 WebSphere CloudBurst Script Packages

    23/23

    IBM Software Group | WebSphere software

    22

    Summary

    Customizations come in different forms in WebSphere

    CloudBurst

    Script package development is an iterative process

    You do not have to be a WebSphere scripting guru thanks to

    Command Assistance feature

    When things do not go as planned, normal debugging

    practices apply