cloud application blueprints with apache brooklyn by alex henevald
DESCRIPTION
So you have your cloud running, what now? Extend the devops agility from infrastructure to applications by learning how to use Brooklyn, the Apache-incubating project for application management. Create blueprints for applications to enable one-click deployment into Cloudstack, Docker, localhost, or other targets. Leverage your favourite server management tools, from Bash to Chef. Automatically change the deployment after it's deployed. Attach policies to support scaling, failover, and alerting in the way your application needs. In this session we'll show how with just a few lines of YAML, you can build powerful application blueprints by composing pre-existing components, from polyglot web stacks to big data tools such as Riak. We'll also cover defining new blueprints using custom scripts, configuring machine selection and runtime policies, and managing new locations such as Clocker -- the cloud of docker. About Alex Henevald Alex brings twenty years experience designing software solutions in the enterprise, start-up, and academic sectors. Most recently Alex was with Enigmatec Corporation where he led the development of what is now the Monterey® Middleware Platform™. Previous to that, he founded PocketWatch Systems, commercialising results from his doctoral research. Alex holds a PhD (Informatics) and an MSc (Cognitive Science) from the University of Edinburgh and an AB (Mathematics) from Princeton University. Alex was both a USA Today Academic All-Star and a Marshall Scholar.TRANSCRIPT
![Page 1: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/1.jpg)
Application Management with Apache Brooklyn
Alex Heneveld @ahtweetin CTO & Co-Founder, Cloudsoft Committer, Apache Brooklyn Build-a-Cloud Day Vegas, Oct 2014
![Page 2: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/2.jpg)
© 2014 Cloudsoft Corporation
Mission
2
!!
Simplify application deployment and managementwith composable blueprints,
leveraging the best tools for server config, cloud, and monitoring.
!Apache Brooklyn is the only autonomic open source
multi-cloud application management platform. !
© 2014 Cloudsoft Corporation
![Page 3: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/3.jpg)
Blueprints
The Brooklyn Approach
![Page 4: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/4.jpg)
push-button deployment
The Brooklyn Approach
![Page 5: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/5.jpg)
ongoing management
The Brooklyn Approach
![Page 6: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/6.jpg)
open extensible framework
The Brooklyn Approach
![Page 7: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/7.jpg)
Benefits — Agility
![Page 8: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/8.jpg)
Benefits — Reliability
autonomic management
built-in!
![Page 9: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/9.jpg)
Benefits — Transparency
![Page 10: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/10.jpg)
Benefits — Community
![Page 11: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/11.jpg)
© 2014 Cloudsoft Corporation
Multi-Tier Application — Blueprint YAML
11
services:- type: WebAppCluster brooklyn.config: wars.root: hello-db.war http.port: 8080+ java.sysprops: db.url: $brooklyn:component("db"). attributeWhenReady("database.url")
- type: MySqlNode id: db brooklyn.config: creation.script: hello-db.sql
name: MyWebCluster
![Page 12: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/12.jpg)
© 2014 Cloudsoft Corporation
Multi-Tier Application — Blueprint YAML
12
- type: MySqlNode id: db brooklyn.config: creation.script: hello-db.sql
name: MyWebCluster
policies: - type: AutoScaler sensor: webapp.reqs.sec range: [100,200]
services:- type: WebAppCluster brooklyn.config: wars.root: hello-db.war http.port: 8080+ java.sysprops: db.url: $brooklyn:component("db"). attributeWhenReady("database.url")
![Page 13: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/13.jpg)
© 2014 Cloudsoft Corporation
Multi-Tier Application — Blueprint YAML
13
- type: MySqlNode id: db brooklyn.config: creation.script: hello-db.sql
name: MyWebCluster
policies: - type: AutoScaler sensor: webapp.reqs.sec range: [100,200]
services:- type: WebAppCluster brooklyn.config: wars.root: hello-db.war http.port: 8080+ java.sysprops: db.url: $brooklyn:component("db"). attributeWhenReady("database.url")
location: jclouds:cloudstack:http://10.4.88.16:9999/client/api
![Page 14: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/14.jpg)
© 2014 Cloudsoft Corporation
More Blueprint YAML — Cassandra Cluster
14
name: cassandra-cluster-app!services:- type: brooklyn.entity.nosql.cassandra.CassandraCluster name: Cassandra Cluster brooklyn.config: cluster.initial.size: 5 cluster.initial.quorumSize: 3 provisioning.properties: minCores: 4 minRam: 8192!location: softlayer:sjc01
![Page 15: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/15.jpg)
© 2014 Cloudsoft Corporation
MyWebCluster
15
…
MyWebCluster
ControlledDynamicWebAppCluster
DynamicWebAppCluster
JBoss7Server
NGINX
MySQL
JBoss7Server
Auto Scaler Policy[targets]
© 2014 Cloudsoft Corporation
![Page 16: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/16.jpg)
© 2014 Cloudsoft Corporation 16
Define New Blueprint
public class MyWebCluster extends AbstractApplication implements MyWebClusterConstants { @Override public void init() {!!! // TODO build the application
!!
! }}
Type to enter text
© 2014 Cloudsoft Corporation
![Page 17: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/17.jpg)
© 2014 Cloudsoft Corporation 17
Create App Tier
public class MyWebCluster extends AbstractApplication implements MyWebClusterConstants { @Override public void init() {!!! JBoss7Server web = addChild( EntitySpecs.spec(JBoss7Server.class) .configure(JavaWebAppService.ROOT_WAR, getConfig(WAR_PATH)) );!
! }}
Type to enter
Type to enter text
© 2014 Cloudsoft Corporation
![Page 18: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/18.jpg)
© 2014 Cloudsoft Corporation 18
Configure App Tier
Type to enter
Type to enter text
public class MyWebCluster extends AbstractApplication implements MyWebClusterConstants { @Override public void init() {!!! JBoss7Server web = addChild( EntitySpecs.spec(JBoss7Server.class) .configure(JavaWebAppService.ROOT_WAR, getConfig(WAR_PATH)) .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+")) );
! }}
© 2014 Cloudsoft Corporation
![Page 19: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/19.jpg)
© 2014 Cloudsoft Corporation
Add DB Tier
public class MyWebCluster extends AbstractApplication implements MyWebClusterConstants { @Override public void init() { MySqlNode mysql = addChild( EntitySpecs.spec(MySqlNode.class) .configure(MySqlNode.CREATION_SCRIPT_URL, getConfig(DB_SETUP_SQL_URL)) );! JBoss7Server web = addChild( EntitySpecs.spec(JBoss7Server.class) .configure(JavaWebAppService.ROOT_WAR, getConfig(WAR_PATH)) .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+")) );
! }}
Type to enter
Type to enter text
© 2014 Cloudsoft Corporation
![Page 20: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/20.jpg)
© 2014 Cloudsoft Corporation
Wire up App and DB Tiers
public class MyWebCluster extends AbstractApplication implements MyWebClusterConstants { @Override public void init() { MySqlNode mysql = addChild( EntitySpecs.spec(MySqlNode.class) .configure(MySqlNode.CREATION_SCRIPT_URL, getConfig(DB_SETUP_SQL_URL)) );! JBoss7Server web = addChild( EntitySpecs.spec(JBoss7Server.class) .configure(JavaWebAppService.ROOT_WAR, getConfig(WAR_PATH)) .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+")) .configure(JavaEntityMethods.javaSysProp("brooklyn.example.db.url"), formatString("jdbc:%s%s?user=%s\\&password=%s", attributeWhenReady(mysql, MySqlNode.MYSQL_URL), DB_TABLE, DB_USERNAME, DB_PASSWORD)) );! }}
Type to enter
Type to enter text
© 2014 Cloudsoft Corporation
![Page 21: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/21.jpg)
© 2014 Cloudsoft Corporation
Introduce Elasticity in App Tier
public class MyWebCluster extends AbstractApplication implements MyWebClusterConstants { @Override public void init() { MySqlNode mysql = addChild( EntitySpecs.spec(MySqlNode.class) .configure(MySqlNode.CREATION_SCRIPT_URL, getConfig(DB_SETUP_SQL_URL)) );! ControlledDynamicWebAppCluster web = addChild( EntitySpecs.spec(ControlledDynamicWebAppCluster.class) .configure(JavaWebAppService.ROOT_WAR, getConfig(WAR_PATH)) .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+")) .configure(JavaEntityMethods.javaSysProp("brooklyn.example.db.url"), formatString("jdbc:%s%s?user=%s\\&password=%s", attributeWhenReady(mysql, MySqlNode.MYSQL_URL), DB_TABLE, DB_USERNAME, DB_PASSWORD)) );! }}
Type to enter text
Type to enter text
Type to enter
Type
© 2014 Cloudsoft Corporation
![Page 22: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/22.jpg)
© 2014 Cloudsoft Corporation
Customize Elasticity in App Tier
public class MyWebCluster extends AbstractApplication implements MyWebClusterConstants { @Override public void init() { MySqlNode mysql = addChild( EntitySpecs.spec(MySqlNode.class) .configure(MySqlNode.CREATION_SCRIPT_URL, getConfig(DB_SETUP_SQL_URL)) );! ControlledDynamicWebAppCluster web = addChild( EntitySpecs.spec(ControlledDynamicWebAppCluster.class) .configure(JavaWebAppService.ROOT_WAR, getConfig(WAR_PATH)) .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+")) .configure(JavaEntityMethods.javaSysProp("brooklyn.example.db.url"), formatString("jdbc:%s%s?user=%s\\&password=%s", attributeWhenReady(mysql, MySqlNode.MYSQL_URL), DB_TABLE, DB_USERNAME, DB_PASSWORD)) .configure(DynamicCluster.INITIAL_SIZE, 2) ); }}
Type to enter text
Type to enter text
Type to enter
Type
Type to enter
© 2014 Cloudsoft Corporation
![Page 23: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/23.jpg)
© 2014 Cloudsoft Corporation
Add Policies and KPI’s
public class MyWebCluster extends AbstractApplication implements MyWebClusterConstants { @Override public void init() { MySqlNode mysql = ...; ControlledDynamicWebAppCluster web = ...; web.addEnricher(HttpLatencyDetector.builder().url(ROOT_URL). rollup(10, SECONDS).build());! web.getCluster().addPolicy(AutoScalerPolicy.builder(). metric(REQUESTS_PER_SECOND_IN_WINDOW_PER_NODE). metricRange(10, 100).sizeRange(2, 5).build());! addEnricher(SensorPropagatingEnricher.newInstanceListeningTo(web, ROOT_URL, REQUESTS_PER_SECOND_IN_WINDOW, REQUEST_LATENCY_IN_SECONDS_IN_WINDOW)); }}
Type to enter text
Type to enter text
Type to enter
Type
Type to enter
Type to enter text
© 2014 Cloudsoft Corporation
![Page 24: Cloud Application Blueprints with Apache Brooklyn by Alex Henevald](https://reader034.vdocuments.site/reader034/viewer/2022052412/559513041a28ab84598b45fe/html5/thumbnails/24.jpg)
© 2014 Cloudsoft Corporation© 2014 Cloudsoft Corporation
Test New Blueprint
24