A ClusterSpec object specifies the structure of the cluster and what web applications to deploy.
A ClusterSpec is initialized by invoking a sequence of chained method calls. The class defines the following methods
- topology(String topologyName) - specifies the topology of the cluster. Either SingleInstanceCluster or MultipleInstancesCluster.
- webApp(pathToWebApp, Context) - the path to the web application and the context. This method can be called repeatedly. The path to the web application is either:
- Path to the exploded war directory on the local file system
- s3://bucketname/object
- schema(String schemaName, Map users, List scripts) - the schema name, a map of users and passwords, and a list of SQL scripts that create the tables and insert data
- slaves(int n) - the number of MySQL slaves
- tomcats(int n) - the number of Tomcat servers
- catalinaOptsBuilder() - a string that evaluates to a closure that builds the Tomcat CATALINA_OPTS. This closure takes three arguments:
- a builder
- the DNS name of the DB MySQL master
- a list of DNS names of the MySQL slaves
Here is an example
.catalinaOptsBuilder("""{builder, databasePrivateDnsName, slaves ->
builder.arg("-Xmx500m")
builder.prop("com.sun.management.jmxremote")
builder.prop("com.sun.management.jmxremote.port", 8091)
builder.prop("com.sun.management.jmxremote.authenticate", false)
builder.prop("com.sun.management.jmxremote.ssl", false)
builder.prop("ptrack.application.environment", "ec2")
builder.prop("log4j.configuration", "log4j-minimal.properties")
builder.prop("jdbc.db.server", databasePrivateDnsName)}""")
- bucketPrefix() - the String prefix that is prepended to S3 bucket names that are used by cloud tools for file transfers
- withSecurityGroupPrefix(String securityGroupPrefix) - optional prefix to use when you want each tier to be in its own security group
There are the following methods for configuring Apache:
- ssl(String keyFile, String certFile) - specifies the local paths to ssl key file and certificate file
- staticContent(String path, String bucket) - path to a directory containing the static content to deploy on Apache in /var/www/html and the name of an S3 bucket to store the content in.
- extraHttpConf(String conf) - extra Apache configuration
- externalIpAddress(String externalIpAddress) - an optional elastic IP address
There are the following methods for configurating Elastic Block Store:
- withExistingEbsVolume(String volumeId, String device)
- withNewEbsVolume(int size, String device)
- withEbsVolumeFromSnapshot(String snapshotId, Integer size, String device)
There are several methods for specifying the instance types:
- instanceType(type) - default instance type for all servers where type is, for example, "m1.small"
- masterDatabaseInstanceType(type)
- slaveDatabaseInstanceType(type)
- tomcatInstanceType(type)
- apacheInstanceType(type)
- jmeterInstanceType(type)
Is it possible to not configure a mysql instance?