Skip to content

AMP Clusters

Tony Pujals edited this page Jun 25, 2017 · 9 revisions

Goal

For the 0.13 GA release, AMP will only officially support the following two deployment strategies:

  • LOCAL: local swarm for development
  • BYOC: AWS clusters configured for Docker swarm mode provisioned by AMP using an AWS CloudFormation template

The latter option is basically BYOC ("bring your own cloud"), but only supported for Amazon in this release. The AMP user must supply credentials that authorize the user to create AWS resources. AMP will provision a cluster (called a stack by the AWS CloudFormation template) appropriately configured for Docker swarm mode and AMP.

An AMP user will be able to configure the cluster based on a number of parameters, such as cluster size (the number of managers and workers).

AMP will use container-based plugins that will implement the cluster management strategy. The plugins will support initialize, update, and destroy cluster operations.

The CLI cluster create command will take a --provider option for specifying either local (default) or aws for this release. The cluster update and cluster rm commands will require a specific cluster ID.

Docker Version

The following reflects the goal, but will be updated closer to the release date. 17.06 CE is currently only available as an edge release. The current stable version is 17.03 CE, but 17.06 is the next schedule stable version and is anticipated to be ready soon. It has features, such as config support, that we want to leverage`.

The target Docker version for the cluster environment for this release is 17.06 CE.

The target Docker version for client development environment is 17.06 CE for Linux, Docker for Mac, and Docker for Windows.

Cluster Registry

Whether we provide a private registry for this release is TBD. We provide one for the DinD cluster (not part of this release), but whether it will be available for this release as part of the AWS cluster depends in part on whether we are able to ensure secure access to it as part of our Teams security model. Portus is under consideration as a potential web interface to augment AMP commands/APIs.

AWS Cluster Overview

As an interim strategy pending the evolution and verification of our InfraKit-based provisioning and self-healing infrastructure, I plan to implement simple and straightforward support for deploying an AWS cluster using the Docker for AWS CloudFormation template.

I intend to implement this using the AWS SDK for Go and expose this as part of the AMP CLI cluster create command. The only requirement for using this functionality is that the user must provide credentials for their own AWS account. The user can optionally override the default configuration with command line options or an option file.

The AMP CLI command will essentially mimic the following AWS CLI command for creating a cluster:

$ STACKNAME=demo-stack
$ REGION=us-west-2
$ TEMPLATEURL=https://editions-us-east-1.s3.amazonaws.com/aws/edge/Docker.tmpl
$ KEYNAME=tony-amp-dev
$ MANAGERSIZE=3
$ MANAGERINSTANCE=t2.medium
$ MANAGERDISKSIZE=20
$ MANAGERDISKTYPE=standard
$ WORKERSIZE=2
$ WORKERINSTANCE=t2.medium
$ WORKERDISKSIZE=20
$ WORKERDISKTYPE=standard

$ aws cloudformation create-stack --stack-name $STACKNAME \
--region $REGION \
--template-url $TEMPLATEURL \
--capabilities CAPABILITY_IAM \
--parameters \
ParameterKey=KeyName,ParameterValue=$KEYNAME \
ParameterKey=EnableCloudWatchLogs,ParameterValue=no \
ParameterKey=ManagerSize,ParameterValue=$MANAGERSIZE \
ParameterKey=ManagerInstanceType,ParameterValue=$MANAGERINSTANCE \
ParameterKey=ManagerDiskSize,ParameterValue=$MANAGERDISKSIZE \
ParameterKey=ManagerDiskType,ParameterValue=$MANAGERDISKTYPE \
ParameterKey=ClusterSize,ParameterValue=$WORKERSIZE \
ParameterKey=InstanceType,ParameterValue=$WORKERINSTANCE \
ParameterKey=WorkerDiskSize,ParameterValue=$WORKERDISKSIZE \
ParameterKey=WorkerDiskType,ParameterValue=$WORKERDISKTYPE

General Design

The CLI will use cluster plugins to initialize the target environment, which for this iteration will only be the local host and AWS. Plugins are actually containers that the CLI will run to do the work and should support init, update, and destroy commands along with options appropriate for the target cloud environment.

The CLI will use the cluster create | update | rm commands and pass provider-specific options to the cluster provider plugin. The CLI will provide a --sync option for blocking on completion of a cluster operation.

AWS Plugin

The appcelerator/amp-aws plugin is on Docker Hub. More detailed documentation is available on GitHub.

The plugin supports the following:

Commands

  • init
  • update
  • destroy

Options

  • KeyName
  • EnableCloudWatchLogs
  • ManagerSize
  • ManagerInstanceType
  • ManagerDiskSize
  • ManagerDiskType
  • ClusterSize
  • InstanceType
  • WorkerDiskSize
  • WorkerDiskType