My favorites | Sign in
Project Logo
                
Search
for
Updated Mar 04, 2009 by chris.e.richardson
Labels: Featured
GettingStartedWithTheCloudToolsGrailsPlugin  
Using the Cloud Tools Grails Plugin

Introduction

Cloud Tools provides a Grails plugin for deploying and managing Grails application on Amazon EC2. The Grails plugin manages on or more named clusters. Each cluster consists of a set of EC2 instances.

Checkout the screen cast showing how to use the plugin.

Installation

You can download the plugin from here. Alternatively, you can install the plugin using this command

grails install-plugin http://cloudtools.googlecode.com/files/grails-cloud-tools-0.6.zip

Configuration

Before you can use this plugin, you first need to edit grails-app/conf/Config.groovy. You need to specify the location of the AwsPropertiesFile and define the cluster configuration.

This is what you need to add to that file.

import net.chrisrichardson.ec2deployer.cluster.*
import net.chrisrichardson.ec2deployer.core.*

cloudTools {

   awsPropertiesFile = "...path to AWS properties file ..."

   // The name of the cluster
   // The plugin creates a file called ~/.cloudtools/<clusterName>.xml directory

   clusterName = "grails-cluster"

   // Specify the configuration of the cluster

   clusterSpec = new ClusterSpec()
      .tomcats(1)
      .topology("SingleInstanceTopology")
      .instanceType(EC2InstanceType.SMALL)
      .slaves(0)
      .bucketPrefix(System.getProperty("grails.env"))
      .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("jdbc.db.server", databasePrivateDnsName)}""")
       .schema("ptrack", ["ptrack": "ptrack"], [])
}

This code creates a ClusterSpec that is used by EC2Deploy to manage the cluster.

Using the plugin

The plugin provides the following scripts:

cloud-tools-deploy deploy the web application
cloud-tools-describe display information about the running EC2 instances
cloud-tools-redeploy redeploys the application
cloud-tools-stop terminates the instances
cloud-tools-add-app-server add an application server
cloud-tools-clone clone the cluster
cloud-tools-create-snapshot create an EBS snapshot
cloud-tools-curl get the specified url
cloud-tools-db-recreate recreate the databse
cloud-tools-db-restore restore the database from a backup
cloud-tools-db-save backup the database
cloud-tools-enable-brb display a be right back page
cloud-tools-disable-brb hide the be right back page
cloud-tools-enable-ebs enable EBS for a cluster using local storage
cloud-tools-enable-master-backups Enable periodic mysqldumps on the master database
cloud-tools-enable-slave-backups Enable periodic mysqldumps on a slave database
cloud-tools-init-lb-pool initialize LB pool hosts table
cloud-tools-jmeter run a jmeter test
cloud-tools-list list the available clusters
cloud-tools-restart-apache restart apache and pick up a new configuration
cloud-tools-sql execute an SQL script on the master database
cloud-tools-stop-jmeter stop jmeter instance
cloud-tools-stop-mysql-slave stop a mysql slave
cloud-tools-update-war update a WAR stored in S3 using rsync
cloud-tools-verify verify S3 credentials



Sign in to add a comment
Hosted by Google Code