SMF Template for Sun Application Server 8.1 (EE)



I've been running a few instances of the Sun Java System Application Server 8.1 Enterprise  Edition in various zones on my laptop. I've been wanting to put them under the Service Management Facility for a while.

The good news is that the Glassfish supports SMF, and Kedar has documented how to create a service manifest using Glassfish. I'm running Application Server 8.1 for it's EE-ness. What I decided to do was download the latest Glassfish bits and create a manifest more-or-less following the steps that Kedar has layed out. I then simply utilized that manifest for Application Server 8.1.

The first step was to generate an SMF script for the DAS. Here's the command line:

# asadmin create-service \\
    --passwordfile /tmp/passwordfile \\
    --name application/das \\
    --type das \\
    /var/opt/SUNWappserver/domains/domain1

Because I am running Nevada build 41, asadmin bombs out with an error saying that only Solaris 10 is supported. Yeah, right, like that's going to stop me :) Since asadmin is a script wrapping a java command, I edited the java command line to include -Dos.version=5.10.

Here's the sample output:

root@sicilian:~/apps/glassfish/bin> svcs das 
STATE          STIME    FMRI
disabled       22:50:11    svc:/application/SUNWappserver/application/das:default

To speed things up, here's the generated manifest, with variables for you to replace in all caps. I accomplished this by running:

# svccfg export application/das > /tmp/das.template.xml

Here's the output:

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
  <service name='application/SUNWappserver/application/das' type='service' version='0'>
    <create_default_instance enabled='false'/>
    <single_instance/>
    <exec_method name='start' type='method' exec='PATH_TO_ASADMIN/asadmin start-domain --user admin --passwordfile PATH_TO_YOUR_PASSWORD_FILE --domaindir PATH_TO_YOUR_DOMAIN_DIR domain1' timeout_seconds='0'>
      <method_context>
        <method_credential user='root' privileges='basic'/>
      </method_context>
      <stability value='Evolving'/>
    </exec_method>
    <exec_method name='stop' type='method' exec='PATH_TO_ASADMIN/asadmin stop-domain --domaindir PATH_TO_YOUR_DOMAIN_DIR domain1' timeout_seconds='0'>
      <method_context>
        <method_credential user='root'/>
      </method_context>
      <stability value='Evolving'/>
    </exec_method>
    <stability value='Evolving'/>
    <template>
      <common_name>
        <loctext xml:lang='C'>Appserver Domain Administration Server</loctext>
      </common_name>
      <documentation>
        <manpage title='Appserver' section='1' manpath='/opt/SUNWappserver/appserver/man'/>
      </documentation>
    </template>
  </service>
</service_bundle>

After replacing the variables, import the service manifest in your host with appserver 8.1 running:

# svccfg import /tmp/das.template.xml
# svcadm enable das

Note that I also have zones  with node agents running. These zones require a different manifest, generated with the following command:

# asadmin create-service \\
    --passwordfile /tmp/passwordfile \\
    --name application/nodeagent \\
    --type nodeagent \\
    /var/opt/SUNWappserver/nodeagents/app1-node-agent

Note that "app1-node-agent" is what I named the node agent in my zone.

# svccfg export application/nodeagent > /tmp/nodeagent.template.xml
 
Here's the manifest, again with variables for you to replace in all caps:

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
  <service name='application/nodeagent' type='service' version='0'>
    <create_default_instance enabled='true'/>
    <single_instance/>
    <exec_method name='start' type='method' exec='PATH_TO_ASADMIN/asadmin start-node-agent --user admin --passwordfile PATH_TO_PASSWORD_FILE --agentdir PATH_TO_NODEAGENT_DIR --startinstances=true YOUR_NODEAGENT_NAME' timeout_seconds='300'>
      <method_context>
        <method_credential user='root' privileges='basic'/>
      </method_context>
      <stability value='Evolving'/>
    </exec_method>
    <exec_method name='stop' type='method' exec='PATH_TO_ASADMIN/asadmin stop-node-agent --agentdir PATH_TO_NODEAGENT_DIR YOUR_NODEAGENT_NAME' timeout_seconds='300'>
      <method_context>
        <method_credential user='root'/>
      </method_context>
      <stability value='Evolving'/>
    </exec_method>
    <stability value='Evolving'/>
    <template>
      <common_name>
        <loctext xml:lang='C'>Appserver Node Agent</loctext>
      </common_name>
      <documentation>
        <manpage title='Appserver' section='1' manpath='/opt/SUNWappserver/appserver/man'/>
      </documentation>
    </template>
  </service>
</service_bundle>

After you replace the variables, import the service manifest on your host running the node agent:

# svccfg import /tmp/nodeagent.template.xml
# svcadm enable nodeagent

It's actually pretty straightforward thanks to the create-service asadmin command.

Good luck!
Comments:

Post a Comment:
Comments are closed for this entry.
About

John Clingan

Search

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