cloudsoft.io

Writing Application Blueprints

Introduction

While the Composer makes it simple to create many blueprints following common patterns, there are time when you’ll want to do more: enter the YAML blueprinting language.

Under the covers, the AMP Composer produces blueprints in the popular open-source Cloudsoft AMP YAML format, a dialect of OASIS CAMP. This format is easy to work with and extremely powerful. On any blueprint in the Composer, you can switch to the YAML tab to see and edit the YAML code.

This section describes how to work with this underlying blueprinting language.

Bear in mind the Composer also supports switching from YAML to the visual editor, so you can switch between writing in YAML and composing graphically.

YAML Syntax Overview

The rudiments of the YAML syntax for blueprinting are as follows:

name: simple-appserver
location: localhost
services:
- type: org.apache.brooklyn.entity.webapp.jboss.JBoss7Server

In case you’re not familiar with YAML, it’s a format for writing lists and maps, intended to be good both for people and computers to use. Extensive detail on YAML is available at yaml.org, but the key things to note are that:

  • Spacing matters: indentation determines whether items are part of the same list or map
  • Map entries are written key: value, and the first letter of the keys have to align
  • List entries are prefixed with a -, as in - value, again with the hyphens aligning
  • The values of map entries or list entries can be words on the same line, or they can be further maps or lists written on multiple lines, as you’ll see in many of the examples
  • Comments can be included, starting with a # character

So to read the Cloudsoft AMP YAML blueprint above, we have:

  • A name for the application
  • A location where it should be deployed
  • The services which comprise the blueprint, as a list of maps

The services block is the core of the definition. Each map in the list should include a type and optionally various parameters, policies, and other configuration elements.

More detail is covered in the following sections, with the tutorials being an excellent way to get started.

Read More