27 Setting Up the JVMaaS Self Service Portal

This chapter describes the procedure to set up the Middleware Self Service Portal for JVM as a Service. It contains the following sections:

27.1 Setting Up the Java Application Service Self Service Portal

The EM_SSA_ADMINISTRATOR can configure and set up the JVM Cloud Self Service Portal by creating middleware pools, setting up quotas, defining request settings, creating service templates, and configuring chargeback.

To set up the Java Application Service, follow these steps:

  1. Set up one or more PaaS Infrastructure zones. See Section 11.2.2.1, "Creating a PaaS Infrastructure Zone" for details.

  2. Create a Middleware Pool. See Section 25.2, "Creating a Middleware Pool".

  3. Configure request settings. See Section 25.4, "Configuring Request Settings".

  4. Define quotas for each self service user role. See Section 25.5, "Setting Up Quotas".

  5. Create service templates. See Section 27.4, "Creating a Service Template Based on Java Applications Profile".

  6. Optionally, you can configure the Chargeback Service. See Section 25.7, "Configuring Chargeback".

27.2 Creating a Customized Middleware Profile

For creating your own custom profile, you must create an XML file with all the mandatory and the optional parameters. This is explained using the following example which describes how to create a profile for the tomcatService.

  1. Enter all the mandatory details required to define the profile like Internal Name, Owner. You can additionally provide a display name and a short description about your profile. Next, you must provide the platform information, the product list, a display name for the product, and so on:

    <?xml version="1.0"?>
    <mw:profile xmlns:mw="http://xmlns.oracle.com/mw/profile"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://xmlns.oracle.com/mw/profile ../../../../../../../../FmwProvisioningPojo/src/oracle/sysman/fmw/provisioning/pojo/profile/genericProfile.xsd"
                name="TomcatProfile4" vendor="Oracle" version="1.0"
                content="softwareOnly">
      <mw:displayName>
        Tomcat As A Service with Free Ports 
      </mw:displayName>
      <mw:description>
        Profile for Provisioning single Node Tomcat Server with Bundled Application.
      </mw:description>
     
      <mw:platformInfo os="Linux" platform="x86-64" platformId="226"/>
      <mw:products>
        <mw:product name="Tomcat" version="10.3.6.0">
          <mw:displayName>
            Tomcat Bundled With Application
          </mw:displayName>
        </mw:product>
      </mw:products>
    
  2. Each services instance that is provisioned using this profile will be provided with free ports. These can be used as desired by the profile. You must provide values for: -PORT_RANGE_START, PORT_RANGE_END, and PORTS_COUNT.

    PORT_RANGE_START and PORT_RANGE_END defines the range of the port values to be specified. If you do not specify anything, by default, 2000 and 3000 is considered respectively.

    PORTS_COUNT defines the number of ports required by the service. If not defined, no ports will be allotted to the service.

    <mw:properties>
        <mw:stringProperty name="PORT_RANGE_START" value="2000"/>
        <mw:stringProperty name="PORT_RANGE_END" value="3000"/>
        <mw:stringProperty name="PORTS_COUNT" value="3"/>
      </mw:properties>
    
  3. Actions defined in the profile XML file like Provision, Start, Stop, and Delete will be performed at different phases of the service instance life cycle.

    • The Provision action determines how the service instance is created the first time. The software setup and configuration is performed as a part of this step. Importantly, you must define the following parameters here:

      • Payload: The actual application that is part of the profile.

      • Procedure: The variables that are dynamically replaced at runtime.

    • The Start action defines how the software that is provisioned is started.

    • The Stop action defines how the software that is provisioned is stopped.

    • The Delete action deletes the service instances. The cleanup actions are performed as part of this step.

    Provision: This action provisions your application in Enterprise Manager.

    <!-- [Mandatory] Action list -->
      <mw:actions default="provision">
          <mw:action name="provision" retryFrom="first">
          <!-- [Optional] Display name and description -->
          <mw:displayName>
            Provision Tomcat Server
          </mw:displayName>
          <mw:description>
            This action provisions only the Oracle Home from the profile.
          </mw:description>
          <!-- [Mandatory] Define the complete command including the executable and parameters -->
          <!-- EL is supported, variables can be taken from 3 sources: env, procedure and profile -->
          <mw:command name="createDirectory" executable="mkdir"  errorMode="continue">
                <mw:param value="-p"/>
            <mw:param value="#{procedure.STAGING_DIRECTORY}" required="true"/>       
          </mw:command>           
          <mw:command name="unpack" executable="#{procedure.JAVA_HOME}/bin/jar" directory="#{procedure.STAGING_DIRECTORY}">
            <mw:param value="-xvf"/>
            <mw:param value="#{payload:tomcat_app.jar}" required="true"/>
            </mw:command>
          <mw:command name="configure" executable="/bin/sh" directory="#{procedure.STAGING_DIRECTORY}">
            <mw:param value="#{payload:fixpath_tc.sh}" required="true"/>        
            <mw:param value="#{procedure.FREE_PORTS}"/>
             <mw:env name="SERVICE_HOME" value="#{procedure.STAGING_DIRECTORY}" />
          </mw:command>
        </mw:action>
    

    As a part of the Provision step, you must create the service.out file at the staging directory, and the file must define the variables jvm_jmx_port and jvm_service_console_url.

    For example, in the above XML file, there is a shell script called fixpath_tc.sh which prints the jvm_jmx port and the jvm service URL. The contents of the script are as follows:

    echo "jvm_jmx_port=${PORT_LIST[1]}" >> $SERVICE_HOME/service.out
     echo "jvm_service_console_url=http://$HOSTNAME:${PORT_LIST[0]}/tc_hello/HelloWorld" >> $SERVICE_HOME/service.out
    

    Note that the service.out file must located in the staging directory. This file contains the values of the variables defined. For example:

    jvm_jmx_port=2610
    jvm_service_console_url=http://blr2201958.idc.oracle.com:2482/tc_hello/HelloWorld
    

    Note: This step is mandatory if you want to discover the Java Application Service target in Enterprise Manager Cloud Console.

    Start: This action starts the provisioned application.

    <mw:action name="start">
          <!-- [Optional] Display name and description -->
          <mw:displayName>
            Start Tomcat Server 
          </mw:displayName>
          <mw:description>
            This action Starts the provisioned Tomcat Server
          </mw:description>
     
          <!-- [Mandatory] Define the complete command including the executable and parameters -->
          <!-- EL is supported, variables can be taken from 3 sources: env, procedure and profile -->
              
          <mw:command name="StartTomcat" executable="/bin/sh"  errorMode="continue" background="true" directory="#{procedure.STAGING_DIRECTORY}">
            <mw:param value="#{procedure.STAGING_DIRECTORY}/apache-tomcat-7.0.54/bin/startup.sh" required="true"/>        
          </mw:command>
         
        </mw:action>
    

    Stop: This action stops the provisioned application.

        <mw:action name="stop">
              <!-- [Optional] Display name and description -->
          <mw:displayName>
            Start Tomcat Server 
          </mw:displayName>
          <mw:description>
            This action stops the provisioned Tomcat Server
          </mw:description>
          <!-- [Mandatory] Define the complete command including the executable and parameters -->
          <!-- EL is supported, variables can be taken from 3 sources: env, procedure and profile -->
              
            
              
          <mw:command name="stopTomcat" executable="/bin/sh"  errorMode="continue"  directory="#{procedure.STAGING_DIRECTORY}" >
            <mw:param value="apache-tomcat-7.0.54/bin/shutdown.sh" required="true"/>        
          </mw:command>
              
              </mw:action>
              
               <mw:action name="delete">
              <!-- [Optional] Display name and description -->
          <mw:displayName>
            Remove Tomcat Server 
          </mw:displayName>
          <mw:description>
    

    Delete: This action stops and removes the provisioned application.

          </mw:description>
          <!-- [Mandatory] Define the complete command including the executable and parameters -->
          <!-- EL is supported, variables can be taken from 3 sources: env, procedure and profile -->
              
            
              
          <mw:command name="stopTomcat" executable="/bin/sh"  errorMode="continue"  directory="#{procedure.STAGING_DIRECTORY}" >
            <mw:param value="apache-tomcat-7.0.54/bin/shutdown.sh" required="true"/>        
          </mw:command>
          
          <mw:command name="removeTomcat" executable="rm"  errorMode="continue"  directory="#{procedure.STAGING_DIRECTORY}" >
            <mw:param value="-rf"/>
              <mw:param value="#{procedure.STAGING_DIRECTORY}" required="true"/>  
          </mw:command>
              
              </mw:action>
            
      </mw:actions>
    
  4. Discovery of JVM targets in Enterprise Manager is supported by default. To do so, run the oracle.sysman.emas.mwc.jvmaas.discovery.JVMTargetDiscovery script as follows:

     <mw:discovery className="oracle.sysman.emas.mwc.jvmaas.discovery.JVMTargetDiscovery" dpName="JVMDiscovery"/>
    </mw:profile>
    

27.3 Uploading the Middleware Profile to Software Library

To create a profile using the custom XML script that you have created, run the following command:

emcli create_mw_profile -input_file=propertiesXml:"/scratch/profile/genericProfiles/profile/tomcatService.xml"
-host=blr2201958.idc.oracle.com 
-files="/scratch/profile/genericProfiles/profile/tomcat_app.jar,/scratch/profile/genericProfiles/profile/fixpath_tc.sh"

Where,
tomcatService.xml is the input file that describes the characteristics of the profile.
blr2201958.idc.oracle.com is the host target where the stored during provisioning.
tomcat_app.jar and fixpath_tc.sh are the files that have to be uploaded to Software Library.

Once the profile is created, to access the profile, you must log in to Enterprise Manager Cloud Console, and navigate to the Software Library home page. To do so, from Enterprise menu, select Patching and Provisioning, then click Software Library. On the Software Library home page, you will see your new profile under the Middleware Provisioning Generic profile folder. Alternatively, you can run the emcli list_mw_profile command to view the details of your profile.

Note: To list all the parameters used in a particular action of a profile, use the emcli command list_prov_parameters. For example, all the parameters used in the action provision in the tomcatService profile, run the following command:

emcli list_prov_parameters -profile="Middleware Provisioning/Generic Profile/tomcatService"
 -action="provision" 

27.4 Creating a Service Template Based on Java Applications Profile

Prerequisites

  • Create a customized middleware provisioning profile using XML file. See Section 27.2 for details.

    For creating a generic provisioning profile, see Creating Middleware Provisioning Profiles.

  • Upload the profile to Software Library. See Section 27.3 for details.

A Middleware Service Template is a service definition that can be used to provision a service instance on a middleware pool.

Note:

You can edit a service template that has active instances and modify the configuration parameters. When a service template is modified:
  • New instances created after the changes have been made will use the new parameters.

  • Old instances or instances created before the template was modified will use the earlier values.

  • Changes made to zones and roles will be applicable to both old and new instances.

To create a Java Applications Profile, follow these steps:

  1. Log into Enterprise Manager as an user with the EM_SSA_ADMINISTRATOR role.

  2. From the Enterprise menu, select Cloud, then select Cloud Home. The Cloud Home page appears.

  3. From the Oracle Cloud menu, select Setup, then select Getting Started. The common tasks that need to be performed before setting a specific service family are displayed. Click the Setup link next to Middleware service family in the left panel.

  4. Select Java Application Service from the drop down menu, and then click Service Template.

  5. On the Java Application Service: Service Templates page, click Create.

  6. Enter a name and description for the service template. The description must be unique and provide information on the type of service template being created.

  7. Select the Java Application Profile that you want to use to create the template. Click the search icon, from the Select Software Library Component dialog box, select the template and click Select.

  8. Click Next. On the Characteristics page, specify the characteristics that will be used to tag and identify the target properties. Service instances created from the template will have the characteristics.

  9. Click Next. In the Create Middleware Service Template: Resource Providers page, click Add to select the Middleware Pool into which that the service instances can be provisioned. The PaaS Infrastructure Zone with which the middleware pool is associated is displayed.

  10. Click Next. On the Configuration page, you can see all the parameters (the name-value pair) defined in the custom XML file with the procedure variable, or as a part of the input.properties file. You can enter a new value or update an existing value for a property using this page. Additionally, features like lock and hide are supported that allow you to lock or hide the value of a parameter, by selecting the corresponding check box on the page for the parameter.

    For example, if you have locked the value of Oracle_INVENTORY in your service template, then at the time of requesting for a service using this template, you will notice that the parameter is read-only and cannot be edited.

    Surrounding text describes configuration.gif.
  11. Click Next. On the Roles page, click Add to select the self service user roles to which this service template will be available. All users belonging to the selected role can use this service template.

  12. Click Next. Review all the information entered, and click Submit. The newly created service template will appear in the Middleware Cloud Self Service Portal Setup: Service Templates page. You can click on the Service Template Name link to view additional details.