Issue 393: updated to prove gogrid workaround to inboundPorts is effective

This commit is contained in:
Adrian Cole 2010-10-28 12:31:43 -07:00
parent 39361c9cbd
commit c50b8a5dbd
2 changed files with 52 additions and 42 deletions

View File

@ -388,7 +388,7 @@ public abstract class BaseComputeServiceLiveTest {
testGet(); testGet();
} }
@Test(enabled = true, dependsOnMethods = "testReboot") @Test(enabled = true)
public void testCreateAndRunAService() throws Exception { public void testCreateAndRunAService() throws Exception {
String tag = this.tag + "service"; String tag = this.tag + "service";

View File

@ -19,9 +19,11 @@
package org.jclouds.compute; package org.jclouds.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.*; import static org.jclouds.compute.util.ComputeServiceUtils.execHttpResponse;
import static org.jclouds.compute.util.ComputeServiceUtils.extractTargzIntoDirectory;
import static org.jclouds.scriptbuilder.domain.Statements.exec; import static org.jclouds.scriptbuilder.domain.Statements.exec;
import static org.jclouds.scriptbuilder.domain.Statements.interpret; import static org.jclouds.scriptbuilder.domain.Statements.interpret;
import static org.jclouds.scriptbuilder.domain.Statements.newStatementList;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
@ -31,7 +33,6 @@ import org.jclouds.compute.predicates.OperatingSystemPredicates;
import org.jclouds.scriptbuilder.InitBuilder; import org.jclouds.scriptbuilder.InitBuilder;
import org.jclouds.scriptbuilder.domain.AuthorizeRSAPublicKey; import org.jclouds.scriptbuilder.domain.AuthorizeRSAPublicKey;
import org.jclouds.scriptbuilder.domain.Statement; import org.jclouds.scriptbuilder.domain.Statement;
import static org.jclouds.scriptbuilder.domain.Statements.*;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -62,14 +63,22 @@ public class RunScriptData {
jbossHome, jbossHome,
jbossHome, jbossHome,
envVariables, envVariables,
ImmutableList.<Statement> of( ImmutableList
new AuthorizeRSAPublicKey(publicKey), .<Statement> of(
installJavaAndCurl(os), new AuthorizeRSAPublicKey(publicKey),//
exec("rm -rf /var/cache/apt /usr/lib/vmware-tools"),// jeos hasn't enough room! installJavaAndCurl(os),//
// just in case iptables are being used, try to open 8080
exec("iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT"),//
// TODO gogrid rules only allow ports 22, 3389, 80 and 443.
// the above rule will be ignored, so we have to apply this directly
exec("iptables -I RH-Firewall-1-INPUT 1 -p tcp --dport 8080 -j ACCEPT"),//
exec("iptables-save"),//
extractTargzIntoDirectory( extractTargzIntoDirectory(
URI.create("http://commondatastorage.googleapis.com/jclouds-repo/jboss-as-distribution-6.0.0.20100911-M5.tar.gz"), URI
"/usr/local"), exec("{md} " + jbossHome), exec("mv /usr/local/jboss-*/* " + jbossHome), .create("http://commondatastorage.googleapis.com/jclouds-repo/jboss-as-distribution-6.0.0.20100911-M5.tar.gz"),
exec("chmod -R oug+r+w " + jbossHome)), "/usr/local"), exec("{md} " + jbossHome), exec("mv /usr/local/jboss-*/* "
+ jbossHome),//
exec("chmod -R oug+r+w " + jbossHome)),//
ImmutableList ImmutableList
.<Statement> of(interpret("java -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.endorsed.dirs=lib/endorsed -classpath bin/run.jar org.jboss.Main -b 0.0.0.0"))); .<Statement> of(interpret("java -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.endorsed.dirs=lib/endorsed -classpath bin/run.jar org.jboss.Main -b 0.0.0.0")));
return toReturn; return toReturn;
@ -81,11 +90,12 @@ public class RunScriptData {
exec(new StringBuilder()// exec(new StringBuilder()//
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")// .append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")//
.append("which curl || apt-get install -f -y -qq --force-yes curl\n")// .append("which curl || apt-get install -f -y -qq --force-yes curl\n")//
.append("rm -rf /var/cache/apt /usr/lib/vmware-tools\n")// jeos hasn't enough room! // jeos hasn't enough room!
.append("rm -rf /var/cache/apt /usr/lib/vmware-tools\n")//
.append("echo \"export PATH=\\\"\\$JAVA_HOME/bin/:\\$PATH\\\"\" >> /root/.bashrc")// .append("echo \"export PATH=\\\"\\$JAVA_HOME/bin/:\\$PATH\\\"\" >> /root/.bashrc")//
.toString())); .toString()));
public static final Statement YUM_RUN_SCRIPT = newStatementList(// public static final Statement YUM_RUN_SCRIPT = newStatementList(
exec("(which java && java -fullversion 2>&1|egrep -q 1.6 ) ||"),// exec("(which java && java -fullversion 2>&1|egrep -q 1.6 ) ||"),//
execHttpResponse(URI.create("http://whirr.s3.amazonaws.com/0.2.0-incubating-SNAPSHOT/sun/java/install")),// execHttpResponse(URI.create("http://whirr.s3.amazonaws.com/0.2.0-incubating-SNAPSHOT/sun/java/install")),//
exec(new StringBuilder()// exec(new StringBuilder()//