switched to cloudfront for test distribution

This commit is contained in:
Adrian Cole 2011-01-25 12:00:07 -08:00
parent 1df15209ec
commit 01da7ce80f
2 changed files with 41 additions and 43 deletions

View File

@ -59,32 +59,30 @@ public class RunScriptData {
public static Statement authorizePortInIpTables(int port) {
return Statements.newStatementList(// just in case iptables are being used, try to open 8080
exec("iptables -I INPUT 1 -p tcp --dport " + port + " -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 " + port + " -j ACCEPT"),//
exec("iptables-save"));
exec("iptables -I INPUT 1 -p tcp --dport " + port + " -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 " + port + " -j ACCEPT"),//
exec("iptables-save"));
}
public static Statement createScriptInstallAndStartJBoss(String publicKey, OperatingSystem os) {
Map<String, String> envVariables = ImmutableMap.of("jbossHome", jbossHome);
Statement toReturn = new InitBuilder(
"jboss",
jbossHome,
jbossHome,
envVariables,
ImmutableList.<Statement> of(
new AuthorizeRSAPublicKey(publicKey),//
installJavaAndCurl(os),//
authorizePortInIpTables(8080),//
extractTargzIntoDirectory(
URI.create("http://commondatastorage.googleapis.com/jclouds-repo/jboss-as-distribution-6.0.0.20100911-M5.tar.gz"),
"/usr/local"),//
exec("{md} " + jbossHome), exec("mv /usr/local/jboss-*/* " + jbossHome),//
exec("chmod -R oug+r+w " + jbossHome)),//
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")));
"jboss",
jbossHome,
jbossHome,
envVariables,
ImmutableList.<Statement> of(new AuthorizeRSAPublicKey(publicKey),//
installJavaAndCurl(os),//
authorizePortInIpTables(8080),//
extractTargzIntoDirectory(URI.create(System.getProperty("test.jboss-url",
"http://d19xvfg065k8li.cloudfront.net/jboss-6.0.0.Final.tar.gz")), "/usr/local"),//
exec("{md} " + jbossHome), exec("mv /usr/local/jboss-*/* " + jbossHome),//
exec("chmod -R oug+r+w " + jbossHome)),//
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 -c jbossweb-standalone -b 0.0.0.0")));
return toReturn;
}
@ -96,28 +94,28 @@ public class RunScriptData {
}
public static final Statement APT_RUN_SCRIPT = newStatementList(//
exec(installAfterUpdatingIfNotPresent("curl")),//
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")),//
exec(new StringBuilder()//
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")//
// 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")//
.toString()));
exec(installAfterUpdatingIfNotPresent("curl")),//
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")),//
exec(new StringBuilder()//
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")//
// 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")//
.toString()));
public static final Statement YUM_RUN_SCRIPT = newStatementList(
exec("which curl ||yum --nogpgcheck -y install curl"),//
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")),//
exec(new StringBuilder()//
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n") //
.append("echo \"export PATH=\\\"\\$JAVA_HOME/bin/:\\$PATH\\\"\" >> /root/.bashrc")//
.toString()));
exec("which curl ||yum --nogpgcheck -y install curl"),//
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")),//
exec(new StringBuilder()//
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n") //
.append("echo \"export PATH=\\\"\\$JAVA_HOME/bin/:\\$PATH\\\"\" >> /root/.bashrc")//
.toString()));
public static final Statement ZYPPER_RUN_SCRIPT = exec(new StringBuilder()//
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")//
.append("which curl || zypper install curl\n")//
.append("(which java && java -fullversion 2>&1|egrep -q 1.6 ) || zypper install java-1.6.0-openjdk\n")//
.toString());
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")//
.append("which curl || zypper install curl\n")//
.append("(which java && java -fullversion 2>&1|egrep -q 1.6 ) || zypper install java-1.6.0-openjdk\n")//
.toString());
}

View File

@ -72,7 +72,7 @@ END_OF_FILE
iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
iptables -I RH-Firewall-1-INPUT 1 -p tcp --dport 8080 -j ACCEPT
iptables-save
curl -X GET -s --retry 20 http://commondatastorage.googleapis.com/jclouds-repo/jboss-as-distribution-6.0.0.20100911-M5.tar.gz |(mkdir -p /usr/local &&cd /usr/local &&tar -xpzf -)
curl -X GET -s --retry 20 http://d19xvfg065k8li.cloudfront.net/jboss-6.0.0.Final.tar.gz |(mkdir -p /usr/local &&cd /usr/local &&tar -xpzf -)
mkdir -p /usr/local/jboss
mv /usr/local/jboss-*/* /usr/local/jboss
chmod -R oug+r+w /usr/local/jboss
@ -96,7 +96,7 @@ END_OF_SCRIPT
# add desired commands from the user
cat >> $INSTANCE_HOME/jboss.sh <<'END_OF_SCRIPT'
cd $INSTANCE_HOME
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
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 -c jbossweb-standalone -b 0.0.0.0
END_OF_SCRIPT
# add runscript footer