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--xxxxxxxx-noarch.rpm

replacing VERSION 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). (Alternatively rpm -Uvh can be used, and --prefix /custom/install/path/ is supported to install to a different location.)

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 openjdk-8-jre
sudo dpkg -i cloudsoft-amp-karaf--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- folder.

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

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

From Downloads, please download the zip archive.

Extract the zip archive and navigate into the expanded cloudsoft-amp-karaf- folder.

cd cloudsoft-amp-karaf-

Launching and Stopping AMP

$ vagrant up amp

Launching Vagrant for the first time can take a while. When it is finished it will display, in large text, the word “Started” in the console.

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

The AMP host that you have started in Vagrant now needs some nodes to manage and run workloads on. We will create a number of BYON (Bring Your Own Nodes) instances within Vagrant.

You can start the BYON nodes with:

$ vagrant up byon1 byon2 byon3 byon4 byon5

N.B. Additional nodes can be configured in servers.yaml if desired.

You should now be able to login to the AMP user interface (as admin/password) on port 8081 of the server, such as http://localhost:8081/. To set your own credentials 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 login to the AMP user interface (as admin/password) on port 8081 of the server, such as http://localhost:8081/. To set your own credentials 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 login to the AMP user interface (as admin/password) on port 8081 of the server, such as http://localhost:8081/. To set your own credentials see Setting Web Credentials.

To start Cloudsoft AMP (assuming you are in the cloudsoft-amp-karaf- 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 login to the AMP user interface (as admin/password) on port 8081 of the server, such as http://localhost:8081/. To set your own credentials see Setting Web Credentials.

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

bin\status.bat amp
bin\stop.bat amp
bin\start.bat 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 login to the AMP user interface (as admin/password) on port 8081 of the server, such as http://localhost:8081/. To set your own credentials see Setting Web Credentials.

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

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

You will need to restart the AMP instance for the changes to take effect.

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 Microsoft Azure. AMP also supports deploying to a pre-provisioned network or to localhost (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.

Clicking + Add New, 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 New 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 Types. You can find it there by typing “Tomcat 7” in the “Search for bundles or types” box. Click it to go to its detail page, then click the “Deploy” button.

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/1.0.0/brooklyn-example-hello-world-sql-webapp-1.0.0.war

Copy the link into the wars.root config box.

Tomcat config

Click Deploy.

Click on the View link in the notification that appears in the bottom left of the page.

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 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.

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 Inspector and click on your top level application (My Tomcat Server).

Inspector Tomcat App

Click on the Effectors tab.

Click the Invoke button next to the stop effector.

Stop

Click Confirm.

Confirm

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