|
UsingTheCloudToolsMavenPlugin
Using the Cloud Tools Maven plugin
Using the Cloud Tools Maven PluginCloud Tools provides a Maven plugin for deploying and managing web applications on Amazon EC2 and running load tests. The plug-in lets you manage one or more named clusters. The information about each cluster is stored in an XML file in your ~/.cloudtools directory. By default, the Maven plugin manages a cluster called maven-cluster but you can specify a cluster name using the cloudtools.cluster.name property. You can use this plugin even if you are not building your application with maven. See here for instructions. ConfigurationTo use the plugin there are three things that you must do
Here is an example configuration of the plugin in your web application's pom.xml <repositories>
<repository>
<id>pia-repository</id>
<url>http://www.pojosinaction.com/repository</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>pia-repository</id>
<url>http://www.pojosinaction.com/repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>net.chrisrichardson</groupId>
<artifactId>cloudtools-maven-plugin</artifactId>
<configuration>
<awsPropertiesFile>${cloudtools.plugin.awsPropertiesFile}</awsPropertiesFile>
<schemaName>ptrack</schemaName>
<schemaUsers>
<param>
ptrack:ptrack
</param>
</schemaUsers>
<sqlScripts>
<param>script1.sql</param>
<param>script2.sql</param>
</sqlScripts>
<catalinaOptsBuilder>
{builder, databasePrivateDnsName, slaves ->
builder.arg("-server")
builder.arg("-Xmx1000m")
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("jdbc.db.server", databasePrivateDnsName)}
</catalinaOptsBuilder>
</configuration>
</plugin>
</plugins>
</build>The plugin configuration creates a ClusterSpec that is used by EC2Deploy to manage the cluster. Maven GoalsThere are the following goals:
In addition, there are some features for using Amazon EBS. |
Sign in to add a comment
use clusterName element in project/build/plugins/plugin(cloudtools-maven-plugin)/configuration/ to specify the cluster definition file to use. (keeps different projects from overwriting the maven-cluster.xml file.
I am new to Maven and tried to follow instructions in this page and assumed that the plugin will just be automatically installed. It did not. I had to check it out from SVN, build it and it got added to local repository. Some instruction would help for us newbies. :-D
Also, it is not clear to me where to define everything, if I am using Maven plugin. For example, bucket name. Am I supposed to edit EC2Deploy and hard code these values into the template/config files somewhere or can I just do this in cluster spec file. A sample file with all possible options would make it clearer.
Finally, I hacked some files out of the example, e.g. .sql files, just to try it and when I run 'mvn cloudtools:deploy' it fails because ptrack.foo table is not being created.
INFO? ------------------------------------------------------------------------ ERROR? FATAL ERROR INFO? ------------------------------------------------------------------------ INFO? net.chrisrichardson.ec2deployer.core.ProcessExecutionException?: Command <ssh on ec2-174-129-135-250.compute-1.amazonaws.com: mysql ptrack < /tmp/tmp-ptrack-dml/script1.sql> execution failed with an exitValue of 1 INFO? ------------------------------------------------------------------------
I did the in-file search in the project for 'CREATE TABLE ...' statement and I do not see one. Also--and I am assuming here--the rest of the project fails since the DB scripts fail. I mean, even if the DB setup failed, I would assume that Apache would be running and responding, which does not seem to be the case.
I guess, I am back to my question: Am I supposed to rebuild EC2Deploy and hard code my configuration or is it all to be specified in clusterSpec file and pom.xml?
Also, nowhere does it tell me that I have to have a bucket that already exists. The first time I run deploy it throws errors, because bucket does not exist. The follow-up runs do not throw error, because there is a bucket created. I am sure I am missing something.
I just noticed your comments.
1. The plugin should be downloaded automatically. You should not need to build it.
2. Some temporary bucket names are currently hardwired into EC2deploy. if they don't it creates them automatically (and prints out an exception).
3. Everything should be configured in pom.xml / aws.properties.
Please send email to the group for more timely answers.
Chris