cloudsoft.io

Add an Application to Catalog (CLI)

Objectives

In this tutorial we will show you how to use the br command line utility to add an entry to the AMP catalog.

Pre-requisites

This tutorial assumes you have installed Cloudsoft AMP, and the AMP CLI (see the Tour of AMP CLI).

Instructions

Adding to the catalog

To add an application to the AMP catalog we start by defining a blueprint in YAML. Here we’ll make use of the following blueprint containing a Compute and a SoftwareComponent node.

tosca_definitions_version: tosca_simple_yaml_1_3

metadata:
  template_name: tosca-demo-0
  template_version: 1.0.0-SNAPSHOT

topology_template:
  node_templates:
    a_server:
      type: tosca.nodes.Compute
    a_software:
      type: tosca.nodes.SoftwareComponent
      requirements:
        - host: a_server

To add this to the catalog, save the file in a suitable directory, navigate to the directory, and run:

br catalog add .

The CLI will automatically ZIP the directory to create the TOSCA CSAR archive which is sent and installed at the server.

You can of course also install a CSAR ZIP directly, either one you have built or one you have access to, by supplying the path or URL to the ZIP as the argument to add, instead of the . (which means to use the current working directory):

br catalog add https://your.url/csar.zip

To add an application to the AMP catalog we start by defining a blueprint in YAML. Here we’ll make use of the MachineEntity entity which is used to provision and manage a machine.

brooklyn.catalog:
  version: 0.2.1-SNAPSHOT
  publish:
    description: Entities to deploy and manage Apache Spark nodes and clusters using Cloudsoft AMP
    license_code: Apache-2.0
    overview: README.md
    reference: catalog/reference.json
  items:
    - id: machine-entity
      name: Machine Entity
      description: A simple entity for deploying and managing a VM
      iconUrl: http://brooklyn.apache.org/style/img/bridge.png
      itemType: template
      item:
        services:
          - type: org.apache.brooklyn.entity.machine.MachineEntity

To add this to the catalog, save the file somewhere suitable and add it using the following command:

br catalog add ./machine-entity.bom

or use a URL directly:

br catalog add https://raw.githubusercontent.com/brooklyncentral/brooklyn-spark/master/catalog.bom

You can also install a ZIP file or directory (including .) provided that the ZIP or directory contain a catalog.bom descriptor.

Viewing the catalog

To view the applications that have been added to the catalog, simply go to the Catalog module, Applications tab within the AMP web console, or using the CLI:

br catalog list application

Note: To view entities rather than applications, change the type (location and policy are also available):

br catalog list entity

Summary

This add-catalog command is just one example of how an operation that can be carried out via the GUI can also be accomplished from the command line. Most AMP operations have command line support, see the usage guide and reference for more information.

Next