Provisioning GlassFish V2 with N1SPS (Part 2) - Automation


Introduction

In my previous blog I discussed about how to Provision the GlassFish V2 Application Server with the Application Server Plugin 6.0 for N1 Service Provisioning System (N1SPS).

Here we will see how to use the N1SPS Command Line Interface (CLI) to automate the Application Server Plugin (AS Plugin) tasks.

What is scriptable

There are several sub tasks in the AS Plugin (for ex., see the below figure for Resource tasks) and you can potentially call any of them from a script using the N1SPS CLI. Lets run through a couple of scenarios to see how this can be achieved.


Click to Enlarge

Where do I start

Well I assume you have the following already
  • Master Server of N1SPS installed and configured
  • Remote Agent of N1SPS installed and configured
  • Command Line Interface for N1SPS installed
  • Application Server Plugin 6.0 for N1SPS imported
You can download all of the above for free here. Note that Application Server Plugin 6.0 is scheduled for release on 10/01/07, thats when they will be available for free at the previously mentioned site.

Once you have all the above, you are ready to write your own script to call into any Application Server Plugin tasks.

Scenario I (Installing Application Server)

Lets try out a scenario, to believe on how easy it could be to write our own script. Lets take a look at the 'Installation of Application Server'. The bits for the Sun Java System Application Server 9.1, Productized version (from Sun) of Glassfish V2 ([1],[2])), can be downloaded for free here.

The script is written using ANT. Read through and please find the additional details after the snapshot. The script (text) file can be downloaded here.



Note that the ${folderName} refers to the user defined folder created either from the N1SPS GUI or CLI. The plan would look like the following.

<?xml version="1.0" encoding="UTF-8"?>
<!-- generated by N1 SPS -->
<executionPlan xmlns='http://www.sun.com/schema/SPS' name='AppServerInstall-install-appserver' versi
on='6.0' description='Plan to invoke install procedure default for component AppServerInstall' xmlns
:xsi='http://www.w3.org/2001/XMLSchema-instance' path='@folder-name@' xsi:schemaLocation='http://www
.sun.com/schema/SPS plan.xsd'>
        <simpleSteps limitToHostSet='com.sun.appserv#SupportedHS'>
                        <install blockName='default'>
                                <component name='AppServerInstall' path='/com/sun/appserv' version='1.0'></component>
                        </install>
        </simpleSteps>
</executionPlan>

Its very easy to get a sample plan, just try out the scenario that you are interested in (say create-domain) from GUI and you will see at the very top the generated plan ID (There is always a plan generated for every operation you perform). Once you have that plan ID, you need to run the following CLI command to checkout the generated plan

cr_cli -cmd pdb.p.co -u admin -p <mypassword> -plan <plan-ID>

The output of the above command shows the actual plan in xml format. Customize the generated xml plan for your needs.
To recap we did the following in the script
  • Check-in the plan
  • Add the component variable (set)
  • Run the plan
  • Wait until the plan is completely run
  • Verify with asadmin if above steps succeeded
  • Delete the component variable
Now you have your own script to install the application server. Lets go through the second scenario.

Scenario II (Deleting a domain)

Following scenario shows the script which will delete the domain using the N1SPS CLI.
Read through and please find the additional details after the snapshot. The script (text) file can be downloaded here.



As mentioned writing a plan is pretty easy, get the generated plan from GUI and customize it.
We did the following steps in the script
  • Check-in the plan
  • Run the plan
  • Wait until the plan is completely run
  • Verify with asadmin if above steps succeeded
  • Delete the earlier checked-in plan

Where to get more information

N1SPS CLI Manual
Application Server N1SPS Plugin - Blogs and Resources



Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

bloggerprashanth

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today