2010-01-11 00:57:07 -05:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!--
|
|
|
|
|
|
|
|
|
|
|
|
Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
|
|
|
|
|
|
====================================================================
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
====================================================================
|
|
|
|
|
|
|
|
-->
|
|
|
|
<project xmlns:artifact="urn:maven-artifact-ant" name="cargooverssh" default="cargooverssh" basedir=".">
|
|
|
|
<property file="build.properties" />
|
2010-01-11 08:38:07 -05:00
|
|
|
<property name="password" value="" />
|
|
|
|
<property name="keyfile" value="" />
|
2010-01-11 13:01:30 -05:00
|
|
|
<property name="warfile" value="build/samples-blazeds.war" />
|
2010-01-11 00:57:07 -05:00
|
|
|
|
|
|
|
<!-- maven must be available before we use it -->
|
|
|
|
<delete dir="build/cargo"/>
|
|
|
|
<mkdir dir="build/cargo"/>
|
|
|
|
|
2010-01-15 18:13:35 -05:00
|
|
|
<!--
|
2010-01-11 00:57:07 -05:00
|
|
|
<get src="http://apache.imghat.com/maven/binaries/maven-ant-tasks-2.1.0.jar" dest="build/maven-ant-tasks-2.1.0.jar"/>
|
2010-01-11 13:01:30 -05:00
|
|
|
<get src="http://web-actions.googlecode.com/files/samples-blazeds.war" dest="${warfile}"/>
|
2010-01-15 18:13:35 -05:00
|
|
|
-->
|
2010-01-11 00:57:07 -05:00
|
|
|
<!-- initialize maven tasks -->
|
|
|
|
<path id="maven-ant-tasks.classpath" path="build/maven-ant-tasks-2.1.0.jar"/>
|
|
|
|
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath"/>
|
2010-01-11 08:38:07 -05:00
|
|
|
|
2010-01-11 00:57:07 -05:00
|
|
|
<artifact:localRepository id="local.repository" path="${user.home}/.m2/repository"/>
|
|
|
|
<artifact:remoteRepository id="jclouds-snapshot.repository" url="http://jclouds.rimuhosting.com/maven2/snapshots"/>
|
2010-01-15 18:13:35 -05:00
|
|
|
<artifact:remoteRepository id="cargo-snapshot.repository" url="http://snapshots.repository.codehaus.org" />
|
2010-01-11 08:38:07 -05:00
|
|
|
|
2010-01-11 00:57:07 -05:00
|
|
|
<!-- Setup maven so that we can get latest version of jclouds, jclouds, and jruby -->
|
|
|
|
<artifact:dependencies pathId="jclouds.classpath">
|
|
|
|
<dependency groupid="org.codehaus.cargo" artifactId="cargo-ant" version="1.0.1-SNAPSHOT"/>
|
|
|
|
<dependency groupid="org.codehaus.cargo" artifactId="cargo-core-container-tomcat" version="1.0.1-SNAPSHOT"/>
|
|
|
|
<dependency groupId="org.jclouds" artifactId="jclouds-terremark" version="1.0-SNAPSHOT"/>
|
|
|
|
<dependency groupId="org.jclouds" artifactId="jclouds-antcontrib" version="1.0-SNAPSHOT"/>
|
|
|
|
<remoteRepository refid="jclouds-snapshot.repository"/>
|
2010-01-15 18:13:35 -05:00
|
|
|
<remoteRepository refid="cargo-snapshot.repository"/>
|
2010-01-11 00:57:07 -05:00
|
|
|
<localRepository refid="local.repository"/>
|
|
|
|
</artifact:dependencies>
|
2010-01-11 08:38:07 -05:00
|
|
|
|
|
|
|
<typedef name="compute" classname="org.jclouds.tools.ant.taskdefs.compute.ComputeTask" classpathref="jclouds.classpath" />
|
|
|
|
<taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="jclouds.classpath" />
|
2010-01-11 00:57:07 -05:00
|
|
|
<taskdef resource="cargo.tasks" classpathref="jclouds.classpath"/>
|
|
|
|
|
|
|
|
<property name="service" value="terremark"/>
|
|
|
|
<input message="What is your account on ${service}?" addproperty="account"/>
|
|
|
|
<input message="What is the key for ${account}?" addproperty="key"/>
|
2010-01-12 20:19:42 -05:00
|
|
|
<property name="jclouds.compute.nodename" value="terremark-blaze"/>
|
2010-01-11 00:57:07 -05:00
|
|
|
<property name="jclouds.compute.url" value="compute://${account}:${key}@${service}"/>
|
|
|
|
|
2010-01-12 20:19:42 -05:00
|
|
|
<target name="destroy" description="destroy the node ${jclouds.compute.nodename}">
|
2010-01-11 08:38:07 -05:00
|
|
|
<compute action="destroy" provider="${jclouds.compute.url}">
|
2010-01-12 20:19:42 -05:00
|
|
|
<node name="${jclouds.compute.nodename}" />
|
2010-01-11 08:38:07 -05:00
|
|
|
</compute>
|
2010-01-15 18:13:35 -05:00
|
|
|
<sleep seconds="2" />
|
2010-01-11 08:38:07 -05:00
|
|
|
</target>
|
|
|
|
|
2010-01-12 20:19:42 -05:00
|
|
|
<target name="create" description="create the node ${jclouds.compute.nodename}" depends="destroy" >
|
2010-01-11 08:38:07 -05:00
|
|
|
<compute action="create" provider="${jclouds.compute.url}">
|
2010-01-12 20:19:42 -05:00
|
|
|
<node name="${jclouds.compute.nodename}" image="UBUNTU_JEOS_90" profile="SMALLEST"
|
2010-01-11 08:38:07 -05:00
|
|
|
hostproperty="host" usernameproperty="username" passwordproperty="password" />
|
|
|
|
</compute>
|
|
|
|
|
2010-01-12 20:19:42 -05:00
|
|
|
<echo message="provisioning java on: ${jclouds.compute.nodename}" />
|
2010-01-11 08:38:07 -05:00
|
|
|
<property name="sudo" value="echo ${password}|sudo -S" />
|
|
|
|
<!-- funny game to get around sudo problems with >>. first sudo is only to prime the password -->
|
|
|
|
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
|
|
|
|
command="${sudo} echo hello;echo nameserver 208.67.222.222 |sudo tee -a /etc/resolv.conf" />
|
|
|
|
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
|
|
|
|
command="${sudo} apt-get update -qq" />
|
|
|
|
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
|
|
|
|
command="${sudo} apt-get upgrade -y -qq" />
|
|
|
|
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
|
|
|
|
command="${sudo} apt-get install -y -qq wget" />
|
|
|
|
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
|
|
|
|
command="${sudo} apt-get install -y -qq openjdk-6-jdk" />
|
|
|
|
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
|
|
|
|
command="wget -q http://www.alliedquotes.com/mirrors/apache/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz" />
|
|
|
|
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
|
|
|
|
command="tar xzf apache-tomcat-6.0.20.tar.gz" />
|
|
|
|
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
|
|
|
|
command="${sudo} mkdir -p /tmp/cargo/containers/" />
|
|
|
|
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
|
|
|
|
command="${sudo} chmod 1777 /tmp/cargo" />
|
|
|
|
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
|
|
|
|
command="${sudo} mv apache-tomcat-6.0.20 /tmp/cargo/containers/tomcat6x" />
|
2010-01-11 00:57:07 -05:00
|
|
|
</target>
|
|
|
|
|
2010-01-15 18:13:35 -05:00
|
|
|
<target name="cargooverssh" depends="create" description="run cargo on remote node" >
|
2010-01-12 20:19:42 -05:00
|
|
|
<echo message="deploying tomcat and blaze to: ${jclouds.compute.nodename}" />
|
2010-01-11 08:38:07 -05:00
|
|
|
<cargo containerId="tomcat6x" output="build/output.log" log="build/cargo.log" action="start" timeout="600000">
|
2010-01-11 00:57:07 -05:00
|
|
|
<zipurlinstaller installurl="http://www.alliedquotes.com/mirrors/apache/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.zip"/>
|
|
|
|
<configuration home="build/cargo" type="standalone">
|
2010-01-11 08:38:07 -05:00
|
|
|
<property name="cargo.java.home" value="/usr/lib/jvm/java-6-openjdk"/>
|
|
|
|
<property name="cargo.hostname" value="${host}"/>
|
2010-01-11 00:57:07 -05:00
|
|
|
<property name="cargo.servlet.port" value="8080"/>
|
2010-01-11 08:38:07 -05:00
|
|
|
<property name="cargo.ssh.host" value="${host}"/>
|
|
|
|
<property name="cargo.ssh.username" value="${username}"/>
|
|
|
|
<property name="cargo.ssh.password" value="${password}"/>
|
|
|
|
<property name="cargo.ssh.keyfile" value="${keyfile}"/>
|
|
|
|
<property name="cargo.ssh.remotebase" value="/tmp/cargo"/>
|
2010-01-11 00:57:07 -05:00
|
|
|
<property name="cargo.logging" value="high"/>
|
2010-01-11 13:01:30 -05:00
|
|
|
<deployable type="war" file="${warfile}"/>
|
|
|
|
</configuration>
|
|
|
|
</cargo>
|
|
|
|
</target>
|
|
|
|
|
2010-01-15 18:13:35 -05:00
|
|
|
<target name="justplaincargo" description="run cargo on local machine" >
|
2010-01-11 13:01:30 -05:00
|
|
|
<echo message="deploying tomcat and blaze to: localhost" />
|
|
|
|
<cargo containerId="tomcat6x" output="build/output.log" log="build/cargo.log" action="start" timeout="600000">
|
|
|
|
<zipurlinstaller installurl="http://www.alliedquotes.com/mirrors/apache/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.zip"/>
|
|
|
|
<configuration home="build/cargo" type="standalone">
|
|
|
|
<property name="cargo.servlet.port" value="8080"/>
|
|
|
|
<property name="cargo.logging" value="high"/>
|
|
|
|
<deployable type="war" file="${warfile}"/>
|
2010-01-11 00:57:07 -05:00
|
|
|
</configuration>
|
|
|
|
</cargo>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
</project>
|