Deployment in Shared Apache Web Space

This method is based on configuring an Apache virtual host for every APS connector.

Setting APS Connector

Deployment of an APS connector for an application requires the following high level steps:

  1. Configure a virtual web server.

  2. Arrange a web server folder and copy the application provisioning scripts to it.

  3. Provide access to these scripts for the web server.

To create a new APS connector, use one of the following method in dependence of the deployment schema you use:

Warning

The first of the above options is used exclusively for testing and training. Do not use them in a production system.

APS Connector on Management Node

In the simplest platform configurations used for testing or training, when there are no separate hosts for APS connectors, you can install an APS connector directly on the OSS management node (MN) to test and debug your APS application.

Warning

1. The script used for automated installation here works only if the MN is installed on the Linux CentOS-7 or later version.

2. The method explained here allows you to have only one APS connector at a time. Every time you run the script provided by this method, you will reinstall the APS connector.

  1. Do not use this method in a production system. This script is provided “AS IS” without warranty of any kind.

To use such an environment, follow these steps:

  1. Copy the prepare-environment.sh file to the management node, for example:

    $ scp prepare-environment.sh root@a.isv1.apsdemo.org:
    
  2. Establish an SSH session with the management node, for example:

    $ ssh root@a.isv1.apsdemo.org
    
  3. On the management node, find the imported package. The latest imported package will be on top of the list printed out by the following command:

    # ls -lt /usr/local/pem/APS/packages/
    

    The name must contain the app.zip extension, for example Generic Services Sample Application-7.1.0-0.app.zip. Copy the name of your package to use it as explained in the next step.

  4. Run the copied script to build an APS connector for your application, for example:

    # sh ./prepare-environment.sh "Generic Services Sample Application-7.1.0-0.app.zip"
    

    If the script runs for the first time on the management node, it installs the required PHP environment including the APS PHP framework.

    The script will print out the APS application endpoint URL, for example:

    https://a.isv1.apsdemo.org:3443/aps-php-connector
    

    Copy this URL to use it during installation of the APS application instance.

APS Connector on Separate Host

When setting an APS connector manually, you need to separate the host setup (used once per host) from the APS connector setup (used per each APS connector installation).

Web Host Setup

The host, on which APS connectors for various applications will be deployed, needs to have a configured web server. To do it on a CentOS Linux, follow these steps:

  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 framework, make sure the standard PHP package and APS PHP runtime 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.2-330.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 Connector Setup

Usually a manual method to set up an APS connector is time consuming and prone to mistakes. We provide the details of the manual method here to help you create your own automated methods and after that we will illustrate an automated method.

Manual Setup

To set an APS connector manually, follow these steps.

  1. Create a folder for the APS connector. For instance, the /var/www/html/vpscloud/ folder will be used in the next steps.

  2. Copy all provisioning scripts, that is PHP and other files from the scripts/ folder of the package to the APS connector folder, that is to /var/www/html/vpscloud/ in our example.

    Note

    The name of the folder will define the APS application endpoint URL. For example, if the host name is endpoint.a.isv1.apsdemo.org and the folder name is vpscloud, then the URL will be:

    https://endpoint.a.isv1.apsdemo.org/vpscloud
    

    Use this URL during the installation of the APS application instance.

  3. Make sure the APS connector folder and all its contents are assigned to the group apache and to the user apache:

    # 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
    

Automated Setup

You can make the process explained in the previous section automated using one of the following methods:

  • For Linux, create and test a script similar to endpoint.sh.

  • For Linux, as an alternative way, you can create an RPM package.

  • For Windows, create either PowerShell, or *.bat script, or *.msi installation file.