cloudsoft.io

AMP Cluster Tutorial

This tutorial will guide you through a using AMP Cluster for the first time. Firstly we will start the blueprint, then launch, search for and control a managed application.

Set-up and Prerequisites

AMP Cluster requires an AMP Server 5.0 or higher from which to run. This will be called the “Overseer AMP”.

You will also need two items from the extras folder that comes with the full AMP distribution:

  • the AMP Cluster bundle of blueprints
  • the AMP Cluster API server JAR file

The AMP Cluster bundle must be installed into the Overseer AMP. You can do so using br.

For example, in the following snippet the expected output returned by br when the amp-cluster-bundle-1.1.0-20190320.1101.jar is added to the catalog is depicted:

$ br catalog add amp-cluster-bundle-1.1.0-20190320.1101.jar
Installed AMP catalog bundle io.cloudsoft.amp.cluster.amp-cluster-bundle:1.1.0-20190320.1101 with ID rnzophj562 [376]
* amp-cluster-worker-node:1.1.0-20190320.1101
* amp-worker-ha-group:1.1.0-20190320.1101
* amp-cluster-deployment-workerless:1.1.0-20190320.1101
* amp-cluster-worker-pool-single-overseer:1.1.0-20190320.1101
* amp-local-overseer:1.1.0-20190320.1101
* amp-cluster-deployment:1.1.0-20190320.1101
* amp-cluster-api-server:1.1.0-20190320.1101
* amp-worker-pool:1.1.0-20190320.1101
* amp-cluster-worker-node-single-overseer:1.1.0-20190320.1101
* amp-deployment:1.1.0-20190320.1101

More details about installing an AMP Cluster can be found in this section.

The second of these must be placed online at a URL from which the deployment will be able to download. (This will be passed as clusterapi.download.url when “Starting the Cluster” below.)

The AMP server RPM must also be placed online at a URL from which the deployment will be able to download. (This will be passed as amp.download.url when “Starting the Cluster” below.)

This tutorial also assumes that you have the amp-cluster CLI installed. This can be found within the “CLI download” module in the AMP server UI. It is compatible with Windows, OS X, and all major Linux distributions.

In the examples in this tutorial, tokens in CAPITALS are intended to be replaced.

Starting the Cluster

To launch an AMP Cluster, deploy the following YAML at the Overseer AMP, with the items LOCATION and ‘URL replaced as appropriate, and each PASSWORD` items replaced with a secure token of your choice (these can be different).

location: LOCATION
name: My AMP Cluster
services:
- type: amp-cluster-deployment
  brooklyn.config:
    clusterapi.download.url: URL
    amp.download.url: URL
    clusterapi.username: user
    clusterapi.password: PASSWORD
    amp.username: admin
    amp.password: PASSWORD
    couchdb.password: PASSWORD

Logging in

Once the cluster has started you can log in using the CLI. First get the amp cluster endpoint. This can be found by using the AMP UI to get the value of the sensor “cluster.rest-api.mapped.public” on the root of “My AMP Cluster” just deployed, or via the CLI with:

br apps
# note the ID of the "My AMP Cluster" application listed above, call it ID_OF_APP
br app ID_OF_APP sensor cluster.rest-api.mapped.public
# this will print out HTTP://CLUSTER_REST_API/ if all went smoothly

After you can use the amp-cluster CLI to login

amp-cluster login HTTP://CLUSTER_REST_API/ user PASSWORD

Adding a location to the catalog

After logging in you are able to use the full suite of amp-cluster CLI commands. In this tutorial we will update the catalog and then deploy an application.

For example, first add a location to the catalog. Create a file such as LOCATION1.bom:

brooklyn.catalog:
  version: "1.0"
  itemType: location
  items:
  - id: LOCATION1
    item:
      type: jclouds:aws-ec2
      brooklyn.config:
        region: us-east-1
        identity: AKXXXXXXXXXXXXXXXXxx
        credential: XXXXXXXXXXSECRETXXXXXXXXXXXXXXXXXXXXXXXXx

Run this command to make this location available at all workers:

amp-cluster catalog add LOCATION1.bom

This works equivalently for adding blueprint BOMs, although it does not currently accept bundles. The Cluster API takes care of ensuring the catalog is up to date at existing worker AMPs and new worker AMPs that come online.

Deploying an application

Next, create a blueprint file, such as TOMCAT.yaml:

name: My Tomcat Test
location: LOCATION1
services:
  - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer

Then use the CLI to deployit:

amp-cluster deploy TOMCAT.yaml

You should see output such as:

Id:           | d1rzrw4aor
Worker AMP:   | http://10.112.1.139:8081

This gives you the ID of the deployed application and the endpoint of the Worker AMP which is managing the application.

Listing Applications

To list the running applications you can execute a CLI command

amp-cluster applications Which will return a list of the running applications in the following form

Id           | Worker AMP
d1rzrw4aor   | http://10.112.1.139:8081
ee2hvib9pd   | http://10.112.1.139:8081

Further Interaction

To interact with an application further, navigate to the Worker AMP which is managing the application.

This can be done in a browser to interact through the UI, via the REST API (with an endpoint of the form http://10.112.1.139:8081/v1/application/d1rzrw4aor for the above example), or with the br CLI (after running br login http://10.112.1.139:8081 admin PASSWORD).