Previous topic

Integration with Service User Control Panel

Next topic

Application Provisioning

DOCUMENTATION
Last updated 18-May-2016

Application Deployment

Overview

When testing and debugging APS packages on a demo Operations Automation system, you can enable the APS development mode that affects the system in the following way:

  • The system removes the restriction on updating an APS package by another package that has the same application ID.
  • Some of APS related screens will not be cached in web browsers. This allows the developers to see effect of script changes at instance. At the same time, it may delay screen rendering.
  • Operations Automation log will store more details on APS operations.

You can enable this mode on your demo system by these steps:

  1. In the Operations Automation provider control panel, navigate to System > Settings.
  2. In the Core section, click follow the System Properties link.
  3. On bottom of the screen, click the Edit button.
  4. Mark the APS development mode check-box and click Submit to save the setting.

Integration of an application with Service Automation is going through the application APS package, which usually contains the following parts as presented below:

../../_images/pa-deployment-package.png
  • Metadata with general description of the application and the package
  • APS types that will be used for creating APS resources; normally generated by the aps build command from the provisioning scripts
  • Provisioning logic, e.g. PHP scripts, containing definition of each services declared in metadata; also may contain definition of types
  • Presentation logic, e.g. HTML files with with JavaScript, implementing visual and control elements in control panels

Note

Depending on application complexity, the package structure can be more complicated and it can contain much more files.

Initial APS package processing in Service Automation contains the following steps:

../../_images/pa-deployment-steps.png
  1. The whole package must be imported to Operations Automation. APS controller will need general data, definition of types and services for subsequent application configuration and provisioning. Presentation logic will be applied to control panels.
  2. Provisioning scripts must be used for setting the application endpoint. They expose the application services for the APS controller.
  3. Installation of application instance step will initiate the APS controller to configure the application instance through the application endpoint.

On completion of the above steps, the provider will be able to proceed with the following configuration steps:

  1. Setting global resources step is needed when the application requires some parameters to be applied globally to the application resources.
  2. Creating resource types step is a usual deployment step in Operations Automation. APS specifics here is that Operations Automation resource types are bound to APS resources.
  3. For selling application resources, the service plan must be configured appropriately.

Package Import

If you have administration permissions in the Operations Automation system, you can import a package following these steps in the provider control panel.

  1. Navigate to Services > Applications.
  2. Click the Import Package button, then select the local file or provide its URL.
  3. Click Submit to complete the operation.
../../_images/pa-package-import.png

Setting Application Endpoint

Each APS application must expose at least one APS application endpoint, or shorter endpoint, that will be able to receive REST requests from the APS controller. Endpoint deployment requires the following high level steps:

  • Arrange a web server folder and copy all provisioning scripts to it.
  • Provide access to these scripts for the web server.
  • Configure web server.

APS endpoint for an application can be set up in one of two ways.

  • Automatically (highly recommended), using the following methods:
    • For Linux, we provide the automated method, based on the endpoint.sh utility.
    • For Linux, as an alternative way, you can create an RPM package. For example, it is used in the OwnCloud demo package.
    • For Windows, create an installation script using either PowerShell, or *.bat, or *.msi.
  • Manually, following the Manual Setup instructions.

Automated Setup based on endpoint.sh

The application endpoint setting can be fully automated by means of the endpoint.sh utility. If you are working on a sandbox, the utility already exists on the host. When you start it, the utility configures the platform (Apache and SSL), if needed, and then creates the required APS endpoint. The method consists of two steps.

  1. Copy the APS package to the endpoint host.

  2. Use the endpoint.sh utility to setup an APS application endpoint in a specified folder. For example, if you have package Sample_VPS_Cloud-1.0-1.app.zip and need to install an endpoint in the scripts folder /var/www/html/vpscloud, enter the following command:

    endpoint.sh vpscloud Sample_VPS_Cloud-1.0-1.app.zip
    

    The utility will print out the URL for the endpoint, e.g.: https://endpoint.a.isv1.apsdemo.org/vpscloud.

If you need to add some configuration steps after the outlined ealier high level step are over, add the shell script named pre-configure.sh. It must be placed in the endpoint scripts folder. If such script is present, the endpoint.sh script will call it, once the basic configuration is done. Notice that endpoint.sh exports the ENDPOINT_LOCATION variable - path to endpoint scripts folder, where the application provisioning scripts are installed. This variable can be used in pre-configure.sh. Example of pre-configure.sh can be found in VPS Backup demo package.

Manual Setup

When setting endpoint manulally, we need to separate Platform Setup (used once per platform) from APS Endpoint Setup (used per each APS application endpoint installation). This method is not recommended as it is time consuming and prone to mistakes. We provide the details here to help you create one of automated methods.

Platform Setup

The host, on which APS endpoints will be set up for different applications, needs to be configured. To do it on a CentOS Linux, the following steps are needed:

  1. Enable HTTPS and client SSL certificate verification:

    • Install mod_ssl:

      yum install mod_ssl
      
    • In /etc/httpd/conf.d/ssl.conf, uncomment the SSLVerifyClient option and set it to optional_no_ca:

      SSLVerifyClient optional_no_ca
      
    • In /etc/httpd/conf.d/ssl.conf, configure the <Files> section as follows:

      <Files ~ "\.(cgi|shtml|phtml|php3?)$">
          SSLOptions +StdEnvVars +ExportCertData
      </Files>
      
    • Restart Apache:

      service httpd restart
      
  2. If you are going to use the APS PHP runtime framework, make sure the standard PHP package and APS PHP runtime library are installed on the host. For example, verify it as follows:

    rpm -qa | grep php
    

    If one or both of them are not installed, you can use the commands below appropriately:

    yum install php
    
    yum install http://download.apsstandard.org/php.runtime/aps-php-runtime-2.0-353.noarch.rpm
    

    Note

    Pay attention, the runtime version might increase by the time you will do these operations. Please use the URL for the latest version.

  3. Set the AllowOverride All option for the folder that will be the parent of application endpoints. It is usually var/www/html in Apache. For example, in the /etc/httpd/conf/httpd.conf file, find the <Directory “var/www/html”> section and edit the following line:

    AllowOverride All
    
  4. Restart the Apache service:

    service httpd restart
    

APS Endpoint Setup

For setting an APS application endpoint manually, you need to follow these steps.

  1. Create the application endpoint folder. For instance, the /var/www/html/vpscloud folder will be used in following steps.

  2. Copy all provisioning scripts, i.e. PHP and other files from the scripts folder of the package to the application endpoint folder, i.e. to /var/www/html/vpscloud/ in our example.

  3. Make sure the user apache is the owner of the endpoint folder and all its contents:

    chown -R apache:apache /var/www/html/vpscloud
    
  4. Set redirect from each URL that exposes an application service to the PHP file that implements the service. For example, if in metadata you declared four different services named clouds, offers, contexts, and vpses, you will probably have cloudes.php, offers.php, contexts.php, and vpses.php files. The redirect is configured by creating the .htaccess file just inside the vpscloud folder with the following content:

    Options +FollowSymLinks +ExecCGI
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /vpscloud
    RewriteRule ^clouds(|/.*)$ clouds.php?q=$1 [L,QSA]
    RewriteRule ^contexts(|/.*)$ contexts.php?q=$1 [L,QSA]
    RewriteRule ^offers(|/.*)$ offers.php?q=$1 [L,QSA]
    RewriteRule ^vpses(|/.*)$ vpses.php?q=$1 [L,QSA]
    </IfModule>
    
  5. Restart the Apache service:

    service httpd restart
    

Application Instance Installation

Installation of the APS application instance in Operations Automation is needed to establish the secured connection between the APS controller and the application. During this process, the APS controller must generate an application certificate for the application and send it to the application instance through the application endpoint. The provider should do this operation in the Operations Automation provider control panel following these directions:

  1. Open the imported APS package and switch to the Instances tab.
  2. Click the Install button.
  3. In the Application API end-point URI field, enter the application endpoint URL that must address to the endpoint root folder. In our example, it must be similar to https://<endpoint_domain_name>/vpsclouds/.
  4. Enter, if needed, application connection parameters, e.g. IP address of the cloud application host, login, and password.
  5. Complete the operation.

Setting Global Resources

Global resources are shared for all customers. For example, they can be used for offering a number of possible configurations from which customers can choose whichever is better for them when purchasing a resource as demonstrated at Custom Resource Relations. Suppose, our demo package allows the provider to create a number of VPS offers (Platinum, Premium, and Starter offers) in order customers can select them when purchasing VPSes. For example, a customer can purchase 15 VPSes, two of them will be based on the Platinum offer, three on Premium, and ten on Starter.

To create an offer, the provider should go through the following steps in the Operations Automation provider control panel:

  1. Open the application instance screen and switch to the Samples tab.

    Note

    Such a tab will appear if the custom UI in the package contains the Samples item in the declared navigation tree and a UI view element presenting the Samples tab.

  2. Create the needed number of offers using custom UI.

Creating Operations Automation Resource Types

Operations Automation contains APS resource classes used for presenting different APS resources as explained in the table:

APS Component Operations Automation Resource Class Example in Diagram Description
Application Application Service Reference cloud APS application instance related to all other resources.
Global Resource Application Service Reference offer APS resources with global settings. They must relate to Application.
Resource Type Application Service context, vps APS resources owned by an account or end-user.
Resource Counter Application Counter CPU cores, Memory Counter of an application resource consumption.

The table helps providers to correctly select the Operations Automation resource class when creating a list of needed Operations Automation resource types. Application Counter class actually is presented with its modifications that should be selected depending on the unit of measure used by the resource counter:

  • Application Counter (KB) maps with APS resources counters measuring resource usage in Bytes, KBytes, MBytes, etc. It is suitable for memory and storage counters.
  • Application Counter (unit) maps with unit counters, e.g. with counters of CPU cores or mailboxes.
  • Application Counter (MHz) is suitable for counters of CPU power.

To create a resource type in Operations Automation, providers goes through the following general steps:

  1. Open the application package and switch to the Resource Types tab.
  2. Click Create and select the Operations Automation resource class in accordance with the table.
  3. Assign a name to the resource.
  4. Select the proper APS type. When creating the Application resource, you need to select the application instance.
  5. Complete the operation.

The provider needs to repeat the outlined process until all needed resources are created.

Note

The resource providing management context for customers must have the Autoprovisioning attribute marked.

Creating Operations Automation Service Template

All resources created in the previous step the provider usually includes into the service template that will be used for provisioning the application services to customers. Service providers follow these steps in the Operations Automation control panel to create the needed service template (ST).

  1. Navigate to Products > Service Templates and click Add New Service Template.

  2. Enter the ST name, e.g. Cloud VPS Services, mark the Autoprovisioning box, make sure Custom is selected in the drop-down Type list, and click Next.

  3. Select all APS related resource that were created at the previous step. Probably, the application needs some other resources, e.g. DNS hosting. Add them as needed, and then click Next.

    Note

    If you missed any resources at this step, you can easily add them later, after the ST is created.

  4. Set resource limits keeping in mind the following key points:

    • The subscription should provide only one application instance and one management context.
    • The limits for the other resources should be set following commercial reasons.
    • The limits set in the ST can be overridden by resource rates in the service plan based on this ST.
  5. Save the ST, and then activate it by clicking the Activate button.

Our demo application is presented with the following Operations Automation service template:

../../_images/pa-deploy-st.png

In accordance with this ST, the total number of virtual servers is unlimited. However, a subscriber cannot create more than 15 servers, as the total limit on the number of VPS configurations (offers) that the customer can select is 2+3+10=15. Still, please keep in mind that the limits can be overridden in a service plan based on this ST.