mirror of https://github.com/apache/jclouds.git
fixed ant demos to new snapshot
This commit is contained in:
parent
caf38ac875
commit
d6075af116
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
|
||||
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
Copyright (C) 2010 Cloud Conscious, LLC. <infocloudconscious.com>
|
||||
|
||||
====================================================================
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -23,25 +23,22 @@
|
|||
<project name="shrinkblob" default="shrinkblob" basedir="." xmlns:artifact="urn:maven-artifact-ant">
|
||||
|
||||
<!-- maven must be available before we use it -->
|
||||
<get src="http://apache.imghat.com/maven/binaries/maven-ant-tasks-2.1.0.jar" dest="maven-ant-tasks-2.1.0.jar"/>
|
||||
<get src="http://opensource.become.com/apache//maven/binaries/maven-ant-tasks-2.1.1.jar" dest="maven-ant-tasks.jar"/>
|
||||
|
||||
<!-- initialize maven tasks -->
|
||||
<path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1.0.jar" />
|
||||
<path id="maven-ant-tasks.classpath" path="maven-ant-tasks.jar" />
|
||||
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
|
||||
classpathref="maven-ant-tasks.classpath" />
|
||||
|
||||
<artifact:localRepository id="local.repository" path="${user.home}/.m2/repository" />
|
||||
<artifact:remoteRepository id="jclouds-snapshot.repository" url="https://oss.sonatype.org/content/repositories/snapshots" />
|
||||
<artifact:remoteRepository id="shrinkwrap.repository" url="http://repository.jboss.org/maven2" />
|
||||
<artifact:remoteRepository id="shrinkwrap.repository" url="https://repository.jboss.org/nexus/content/groups/public" />
|
||||
|
||||
<!-- Setup maven so that we can get latest version of jclouds, shrinkwrap, and jruby -->
|
||||
<artifact:dependencies pathId="shrinkwrap.classpath">
|
||||
<dependency groupId="org.jboss.shrinkwrap" artifactId="shrinkwrap-impl-base" version="1.0.0-alpha-9" />
|
||||
<dependency groupId="org.jruby" artifactId="jruby" version="1.4.0"/>
|
||||
<dependency groupId="org.jclouds" artifactId="jclouds-aws" version="1.0-SNAPSHOT" />
|
||||
<dependency groupId="org.jclouds" artifactId="jclouds-atmos" version="1.0-SNAPSHOT" />
|
||||
<dependency groupId="org.jclouds" artifactId="jclouds-azure" version="1.0-SNAPSHOT" />
|
||||
<dependency groupId="org.jclouds" artifactId="jclouds-rackspace" version="1.0-SNAPSHOT" />
|
||||
<dependency groupId="org.jboss.shrinkwrap" artifactId="shrinkwrap-impl-base" version="1.0.0-alpha-11" />
|
||||
<dependency groupId="org.jruby" artifactId="jruby" version="1.5.2"/>
|
||||
<dependency groupId="org.jclouds" artifactId="jclouds-allblobstore" version="1.0-SNAPSHOT" />
|
||||
<remoteRepository refid="shrinkwrap.repository" />
|
||||
<remoteRepository refid="jclouds-snapshot.repository" />
|
||||
<localRepository refid="local.repository" />
|
||||
|
@ -63,91 +60,51 @@
|
|||
/>
|
||||
|
||||
<input
|
||||
message="Which service would you like to use (atmos,azureblob,cloudfiles,s3)?"
|
||||
validargs="atmos,azureblob,cloudfiles,s3"
|
||||
addproperty="service"
|
||||
message="Which provider would you like to use (transient,atmos,azureblob,cloudfiles,s3)?"
|
||||
validargs="transient,atmos,azureblob,cloudfiles,s3"
|
||||
addproperty="provider"
|
||||
/>
|
||||
|
||||
<input
|
||||
message="What is your account on ${service}?"
|
||||
addproperty="account"
|
||||
message="What is your identity on ${provider}?"
|
||||
addproperty="identity"
|
||||
/>
|
||||
|
||||
<input
|
||||
message="What is the key for ${account}?"
|
||||
addproperty="key"
|
||||
message="What is the credential for ${identity}?"
|
||||
addproperty="credential"
|
||||
/>
|
||||
|
||||
<property name="location" value="default" />
|
||||
|
||||
<property name="urltoparse" value="blobstore://${account}:${key}@${service}/${container}" />
|
||||
|
||||
<target name="export">
|
||||
<target name="shrinkblob">
|
||||
<script language="jruby" classpathref="shrinkwrap.classpath"> <![CDATA[
|
||||
require 'java'
|
||||
require 'jruby/core_ext'
|
||||
include_class 'org.apache.tools.ant.Task'
|
||||
include_class 'org.jclouds.http.HttpUtils'
|
||||
include_class 'org.jclouds.blobstore.BlobStoreContextFactory'
|
||||
include_class 'org.jboss.shrinkwrap.api.Archives'
|
||||
include_class 'org.jboss.shrinkwrap.api.ShrinkWrap'
|
||||
include_class 'org.jboss.shrinkwrap.api.exporter.ZipExporter'
|
||||
include_class 'org.jboss.shrinkwrap.api.importer.ExplodedImporter'
|
||||
include_class 'org.jboss.shrinkwrap.impl.base.ServiceExtensionLoader'
|
||||
|
||||
# define a new ant task that uses ShrinkWrap to zip up things to a BlobStore
|
||||
class ShrinkBlob < Task
|
||||
def setBlobstore(blobstore)
|
||||
@blobstore = blobstore
|
||||
end
|
||||
|
||||
def setContainer(container)
|
||||
@container = container
|
||||
end
|
||||
|
||||
def setZip(zip)
|
||||
@zip = zip
|
||||
end
|
||||
|
||||
def setDir(dir)
|
||||
@dir = dir
|
||||
end
|
||||
|
||||
def execute
|
||||
# correct the ant classloader so that extensions can be found
|
||||
java.lang.Thread.currentThread().setContextClassLoader(ServiceExtensionLoader.new().getClass().getClassLoader())
|
||||
|
||||
print "creating the archive from ",@dir,"\n"
|
||||
zipStream = Archives.create(@zip, ExplodedImporter.java_class).importDirectory(@dir).as(ZipExporter.java_class).exportZip()
|
||||
print "creating the archive from ",$dir,"\n"
|
||||
zipStream = ShrinkWrap.create(ExplodedImporter.java_class, $zip).importDirectory($dir).as(ZipExporter.java_class).exportZip()
|
||||
|
||||
destination = HttpUtils.createUri(@blobstore)
|
||||
print "connecting to service ",destination.getHost(),"/",@container,"\n"
|
||||
print "connecting to provider ",$provider,"/",$container,"\n"
|
||||
|
||||
# array thing is a weird hack since jruby doesn't understand varargs
|
||||
context = BlobStoreContextFactory.new().createContext(destination)
|
||||
context.getBlobStore().createContainerInLocation(@location, @container)
|
||||
context = BlobStoreContextFactory.new().createContext($provider, $identity, $credential)
|
||||
context.getBlobStore().createContainerInLocation(nil, $container)
|
||||
|
||||
print "uploading to ",destination.getHost(),"/",@container,"/",@zip,"\n"
|
||||
context.createInputStreamMap(@container).put(@zip,zipStream);
|
||||
print "uploading to ",$provider,"/",$container,"/",$zip,"\n"
|
||||
context.createInputStreamMap($container).put($zip,zipStream);
|
||||
|
||||
context.close();
|
||||
end
|
||||
end
|
||||
|
||||
# make a real java class so that we can register it in ant
|
||||
ShrinkBlob.add_method_signature("execute", [java.lang.Void::TYPE])
|
||||
ShrinkBlob.add_method_signature("setBlobstore", [java.lang.Void::TYPE, java.lang.String.java_class])
|
||||
ShrinkBlob.add_method_signature("setContainer", [java.lang.Void::TYPE, java.lang.String.java_class])
|
||||
ShrinkBlob.add_method_signature("setZip", [java.lang.Void::TYPE, java.lang.String.java_class])
|
||||
ShrinkBlob.add_method_signature("setDir", [java.lang.Void::TYPE, java.io.File.java_class])
|
||||
clazz = ShrinkBlob.become_java!;
|
||||
|
||||
# register the ant task
|
||||
$project.addTaskDefinition("shrinkblob", clazz)
|
||||
]]></script>
|
||||
</target>
|
||||
|
||||
<target name="shrinkblob" depends="export" >
|
||||
<shrinkblob blobstore="${urltoparse}" container="${container}" dir="${dir}" zip="${zip}" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
provider=bluelock-vcloudirector
|
||||
driver=bluelock
|
||||
identity=user@your_org
|
||||
credential=password
|
||||
tag=name_of_your_vapp
|
|
@ -0,0 +1,5 @@
|
|||
provider=bluelock-vcloudexpress
|
||||
driver=bluelock
|
||||
identity=user@youregistered.com
|
||||
credential=password
|
||||
tag=name_of_your_vapp
|
|
@ -1,5 +1,5 @@
|
|||
service=ec2
|
||||
provider=ec2
|
||||
driver=aws
|
||||
account=accesskeyid
|
||||
key=secretaccesskey
|
||||
nodetag=we_create_and_delete_based_on_key_and_security_group_name_not_instance_id
|
||||
identity=accesscredentialid
|
||||
credential=secretaccesscredential
|
||||
tag=we_create_and_delete_based_on_credential_and_security_group_name_not_instance_id
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
provider=eucalyptus
|
||||
driver=aws
|
||||
# note you need to change this to the correct endpoint
|
||||
eucalyptus.endpoint=http://173.205.188.130:8773/services/Eucalyptus
|
||||
identity=accesskey
|
||||
credential=secret
|
||||
tag=name_of_your_cluster_or_instance
|
|
@ -0,0 +1,5 @@
|
|||
provider=gogrid
|
||||
driver=gogrid
|
||||
identity=apikey
|
||||
credential=secret
|
||||
tag=name_of_your_server
|
|
@ -1,5 +0,0 @@
|
|||
service=hostingdotcom
|
||||
driver=hostingdotcom
|
||||
account=user@youregistered.com
|
||||
key=password
|
||||
nodetag=name_of_your_vapp
|
|
@ -0,0 +1,5 @@
|
|||
provider=ibmdev
|
||||
driver=ibmdev
|
||||
identity=user@youregistered.com
|
||||
credential=password
|
||||
tag=name_of_your_server
|
|
@ -1,5 +1,5 @@
|
|||
service=cloudservers
|
||||
provider=cloudservers
|
||||
driver=rackspace
|
||||
account=user
|
||||
key=your_key
|
||||
nodetag=name_of_your_server
|
||||
identity=user
|
||||
credential=your_credential
|
||||
tag=name_of_your_server
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
service=rimuhosting
|
||||
provider=rimuhosting
|
||||
driver=rimuhosting
|
||||
account=apikey
|
||||
key=apikey
|
||||
nodetag=name_of_your_server
|
||||
identity=apicredential
|
||||
credential=apicredential
|
||||
tag=name_of_your_server
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
service=trmk-ecloud
|
||||
provider=trmk-ecloud
|
||||
driver=terremark
|
||||
account=user@youregistered.com
|
||||
key=password
|
||||
nodetag=name_of_your_vapp
|
||||
identity=user@youregistered.com
|
||||
credential=password
|
||||
tag=name_of_your_vapp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
service=trmk-vcloudexpress
|
||||
provider=trmk-vcloudexpress
|
||||
driver=terremark
|
||||
account=user@youregistered.com
|
||||
key=password
|
||||
nodetag=name_of_your_vapp
|
||||
identity=user@youregistered.com
|
||||
credential=password
|
||||
tag=name_of_your_vapp
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
service=vcloud
|
||||
provider=vcloud
|
||||
driver=vcloud
|
||||
# note you need to change this to the correct endpoint
|
||||
vcloud.endpoint=https://vcloud_host_you_want/api
|
||||
account=user@youregistered.com
|
||||
key=password
|
||||
nodetag=name_of_your_vapp
|
||||
identity=user@your_org
|
||||
credential=password
|
||||
tag=name_of_your_vapp
|
||||
|
|
|
@ -26,32 +26,30 @@
|
|||
<property name="privatekeyfile" value="${user.home}/.ssh/id_rsa" />
|
||||
<property name="publickeyfile" value="${user.home}/.ssh/id_rsa.pub" />
|
||||
<property name="listenport" value="8080" />
|
||||
<property name="container.zip" value="http://mirrors.axint.net/apache/tomcat/tomcat-6/v6.0.24/bin/apache-tomcat-6.0.24.tar.gz" />
|
||||
<property name="container.zip" value="http://apache.imghat.com//tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz" />
|
||||
<property name="warfile" value="build/samples-blazeds.war" />
|
||||
|
||||
<!-- maven must be available before we use it -->
|
||||
<delete dir="build/cargo"/>
|
||||
<mkdir dir="build/cargo"/>
|
||||
|
||||
<!--
|
||||
<get src="http://apache.imghat.com/maven/binaries/maven-ant-tasks-2.1.0.jar" dest="build/maven-ant-tasks-2.1.0.jar"/>
|
||||
<get src="http://opensource.become.com/apache//maven/binaries/maven-ant-tasks-2.1.1.jar" dest="build/maven-ant-tasks"/>
|
||||
<get src="http://web-actions.googlecode.com/files/samples-blazeds.war" dest="${warfile}"/>
|
||||
-->
|
||||
|
||||
<input
|
||||
message="Which service would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?"
|
||||
validargs="ec2,cloudservers,vcloud,terremark,rimuhosting"
|
||||
addproperty="service"
|
||||
message="Which provider would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?"
|
||||
validargs="ec2,cloudservers,vcloud,trmk-ecloud,trmk-vcloudexpress,ibmdev,eucalyptus,bluelock-vcloudexpress,bluelock-vclouddirector,gogrid,rimuhosting"
|
||||
addproperty="provider"
|
||||
/>
|
||||
|
||||
<input
|
||||
message="Which driver does ${service} use?"
|
||||
validargs="aws,rackspace,vcloud,terremark,rimuhosting"
|
||||
message="Which driver does ${provider} use?"
|
||||
validargs="aws,rackspace,vcloud,bluelock,gogrid,terremark,ibmdev,rimuhosting"
|
||||
addproperty="driver"
|
||||
/>
|
||||
|
||||
<!-- initialize maven tasks -->
|
||||
<path id="maven-ant-tasks.classpath" path="build/maven-ant-tasks-2.1.0.jar"/>
|
||||
<path id="maven-ant-tasks.classpath" path="build/maven-ant-tasks"/>
|
||||
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath"/>
|
||||
|
||||
<artifact:localRepository id="local.repository" path="${user.home}/.m2/repository"/>
|
||||
|
@ -60,8 +58,8 @@
|
|||
|
||||
<!-- 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-alpha-2"/>
|
||||
<dependency groupid="org.codehaus.cargo" artifactId="cargo-core-container-tomcat" version="1.0.1-alpha-2"/>
|
||||
<dependency groupid="org.codehaus.cargo" artifactId="cargo-ant" version="1.0.3"/>
|
||||
<dependency groupid="org.codehaus.cargo" artifactId="cargo-core-container-tomcat" version="1.0.3"/>
|
||||
<dependency groupId="org.jclouds" artifactId="jclouds-${driver}" version="${jclouds.version}"/>
|
||||
<dependency groupId="org.jclouds" artifactId="jclouds-antcontrib" version="${jclouds.version}"/>
|
||||
<remoteRepository refid="jclouds.repository"/>
|
||||
|
@ -73,21 +71,21 @@
|
|||
<taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="jclouds.classpath" />
|
||||
<taskdef resource="cargo.tasks" classpathref="jclouds.classpath"/>
|
||||
|
||||
<input message="What is your account on ${service}?" addproperty="account"/>
|
||||
<input message="What is the key for ${account}?" addproperty="key"/>
|
||||
<input message="What is the nodetag for the deployment?" addproperty="nodetag"/>
|
||||
<property name="url" value="compute://${account}:${key}@${service}"/>
|
||||
<input message="What is your identity on ${provider}?" addproperty="identity"/>
|
||||
<input message="What is the credential for ${identity}?" addproperty="credential"/>
|
||||
<input message="What is the tag for the deployment?" addproperty="tag"/>
|
||||
<property name="url" value="compute://${identity}:${credential}@${provider}"/>
|
||||
|
||||
<target name="destroy" description="destroy the nodes ${nodetag}">
|
||||
<target name="destroy" description="destroy the nodes ${tag}">
|
||||
<compute actions="destroy" provider="${url}">
|
||||
<nodes tag="${nodetag}" />
|
||||
<nodes tag="${tag}" />
|
||||
</compute>
|
||||
<sleep seconds="5" />
|
||||
</target>
|
||||
|
||||
<target name="create" description="create the nodes ${nodetag}" >
|
||||
<target name="create" description="create the nodes ${tag}" >
|
||||
<compute actions="destroy,create" provider="${url}">
|
||||
<nodes tag="${nodetag}" os="UBUNTU" size="SMALLEST"
|
||||
<nodes tag="${tag}" os="UBUNTU" size="SMALLEST"
|
||||
runscript="runscript.sh" openports="22,${listenport}"
|
||||
privatekeyfile="${privatekeyfile}" publickeyfile="${publickeyfile}"
|
||||
hostproperty="host" usernameproperty="username" />
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
provider=bluelock-vcloudirector
|
||||
driver=bluelock
|
||||
identity=user@your_org
|
||||
credential=password
|
||||
tag=name_of_your_vapp
|
|
@ -0,0 +1,5 @@
|
|||
provider=bluelock-vcloudexpress
|
||||
driver=bluelock
|
||||
identity=user@youregistered.com
|
||||
credential=password
|
||||
tag=name_of_your_vapp
|
|
@ -1,5 +1,5 @@
|
|||
service=ec2
|
||||
provider=ec2
|
||||
driver=aws
|
||||
account=accesskeyid
|
||||
key=secretaccesskey
|
||||
tag=we_create_and_delete_based_on_key_and_security_group_name_not_instance_id
|
||||
identity=accesscredentialid
|
||||
credential=secretaccesscredential
|
||||
tag=we_create_and_delete_based_on_credential_and_security_group_name_not_instance_id
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
provider=eucalyptus
|
||||
driver=aws
|
||||
# note you need to change this to the correct endpoint
|
||||
eucalyptus.endpoint=http://173.205.188.130:8773/services/Eucalyptus
|
||||
identity=accesskey
|
||||
credential=secret
|
||||
tag=name_of_your_cluster_or_instance
|
|
@ -1,5 +1,5 @@
|
|||
service=gogrid
|
||||
provider=gogrid
|
||||
driver=gogrid
|
||||
account=apikey_not_your_email
|
||||
key=shared_secret_not_your_password
|
||||
identity=apikey
|
||||
credential=secret
|
||||
tag=name_of_your_server
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
service=hostingdotcom
|
||||
driver=hostingdotcom
|
||||
account=user@youregistered.com
|
||||
key=password
|
||||
tag=name_of_your_vapp
|
|
@ -0,0 +1,5 @@
|
|||
provider=ibmdev
|
||||
driver=ibmdev
|
||||
identity=user@youregistered.com
|
||||
credential=password
|
||||
tag=name_of_your_server
|
|
@ -1,5 +1,5 @@
|
|||
service=cloudservers
|
||||
provider=cloudservers
|
||||
driver=rackspace
|
||||
account=user
|
||||
key=your_key
|
||||
identity=user
|
||||
credential=your_credential
|
||||
tag=name_of_your_server
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
service=rimuhosting
|
||||
provider=rimuhosting
|
||||
driver=rimuhosting
|
||||
account=apikey
|
||||
key=apikey
|
||||
identity=apicredential
|
||||
credential=apicredential
|
||||
tag=name_of_your_server
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
provider=trmk-ecloud
|
||||
driver=terremark
|
||||
identity=user@youregistered.com
|
||||
credential=password
|
||||
tag=name_of_your_vapp
|
|
@ -0,0 +1,5 @@
|
|||
provider=trmk-vcloudexpress
|
||||
driver=terremark
|
||||
identity=user@youregistered.com
|
||||
credential=password
|
||||
tag=name_of_your_vapp
|
|
@ -1,7 +1,7 @@
|
|||
service=vcloud
|
||||
provider=vcloud
|
||||
driver=vcloud
|
||||
# note you need to change this to the correct endpoint
|
||||
vcloud.endpoint=https://vcloud_host_you_want/api
|
||||
account=user@youregistered.com
|
||||
key=password
|
||||
identity=user@your_org
|
||||
credential=password
|
||||
tag=name_of_your_vapp
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
<input
|
||||
message="Which driver does ${provider} use?"
|
||||
validargs="aws,rackspace,vcloud,bluelock,gogrid,terremark,rimuhosting"
|
||||
validargs="aws,rackspace,vcloud,bluelock,gogrid,terremark,ibmdev,rimuhosting"
|
||||
addproperty="driver"
|
||||
/>
|
||||
|
||||
|
|
Loading…
Reference in New Issue