guide/blueprints/example_yaml/appserver-w-policy.yaml (33 lines of code) (raw):
name: appserver-w-policy
services:
- type: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
brooklyn.config:
cluster.initial.size: 1
dynamiccluster.memberspec:
$brooklyn:entitySpec:
type: org.apache.brooklyn.entity.webapp.jboss.JBoss7Server
brooklyn.config:
wars.root: https://search.maven.org/remotecontent?filepath=org/apache/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.12.0/brooklyn-example-hello-world-sql-webapp-0.12.0.war # BROOKLYN_VERSION
http.port: 8080+
java.sysprops:
brooklyn.example.db.url:
$brooklyn:formatString:
- "jdbc:%s%s?user=%s&password=%s"
- $brooklyn:component("db").attributeWhenReady("datastore.url")
- visitors
- brooklyn
- $brooklyn:external("brooklyn-demo-sample", "hidden-brooklyn-password")
brooklyn.policies:
- type: org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy
brooklyn.config:
metric: $brooklyn:sensor("brooklyn.entity.webapp.DynamicWebAppCluster", "webapp.reqs.perSec.windowed.perNode")
metricLowerBound: 10
metricUpperBound: 100
minPoolSize: 1
maxPoolSize: 5
- type: org.apache.brooklyn.entity.database.mysql.MySqlNode
id: db
name: DB HelloWorld Visitors
brooklyn.config:
creation.script.password: $brooklyn:external("brooklyn-demo-sample", "hidden-brooklyn-password")
datastore.creation.script.template.url: https://github.com/apache/brooklyn-library/raw/master/examples/simple-web-cluster/src/main/resources/visitors-creation-script.sql