Applications

An application represents a group of software packages, and linked resources, that can be installed on a host. It abstracts the concepts of individual packages, configuration files and services from the user. Instead, the user can focus on deploying a ‘business application’ (e.g. A secure web server) and the underlying system will take care of the rest.

Parameters may be associated to an application, in particular for template rendering.

Representation

The following elements are defined as part of an application representation:

  • name: The name of the application. Cannot be null. Must be unique organization-wide.
  • organization: The name of the organization this application is part of. This field is read-only.
  • description: A human friendly description of the application.
  • packages: The software packages required by this application.
  • files: The files used by this application. This field is read-only.
  • services: The services on which this application depends.
  • handlers: The event handlers executed when installing, removing or modifying the configuration of the application.
  • parameters: The parameters associated to this application. This field is read-only.

Application resources

Package resource

A package resource has the following representation:

  • name: The name of the package to install with the application.

Example:

{
    "name": "mod_ssl"
}

File resource

A file resource has the following representation:

  • name: A name, used to identify the resource in event handlers.
  • path: The full path for the file.
  • mode: The file access mode in Unix digits (see unix command chmod).
  • owner: The user owning the file (see unix command chown).
  • group: The group owning the file (see unix command chgrp).
  • template: The description of a template representing the file.

Example:

{
    "name": "httpd.conf",
    "path": "/etc/httpd/conf/httpd.conf",
    "mode": "644",
    "owner": "root",
    "group": "root", 
    "template": {
        "delimiter": {
            "start": "${"
            "end": "}"
        }
    }
}

Service resource

A service resource has the following representation:

  • name: The name of the service.
  • enabled: Should the service be launched on startup (true) or not (false).

Example:

{
    "name": "httpd",
    "enabled": true
}

Event Handlers

A sequence of actions to perform upon an event.

  • do: A list of actions.
  • on: A list of parameter’s keys that trigger an event when changed.

Each action defines an operation to apply on a resource, for example: update a file, restart a service, etc. Available operations depend on target resource:

  • on files:

    • update: replaces file’s content with rendered data from ComodIT
    • execute: executes the script
  • on services:

    • restart
    • reload
    • start
    • stop

Example:

{
    "do": [
        {
            "action": "update", 
            "resource": "file://httpd.conf"
        }, 
        {
            "action": "restart", 
            "resource": "service://httpd"
        }
    ], 
    "on": [
        "httpd_port"
    ]
}

Example

{
    "name": "WebServer", 
    "organization": "Guardis Test", 
    "description": "Apache web server",
    "parameters": [
        {
            "description": "The httpd port", 
            "key": "httpd_port", 
            "name": "Httpd Port", 
            "schema": {
                "type": "string"
            }, 
            "value": "80"
        }
    ],
    "files": [
        {
            "group": "root", 
            "mode": "644", 
            "name": "httpd.conf", 
            "owner": "root", 
            "path": "/etc/httpd/conf/httpd.conf", 
            "template": {
                "name": "httpd.conf",
                "delimiter": {
                    "start": "${"
                    "end": "}"
                }
            }
        }
    ],
    "packages": [
        {
            "name": "mod_ssl"
        }, 
        {
            "name": "httpd"
        }
    ],
    "services": [
        {
            "enabled": true, 
            "name": "httpd"
        }
    ], 
    "handlers": [
        {
            "do": [
                {
                    "action": "update", 
                    "resource": "file://httpd.conf"
                }, 
                {
                    "action": "restart", 
                    "resource": "service://httpd"
                }
            ], 
            "on": [
                "httpd_port"
            ]
        }
    ]
}

Methods

Collection

/organizations/{org_name}/applications
  • GET: returns all the applications defined in the organization.
  • POST: adds a new application to the organization.

Entity

/organizations/{org_name}/applications/{app_name}
  • GET: returns an existing application.
  • PUT: updates an existing application (read-only fields are ignored).
  • DELETE: deletes an application.

Other

/organizations/{org_name}/applications/{app_name}/_clone?name=new_name
  • PUT: clones an existing application; created application has provided name.

Sub-collections