cloudsoft.io

Get AMP Running

Objectives

The following steps will walk you through deploying a simple Tomcat application using Cloudsoft AMP.

There are two methods of deployment detailed in this tutorial, firstly using virtualization with Vagrant and then installing AMP on AWS.

To get you up-and-running quickly, the Vagrant option will provision four compute nodes for you to deploy applications to.

Pre-requisites

None! This tutorial takes you from a fresh start to an AMP with a deployed application.

System Requirements

Server Specification

The size of server required by Cloudsoft AMP is determined by a variety of factors:

  • The number of entities and Virtual Machines (VMs) being managed
  • The number of VMs being deployed concurrently
  • The amount of management and monitoring required per entity

For development and testing or when there are only a handful of VMs being managed, a small VM is sufficient. For example, an AWS m3.medium instance with one vCPU, 3.75GiB RAM and a 4GB disk.

For larger production uses, a more appropriate machine specification would be two or more cores, at least 8GiB RAM and 100GB disk. The disk is just for logs, a small amount of persisted state, and any binaries for custom blueprints/integrations.

Instructions

The instructions below guide you through the following steps:

  • Install pre-requisites of Cloudsoft AMP
  • Install AMP
  • Configure AMP
  • Run AMP
  • Set up an AWS or BYON location
  • Deploy a simple Tomcat app
  • Undeploy

Install Cloudsoft AMP

Vagrant is a command line utility which acts as a wrapper around virtualization software such as Oracle VirtualBox to automate the creation and configuration of local development environments. We recommend its use when following these Cloudsoft AMP tutorials.

First, download and install:

If you are running on Windows, you’ll also need: * Cygwin * rsync and openssl Cygwin packages

Be sure to select these Cygwin packages when running the Cygwin installer. If you already have Cygwin installed, simply re-run the setup executable and follow the installation prompts to install the necessary packages.

Then clone and cd into the cloudsoft/amp-vagrant repository:

$ git clone https://github.com/cloudsoft/amp-vagrant.git
$ cd amp-vagrant

You will need Java or JDK (version 8) installed.

From Downloads, please download the .rpm package.

sudo yum -y update
sudo yum -y install cloudsoft-amp-karaf-4.0.0-xxxxxxxx-noarch.rpm

replacing xxxxxxxx with the appropriate value from the filename of your download.

This will install the AMP binaries in /opt/amp, and start AMP using the appropriate service management tool for your system (e.g. upstart).

You will need Java or JDK (version 8) installed.

From Downloads, please download the .deb package.

sudo apt-get update
sudo apt-get install -y default-jre-headless
sudo dpkg -i cloudsoft-amp-karaf-4.0.0-xxxxxxxx-all.deb

replacing xxxxxxxx with the appropriate value from the filename of your download.

This will install the AMP binaries in /opt/amp, and start AMP using the appropriate service management tool for your system (e.g. systemd).

You will need Java or JDK (version 8) installed.

From Downloads, please download the tar.gz archive.

Extract the tar.gz archive and navigate into the expanded cloudsoft-amp-karaf-4.0.0-20160830.1700 folder.

$ tar -zxf cloudsoft-amp-karaf-4.0.0-20160830.1700.tar.gz
$ cd cloudsoft-amp-karaf-4.0.0-20160830.1700

Launching and Stopping AMP

$ vagrant up amp

You can check if AMP has launched successfully with the command:

$ vagrant ssh amp --command 'sudo systemctl status amp'

The application logs can be tailed using:

$ vagrant ssh amp --command 'sudo tail -f /var/log/amp/amp.info.log'
$ vagrant ssh amp --command 'sudo tail -f /var/log/amp/amp.debug.log'

Starting BYON Nodes

You can start the BYON nodes with (note that additional nodes can be configured in servers.yaml if desired).

$ vagrant up byon1 byon2 byon3 byon4 byon5

You should now be able to browse to the AMP user interface using the following address http://10.10.10.100:8081/. To learn the credentials or set your own, see Setting Web Credentials.

AMP is managed as a system service using the appropriate tool for your system (e.g. systemd). When the AMP package is installed, the amp service is started for you.

Now, as root (or using sudo), you can monitor AMP’s status, and stop and start it, with the following commands for systemd:

$ systemctl status amp
$ systemctl stop amp
$ systemctl start amp

Configuration can be edited at /etc/amp/.

Logs are written to /var/log/amp/amp.info.log and /var/log/amp/amp.debug.log.

You should now be able to browse to the AMP user interface on port 8081 of the server, such as http://localhost:8081/. To learn the credentials or set your own, see Setting Web Credentials.

AMP is managed as a system service using the appropriate tool for your system (e.g. upstart). When the AMP package is installed, the amp service is started for you.

Now, as root (or using sudo), you can monitor AMP’s status, and stop and start it, with the following commands for upstart:

$ status amp
$ stop amp
$ start amp

Configuration can be edited at /etc/amp/.

Logs are written to /var/log/amp/amp.info.log and /var/log/amp/amp.debug.log.

You should now be able to browse to the AMP user interface on port 8081 of the server, such as http://localhost:8081/. To learn the credentials or set your own, see Setting Web Credentials.

To start Cloudsoft AMP (assuming you are in the cloudsoft-amp-karaf-4.0.0-20160830.1700 directory):

$ ./bin/status amp
$ ./bin/stop amp
$ ./bin/start amp

Configuration can be edited at etc/.

Logs are written to data/log/amp.info.log and data/log/amp.debug.log.

You should now be able to browse to the AMP user interface on port 8081 of the server, such as http://localhost:8081/. To learn the credentials or set your own, see Setting Web Credentials.

  • If you are using the .rpm, .deb or Vagrant install, the path to the files (below), will be /etc/amp
  • If you are using the .tar.gz install, the path to the files (below), will be <YOUR INSTALL PATH>/cloudsoft-amp-karaf

Setting Web Credentials

By default AMP is secured with the following credentials:

Username: admin
Password: password

It is strongly recommended that the default username/password is changed. To do so, edit the file brooklyn.cfg (e.g. sudo vim /path/to/amp/etc/brooklyn.cfg) and set the appropriate values for the brooklyn.webconsole.security properties, e.g. to give the user user1 a password of 12str0ngPa5swor+d:

# Credentials for user 'user1'
brooklyn.webconsole.security.users=user1
brooklyn.webconsole.security.user.user1.password=12str0ngPa5swor+d

Persistence Data

The default location for persistence data for AMP is /.brooklyn/brooklyn-persisted-state.

This can be changed by updating the persistenceDir and persistenceLocation values in the file /etc/org.apache.brooklyn.osgilauncher.cfg.

Add a Location

Locations are the environments to which AMP deploys applications. Most commonly these are cloud services such as AWS, GCE, and IBM Softlayer. AMP also supports deploying to a pre-provisioned network or to localhost (although this is most useful for testing blueprints).

If you are following the Vagrant steps then you can use the provisioned VMs as part of a Bring Your Own Nodes network or you may follow the steps for setting up an AWS-based location. If you have have deployed AMP on Linux then you will need to use a cloud service (i.e. AWS) for the rest of this tutorial.

Start by clicking Location Manager. You will be taken to a page showing the currently configured locations. As this is a fresh install of AMP it is unlikely that you will have any locations configured.

You will be given the choice of 3 location types:

  • Cloud
  • BYON
  • Advanced

Select “BYON”.

Enter the following details as pictured. The password for vagrant is “vagrant”.

Click the “Save” button

To provision to AWS you will need to have an AWS Account. Swap the identity and credential with your AWS account details.

Start by clicking Location Manager. You will be taken to a page showing the currently configured locations. As this is a fresh install of AMP it is unlikely that you will have any locations configured.

Click + Add Location at the top right of the page.

You will be given the choice of 3 location types:

  • Cloud
  • BYON
  • Advanced

Select “Cloud”.

Enter the following details as pictured.

Click the Save button.

Deploy a single VM

We are now going to deploy a Tomcat server with a simple application using the Cloudsoft AMP user interface.

If you have set up an AWS location then AMP will first provision a VM.

If you have set up a Vagrant-based BYON location then AMP will take the first unused VM from the pool that you configured.

Browse to AMP http://localhost:8081/.

Let’s now deploy the Tomcat Server application. Tomcat Server

Depending on your version of AMP, you may find it in the quick launch section; if this is the case, just select it.

If you don’t find Tomcat in the quick launch section though, just click Catalog, then Entities. You can find it there by typing “Tomcat 7” in the “Filter entities” search box. Click it to go to its detail page, then from the Actions pull-down menu select “Deploy”.

Tomcat Deploy

Enter a meaningful name e.g. My Tomcat Server.

In the Location box start typing “My First Location”. It should auto-complete.

The AMP examples provide a simple example WAR that you can use (link below). This file contains the simple, existing Java web application that AMP will deploy and manage.

http://search.maven.org/remotecontent?filepath=org/apache/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.8.0-incubating/brooklyn-example-hello-world-sql-webapp-0.8.0-incubating.war

Copy the link into the wars.root config box.

Tomcat config

Click Deploy.

You should now see a page showing that your Tomcat server is STARTING.

Tomcat Starting

Wait until the Tomcat server is shown as RUNNING (you may need to refresh the page to see this).

Tomcat Running

Click Open in Inspector.

The App Inspector gives you a detailed look into the state of your deployed application. For now, we will just use it to access the web app that we just deployed and then to stop it and tear down the VM we created.

On the left you will see a list of applications that have been deployed. At the moment you should see a single application made up of a single Tomcat Server instance.

Click the Tomcat Server entity.

App Inspector Tomcat Server

Click the sensors tab on the right-hand panel. This will show us data specific to the deployed Tomcat.

Sensors

Use the filter to find the webapp.url sensor. Copy the sensor value (i.e. the web URL) to a new tab or browser window. You should now see the Hello World app that we deployed.

Hello World

Stop Everything

Congratulations - you have now deployed your first application using Cloudsoft AMP.

Let’s now tear it all down. The next steps will stop your Tomcat Server and, if you have provisioned one, destroy your VM.

Return to the App Inspector and click on your top level application (My Tomcat Server).

App Inspector Tomcat App

Click on the Effectors tab.

Click the Invoke button next to the stop effector.

Stop

Click Confirm.

Confirm

Return to the App Dashboard http://localhost:8081/amp-ui-app-dashboard/ via Home –> App Dashboard.

Your Tomcat application should now be STOPPING. Once it has stopped it will disappear from the list of deployed applications (you may need to refresh the page to see this).

Summary

Congratulations! You have successfully used Cloudsoft AMP to deploy, manage and tear down an application.

In this tutorial you covered:

  • Launching AMP
  • Adding a Location - configuring AMP to use the four existing compute nodes (aka "Bring Your Own Node"), which are running as Vagrant VMs, as somewhere AMP can run applications
  • Deploying a simple, existing web application to your configured Location
  • Exploring and using an application's sensor data to get real-time, dynamic information (i.e. the application's URL)
  • Stopping an application
  • Launching AMP
  • Adding a Location - using your AWS credentials to configure an AWS region as somewhere AMP can provision VMs and run applications
  • Deploying a simple, existing web application to your configured Location
  • Exploring and using an application's sensor data to get real-time, dynamic information (i.e. the application's URL)
  • Stopping an application and tearing-down any resources created as part of the deployment (i.e. the underlying VM)

Next