public class MyWebCluster extends AbstractApplication
implements MyWebClusterConstants {

    // TODO build the application

}
public class MyWebCluster extends AbstractApplication
implements MyWebClusterConstants {

    def web = new JBoss7Server(this, war: WAR_PATH);

    {
        web.configure(httpPort: "8080+");
    }

}
public class MyWebCluster extends AbstractApplication
implements MyWebClusterConstants {

    def web = new JBoss7Server(this, war: WAR_PATH);
    MySqlNode mysql = new MySqlNode(this, creationScriptUrl: DB_SETUP_SQL_URL);

    {
        web.configure(httpPort: "8080+");
    }

}
public class MyWebCluster extends AbstractApplication
implements MyWebClusterConstants {

    def web = new JBoss7Server(this, war: WAR_PATH);
    MySqlNode mysql = new MySqlNode(this, creationScriptUrl: DB_SETUP_SQL_URL);

    {
        web.configure(httpPort: "8080+").
          configure(javaSysProp("brooklyn.example.db.url"),
            valueWhenAttributeReady(mysql, MySqlNode.MYSQL_URL, this.&makeJdbcUrl));
    }

}
public class MyWebCluster extends AbstractApplication
implements MyWebClusterConstants {

    def web = new ControlledDynamicWebAppCluster(this, war: WAR_PATH);
    MySqlNode mysql = new MySqlNode(this, creationScriptUrl: DB_SETUP_SQL_URL);

    {
        web.factory.configure(httpPort: "8080+").
          configure(javaSysProp("brooklyn.example.db.url"),
            valueWhenAttributeReady(mysql, MySqlNode.MYSQL_URL, this.&makeJdbcUrl));
    }

}
public class MyWebCluster extends AbstractApplication
implements MyWebClusterConstants {

    def web = new ControlledDynamicWebAppCluster(this, war: WAR_PATH);
    MySqlNode mysql = new MySqlNode(this, creationScriptUrl: DB_SETUP_SQL_URL);

    {
        web.factory.configure(httpPort: "8080+").
          configure(javaSysProp("brooklyn.example.db.url"),
            valueWhenAttributeReady(mysql, MySqlNode.MYSQL_URL, this.&makeJdbcUrl));

        web.cluster.addPolicy(
          new AutoscalerPolicy(DynamicWebAppCluster.AVERAGE_REQUESTS_PER_SECOND).
            setSizeRange(1, 5).
            setMetricRange(10, 100));
    }

}
Cloudcamp scotland - Using cloud without losing control
Cloudcamp scotland - Using cloud without losing control
Cloudcamp scotland - Using cloud without losing control
Cloudcamp scotland - Using cloud without losing control
Cloudcamp scotland - Using cloud without losing control

Cloudcamp scotland - Using cloud without losing control

  • 15.
    public class MyWebClusterextends AbstractApplication implements MyWebClusterConstants { // TODO build the application }
  • 16.
    public class MyWebClusterextends AbstractApplication implements MyWebClusterConstants { def web = new JBoss7Server(this, war: WAR_PATH); { web.configure(httpPort: "8080+"); } }
  • 17.
    public class MyWebClusterextends AbstractApplication implements MyWebClusterConstants { def web = new JBoss7Server(this, war: WAR_PATH); MySqlNode mysql = new MySqlNode(this, creationScriptUrl: DB_SETUP_SQL_URL); { web.configure(httpPort: "8080+"); } }
  • 18.
    public class MyWebClusterextends AbstractApplication implements MyWebClusterConstants { def web = new JBoss7Server(this, war: WAR_PATH); MySqlNode mysql = new MySqlNode(this, creationScriptUrl: DB_SETUP_SQL_URL); { web.configure(httpPort: "8080+"). configure(javaSysProp("brooklyn.example.db.url"), valueWhenAttributeReady(mysql, MySqlNode.MYSQL_URL, this.&makeJdbcUrl)); } }
  • 19.
    public class MyWebClusterextends AbstractApplication implements MyWebClusterConstants { def web = new ControlledDynamicWebAppCluster(this, war: WAR_PATH); MySqlNode mysql = new MySqlNode(this, creationScriptUrl: DB_SETUP_SQL_URL); { web.factory.configure(httpPort: "8080+"). configure(javaSysProp("brooklyn.example.db.url"), valueWhenAttributeReady(mysql, MySqlNode.MYSQL_URL, this.&makeJdbcUrl)); } }
  • 20.
    public class MyWebClusterextends AbstractApplication implements MyWebClusterConstants { def web = new ControlledDynamicWebAppCluster(this, war: WAR_PATH); MySqlNode mysql = new MySqlNode(this, creationScriptUrl: DB_SETUP_SQL_URL); { web.factory.configure(httpPort: "8080+"). configure(javaSysProp("brooklyn.example.db.url"), valueWhenAttributeReady(mysql, MySqlNode.MYSQL_URL, this.&makeJdbcUrl)); web.cluster.addPolicy( new AutoscalerPolicy(DynamicWebAppCluster.AVERAGE_REQUESTS_PER_SECOND). setSizeRange(1, 5). setMetricRange(10, 100)); } }

Editor's Notes

  • #6 Entities/Managed ElementsConcrete – AMP wrapper for component e.g. JBoss7Server, MySQLAbstract – AMP specific construct e.g. Cluster, FabricTopologyGrouping – clusters, fabrics etc
  • #9 Typically a multi-tier application like this is managed using scripts. These operate at three different levels – Cluster; Load Balanced Cluster and Multi-Tier Application itself. The challenge with this approach is figuring out the relationships between these (and how to phase them) so that in a dynamic environment the Cluster knows about the MySql instance which is part of the overall Application and NGINX knows about the Cluster and so on.In AMP we recognize this hierarchy explicitly but instead of scripting/phasing we create a model or blueprint for the application.
  • #23 Launch localhost demo at this point