You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by gr...@apache.org on 2014/11/03 19:39:30 UTC
[1/4] git commit: Make operating system name lowercase for Riak URL
Repository: incubator-brooklyn
Updated Branches:
refs/heads/master 5e6b9908e -> 83011fe09
Make operating system name lowercase for Riak URL
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/48370ae1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/48370ae1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/48370ae1
Branch: refs/heads/master
Commit: 48370ae1390d5eaf25c31f0ee5ab153dbb77ce5c
Parents: 1c17e73
Author: Andrew Kennedy <gr...@apache.org>
Authored: Mon Nov 3 15:49:49 2014 +0000
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Mon Nov 3 17:40:51 2014 +0000
----------------------------------------------------------------------
.../brooklyn/entity/nosql/riak/RiakNodeSshDriver.java | 13 ++++++++++++-
.../src/main/java/brooklyn/util/text/Strings.java | 7 ++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/48370ae1/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
index 830a798..42189f6 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
@@ -18,6 +18,15 @@
*/
package brooklyn.entity.nosql.riak;
+import static brooklyn.util.ssh.BashCommands.*;
+import static java.lang.String.format;
+
+import java.util.List;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import brooklyn.entity.basic.AbstractSoftwareProcessSshDriver;
import brooklyn.entity.basic.Attributes;
import brooklyn.entity.basic.Entities;
@@ -30,6 +39,8 @@ import brooklyn.util.net.Urls;
import brooklyn.util.os.Os;
import brooklyn.util.task.DynamicTasks;
import brooklyn.util.task.ssh.SshTasks;
+import brooklyn.util.text.Strings;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
@@ -114,7 +125,7 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
"export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"which apt-get",
ok(sudo("apt-get -y --allow-unauthenticated install logrotate libpam0g-dev libssl0.9.8")),
- "export OS_NAME=" + osDetails.getName(),
+ "export OS_NAME=" + Strings.toLowerCase(osDetails.getName()),
// TODO: Debian support (default debian image fails with 'sudo: command not found')
"debian".equals(osDetails.getName()) ?
"export OS_RELEASE=" + osDetails.getVersion().substring(0, osDetails.getVersion().indexOf(".")) :
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/48370ae1/utils/common/src/main/java/brooklyn/util/text/Strings.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/brooklyn/util/text/Strings.java b/utils/common/src/main/java/brooklyn/util/text/Strings.java
index 4c275c9..a52dcc9 100644
--- a/utils/common/src/main/java/brooklyn/util/text/Strings.java
+++ b/utils/common/src/main/java/brooklyn/util/text/Strings.java
@@ -587,7 +587,7 @@ public class Strings {
public static String toInitialCapOnly(String value) {
if (value==null || value.length()==0) return value;
- return value.substring(0, 1).toUpperCase() + value.substring(1).toLowerCase();
+ return value.substring(0, 1).toUpperCase(Locale.ENGLISH) + value.substring(1).toLowerCase(Locale.ENGLISH);
}
public static String reverse(String name) {
@@ -833,4 +833,9 @@ public class Strings {
return replaceAllRegex(x, "\\s+", whitespaceReplacement);
}
+ public static String toLowerCase(String value) {
+ if (value==null || value.length()==0) return value;
+ return value.toLowerCase(Locale.ENGLISH);
+ }
+
}
[3/4] git commit: Fixes Riak 2.0 on various clouds,
adds prelim work for Docker
Posted by gr...@apache.org.
Fixes Riak 2.0 on various clouds, adds prelim work for Docker
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/4abc623e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/4abc623e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/4abc623e
Branch: refs/heads/master
Commit: 4abc623ee28e20fc5cc2c18401ca37c01cc9fa12
Parents: 5e6b990
Author: Martin Harris <gi...@nakomis.com>
Authored: Fri Oct 31 16:27:02 2014 +0000
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Mon Nov 3 17:40:51 2014 +0000
----------------------------------------------------------------------
software/nosql/pom.xml | 2 +
.../brooklyn/entity/nosql/riak/RiakNode.java | 56 ++-
.../entity/nosql/riak/RiakNodeDriver.java | 2 +
.../entity/nosql/riak/RiakNodeImpl.java | 20 +
.../entity/nosql/riak/RiakNodeSshDriver.java | 146 +++---
.../brooklyn/entity/nosql/riak/app.config | 2 +-
.../brooklyn/entity/nosql/riak/riak-mac.conf | 494 +++++++++++++++++++
.../entity/nosql/riak/riak-with-webapp.yaml | 6 +-
.../brooklyn/entity/nosql/riak/riak.conf | 494 +++++++++++++++++++
9 files changed, 1149 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4abc623e/software/nosql/pom.xml
----------------------------------------------------------------------
diff --git a/software/nosql/pom.xml b/software/nosql/pom.xml
index 0b384a7..fdb7bc1 100644
--- a/software/nosql/pom.xml
+++ b/software/nosql/pom.xml
@@ -231,6 +231,8 @@
<exclude>src/main/resources/brooklyn/entity/nosql/redis/slave.conf</exclude>
<exclude>src/main/resources/brooklyn/entity/nosql/riak/app.config</exclude>
<exclude>src/main/resources/brooklyn/entity/nosql/riak/vm.args</exclude>
+ <exclude>src/main/resources/brooklyn/entity/nosql/riak/riak.conf</exclude>
+ <exclude>src/main/resources/brooklyn/entity/nosql/riak/riak-mac.conf</exclude>
<exclude>src/main/resources/brooklyn/entity/nosql/solr/solr.xml</exclude>
<!--
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4abc623e/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNode.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNode.java b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNode.java
index aef9de1..50089bc 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNode.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNode.java
@@ -20,6 +20,9 @@ package brooklyn.entity.nosql.riak;
import java.util.List;
+import brooklyn.entity.basic.Attributes;
+import brooklyn.event.basic.AttributeSensorAndConfigKey;
+import brooklyn.event.basic.TemplatedStringAttributeSensorAndConfigKey;
import com.google.common.reflect.TypeToken;
import brooklyn.catalog.Catalog;
@@ -42,8 +45,10 @@ public interface RiakNode extends SoftwareProcess {
@SetFromFlag("version")
ConfigKey<String> SUGGESTED_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION,
- "2.0.0");
+ "2.0.1");
+ // vm.args and app.config are used for pre-version 2.0.0. Later versions use the (simplified) riak.conf
+ // see https://github.com/joedevivo/ricon/blob/master/cuttlefish.md
@SetFromFlag("vmArgsTemplateUrl")
ConfigKey<String> RIAK_VM_ARGS_TEMPLATE_URL = ConfigKeys.newStringConfigKey(
"riak.vmArgs.templateUrl", "Template file (in freemarker format) for the vm.args config file",
@@ -52,6 +57,33 @@ public interface RiakNode extends SoftwareProcess {
ConfigKey<String> RIAK_APP_CONFIG_TEMPLATE_URL = ConfigKeys.newStringConfigKey(
"riak.appConfig.templateUrl", "Template file (in freemarker format) for the app.config config file",
"classpath://brooklyn/entity/nosql/riak/app.config");
+ @SetFromFlag("appConfigTemplateUrlLinux")
+ ConfigKey<String> RIAK_CONF_TEMPLATE_URL_LINUX = ConfigKeys.newStringConfigKey(
+ "riak.riakConf.templateUrl.linux", "Template file (in freemarker format) for the app.config config file",
+ "classpath://brooklyn/entity/nosql/riak/riak.conf");
+ @SetFromFlag("appConfigTemplateUrlMac")
+ ConfigKey<String> RIAK_CONF_TEMPLATE_URL_MAC = ConfigKeys.newStringConfigKey(
+ "riak.riakConf.templateUrl.mac", "Template file (in freemarker format) for the app.config config file",
+ "classpath://brooklyn/entity/nosql/riak/riak-mac.conf");
+
+ @SetFromFlag("downloadUrlRhelCentos")
+ AttributeSensorAndConfigKey DOWNLOAD_URL_RHEL_CENTOS = new TemplatedStringAttributeSensorAndConfigKey("download.url.rhelcentos",
+ "URL pattern for downloading the linux RPM installer (will substitute things like ${version} automatically)",
+ "http://s3.amazonaws.com/downloads.basho.com/riak/${entity.majorVersion}/${entity.fullVersion}/rhel/${entity.osMajorVersion}/riak-${entity.fullVersion}-1.el6.x86_64.rpm");
+
+ @SetFromFlag("downloadUrlUbuntuDebian")
+ AttributeSensorAndConfigKey DOWNLOAD_URL_UBUNTU_DEBIAN = new TemplatedStringAttributeSensorAndConfigKey("download.url.ubuntudebian",
+ "URL pattern for downloading the linux RPM installer (will substitute things like ${version} automatically)",
+ "http://s3.amazonaws.com/downloads.basho.com/riak/${entity.majorVersion}/${entity.fullVersion}/$OS_NAME/$OS_RELEASE/riak_${entity.fullVersion}-1_amd64.deb");
+
+ @SetFromFlag("downloadUrlMac")
+ AttributeSensorAndConfigKey DOWNLOAD_URL_MAC = new TemplatedStringAttributeSensorAndConfigKey("download.url.mac",
+ "URL pattern for downloading the MAC binaries tarball (will substitute things like ${version} automatically)",
+ "http://s3.amazonaws.com/downloads.basho.com/riak/${entity.majorVersion}/${entity.fullVersion}/osx/10.8/riak-${entity.fullVersion}-OSX-x86_64.tar.gz");
+
+ // NB these two needed for clients to access
+ @SetFromFlag("riakWebPort")
+ PortAttributeSensorAndConfigKey RIAK_WEB_PORT = new PortAttributeSensorAndConfigKey("riak.webPort", "Riak Web Port", "8098+");
@SetFromFlag("riakNodeHasJoinedCluster")
AttributeSensor<Boolean> RIAK_NODE_HAS_JOINED_CLUSTER = Sensors.newBooleanSensor(
@@ -59,10 +91,6 @@ public interface RiakNode extends SoftwareProcess {
@SetFromFlag("riakNodeName")
AttributeSensor<String> RIAK_NODE_NAME = Sensors.newStringSensor("riak.node", "Returns the riak node name as defined in vm.args");
-
- // NB these two needed for clients to access
- @SetFromFlag("riakWebPort")
- PortAttributeSensorAndConfigKey RIAK_WEB_PORT = new PortAttributeSensorAndConfigKey("riak.webPort", "Riak Web Port", "8098+");
@SetFromFlag("riakPbPort")
PortAttributeSensorAndConfigKey RIAK_PB_PORT = new PortAttributeSensorAndConfigKey("riak.pbPort", "Riak Protocol Buffers Port", "8087+");
// these needed for nodes to talk to each other, but not clients (so ideally set up in the security group for internal access)
@@ -70,6 +98,8 @@ public interface RiakNode extends SoftwareProcess {
PortAttributeSensorAndConfigKey EPMD_LISTENER_PORT = new PortAttributeSensorAndConfigKey("riak.epmdListenerPort", "Erlang Port Mapper Daemon Listener Port", "4369");
PortAttributeSensorAndConfigKey ERLANG_PORT_RANGE_START = new PortAttributeSensorAndConfigKey("riak.erlangPortRangeStart", "Erlang Port Range Start", "6000+");
PortAttributeSensorAndConfigKey ERLANG_PORT_RANGE_END = new PortAttributeSensorAndConfigKey("riak.erlangPortRangeEnd", "Erlang Port Range End", "7999+");
+ PortAttributeSensorAndConfigKey SEARCH_SOLR_PORT = new PortAttributeSensorAndConfigKey("riak.search.solr.port", "Solr port", "8093+");
+ PortAttributeSensorAndConfigKey SEARCH_SOLR_JMX_PORT = new PortAttributeSensorAndConfigKey("riak.search.solr.jmx_port", "Solr port", "8985+");
AttributeSensor<Integer> NODE_GETS = Sensors.newIntegerSensor("node.gets");
AttributeSensor<Integer> NODE_GETS_TOTAL = Sensors.newIntegerSensor("node.gets.total");
AttributeSensor<Integer> NODE_PUTS = Sensors.newIntegerSensor("node.puts");
@@ -89,10 +119,8 @@ public interface RiakNode extends SoftwareProcess {
AttributeSensor<Integer> PBC_CONNECTS = Sensors.newIntegerSensor("pbc.connects");
AttributeSensor<Integer> PBC_ACTIVE = Sensors.newIntegerSensor("pbc.active");
@SuppressWarnings("serial")
- AttributeSensor<List<String>> RING_MEMBERS = Sensors.newSensor(new TypeToken<List<String>>() {
- },
- "ring.members", "all the riak nodes in the ring"
- );
+ AttributeSensor<List<String>> RING_MEMBERS = Sensors.newSensor(new TypeToken<List<String>>() {},
+ "ring.members", "all the riak nodes in the ring");
public static final MethodEffector<Void> JOIN_RIAK_CLUSTER = new MethodEffector<Void>(RiakNode.class, "joinCluster");
public static final MethodEffector<Void> LEAVE_RIAK_CLUSTER = new MethodEffector<Void>(RiakNode.class, "leaveCluster");
public static final MethodEffector<Void> COMMIT_RIAK_CLUSTER = new MethodEffector<Void>(RiakNode.class, "commitCluster");
@@ -110,6 +138,16 @@ public interface RiakNode extends SoftwareProcess {
Integer getErlangPortRangeEnd();
+ Integer getSearchSolrPort();
+
+ Integer getSearchSolrJmxPort();
+
+ String getFullVersion();
+
+ String getMajorVersion();
+
+ String getOsMajorVersion();
+
@Effector(description = "add this riak node to the riak cluster")
public void joinCluster(@EffectorParam(name = "nodeName") String nodeName);
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4abc623e/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeDriver.java b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeDriver.java
index fcfbc3b..7275bbf 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeDriver.java
@@ -33,4 +33,6 @@ public interface RiakNodeDriver extends SoftwareProcessDriver {
public void recoverFailedNode(String nodeName);
public void commitCluster();
+
+ public String getOsMajorVersion();
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4abc623e/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeImpl.java b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeImpl.java
index e7deb3d..f762ac9 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeImpl.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeImpl.java
@@ -212,4 +212,24 @@ public class RiakNodeImpl extends SoftwareProcessImpl implements RiakNode {
return getAttribute(RiakNode.ERLANG_PORT_RANGE_END);
}
+ public Integer getSearchSolrPort() {
+ return getAttribute(RiakNode.SEARCH_SOLR_PORT);
+ }
+
+ public Integer getSearchSolrJmxPort() {
+ return getAttribute(RiakNode.SEARCH_SOLR_JMX_PORT);
+ }
+
+ public String getMajorVersion() {
+ return getFullVersion().substring(0, 3);
+ }
+
+ public String getFullVersion() {
+ return getConfig(RiakNode.SUGGESTED_VERSION);
+ }
+
+ public String getOsMajorVersion() {
+ return getDriver().getOsMajorVersion();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4abc623e/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
index a06f5a0..a596e6f 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
@@ -18,21 +18,6 @@
*/
package brooklyn.entity.nosql.riak;
-import static brooklyn.util.ssh.BashCommands.INSTALL_CURL;
-import static brooklyn.util.ssh.BashCommands.INSTALL_TAR;
-import static brooklyn.util.ssh.BashCommands.alternatives;
-import static brooklyn.util.ssh.BashCommands.chainGroup;
-import static brooklyn.util.ssh.BashCommands.commandToDownloadUrlAs;
-import static brooklyn.util.ssh.BashCommands.ok;
-import static brooklyn.util.ssh.BashCommands.sudo;
-import static java.lang.String.format;
-
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import brooklyn.entity.basic.AbstractSoftwareProcessSshDriver;
import brooklyn.entity.basic.Attributes;
import brooklyn.entity.basic.Entities;
@@ -43,12 +28,19 @@ import brooklyn.location.basic.SshMachineLocation;
import brooklyn.util.collections.MutableMap;
import brooklyn.util.net.Urls;
import brooklyn.util.os.Os;
-import brooklyn.util.ssh.BashCommands;
import brooklyn.util.task.DynamicTasks;
-
+import brooklyn.util.task.ssh.SshTasks;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.Map;
+
+import static brooklyn.util.ssh.BashCommands.*;
+import static java.lang.String.format;
// TODO: Alter -env ERL_CRASH_DUMP path in vm.args
public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implements RiakNodeDriver {
@@ -72,7 +64,9 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
MutableMap<String, String> result = MutableMap.copyOf(super.getShellEnvironment());
// how to change epmd port, according to
// http://serverfault.com/questions/582787/how-to-change-listening-interface-of-rabbitmqs-epmd-port-4369
- result.put("ERL_EPMD_PORT", "" + Integer.toString(getEntity().getEpmdListenerPort()));
+ if (getEntity().getEpmdListenerPort() != null) {
+ result.put("ERL_EPMD_PORT", "" + Integer.toString(getEntity().getEpmdListenerPort()));
+ }
return result;
}
@@ -84,7 +78,9 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
@Override
public void install() {
- String saveAs = resolver.getFilename();
+ if (entity.getConfig(Attributes.DOWNLOAD_URL) != null) {
+ LOG.warn("Ignoring download.url {}, use download.url.rhelcentos or download.url.mac", entity.getConfig(Attributes.DOWNLOAD_URL));
+ }
OsDetails osDetails = getMachine().getMachineDetails().getOsDetails();
List<String> commands = Lists.newLinkedList();
@@ -92,7 +88,7 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
commands.addAll(installLinux(getExpandedInstallDir()));
} else if (osDetails.isMac()) {
isPackageInstall = false;
- commands.addAll(installMac(saveAs));
+ commands.addAll(installMac());
} else if (osDetails.isWindows()) {
throw new UnsupportedOperationException("RiakNode not supported on Windows instances");
} else {
@@ -101,32 +97,39 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
}
newScript(INSTALLING)
.body.append(commands)
+ .failIfBodyEmpty()
+ .failOnNonZeroResultCode()
.execute();
}
private List<String> installLinux(String expandedInstallDir) {
- LOG.info("Ignoring version config ({}) and installing from package manager", getEntity().getConfig(RiakNode.SUGGESTED_VERSION));
- OsDetails osDetails = getMachine().getMachineDetails().getOsDetails();
- String osVersion = osDetails.getVersion();
- String osMajorVersion = osVersion.contains(".") ? osVersion.substring(0, osVersion.indexOf(".")) : osVersion;
- String fullVersion = getEntity().getConfig(RiakNode.SUGGESTED_VERSION);
- String majorVersion = fullVersion.substring(0, 3);
+
+ DynamicTasks.queueIfPossible(SshTasks.dontRequireTtyForSudo(getMachine(), SshTasks.OnFailingTask.WARN_OR_IF_DYNAMIC_FAIL_MARKING_INESSENTIAL)).orSubmitAndBlock();
+
+ isPackageInstall = true;
+
String installBin = Urls.mergePaths(expandedInstallDir, "bin");
+ String saveAsYum = "riak.rpm";
+ String saveAsApt = "riak.deb";
+ OsDetails osDetails = getMachine().getOsDetails();
String apt = chainGroup(
//debian fix
"export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"which apt-get",
ok(sudo("apt-get -y --allow-unauthenticated install logrotate libpam0g-dev libssl0.9.8")),
+ "export OS_NAME=" + osDetails.getName(),
// TODO: Debian support (default debian image fails with 'sudo: command not found')
- "[[ \"lucid natty precise\" =~ (^| )`lsb_release -sc`($| ) ]] && export OS_RELEASE=`lsb_release -sc` || export OS_RELEASE=precise",
- String.format("wget http://s3.amazonaws.com/downloads.basho.com/riak/%s/%s/ubuntu/$OS_RELEASE/riak_%<s-1_amd64.deb", majorVersion, fullVersion),
- sudo(String.format("dpkg -i riak_%s-1_amd64.deb", fullVersion)),
- sudo("apt-get -y --allow-unauthenticated -f install"));
+ "debian".equals(osDetails.getName()) ?
+ "export OS_RELEASE=" + osDetails.getVersion().substring(0, osDetails.getVersion().indexOf(".")) :
+ "export OS_RELEASE=`lsb_release -sc` && " +
+ "export OS_RELEASE=`([[ \"lucid natty precise\" =~ (^| )\\$OS_RELEASE($| ) ]] && echo $OS_RELEASE || echo precise)`",
+ String.format("wget -O %s %s", saveAsApt, entity.getAttribute(RiakNode.DOWNLOAD_URL_UBUNTU_DEBIAN)),
+ sudo(String.format("dpkg -i %s", saveAsApt)));
String yum = chainGroup(
"which yum",
ok(sudo("yum -y install openssl")),
- String.format("wget http://s3.amazonaws.com/downloads.basho.com/riak/%s/%s/rhel/%s/riak-%s-1.el6.x86_64.rpm", majorVersion, fullVersion, osMajorVersion, fullVersion),
- sudo(String.format("rpm -Uvh riak-%s-1.el6.x86_64.rpm", fullVersion)));
+ String.format("wget -O %s %s", saveAsYum, entity.getAttribute(RiakNode.DOWNLOAD_URL_RHEL_CENTOS)),
+ sudo(String.format("rpm -Uvh %s", saveAsYum)));
return ImmutableList.<String>builder()
.add("mkdir -p " + installBin)
.add(INSTALL_CURL)
@@ -136,13 +139,9 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
.build();
}
- private List<String> installMac(String saveAs) {
- String fullVersion = getEntity().getConfig(RiakNode.SUGGESTED_VERSION);
- String majorVersion = fullVersion.substring(0, 3);
- // Docs refer to 10.8. No download for 10.9 seems to exist.
- String hostOsVersion = "10.8";
- String url = String.format("http://s3.amazonaws.com/downloads.basho.com/riak/%s/%s/osx/%s/riak-%s-OSX-x86_64.tar.gz",
- majorVersion, fullVersion, hostOsVersion, fullVersion);
+ protected List<String> installMac() {
+ String saveAs = resolver.getFilename();
+ String url = entity.getAttribute(RiakNode.DOWNLOAD_URL_MAC).toString();
return ImmutableList.<String>builder()
.add(INSTALL_TAR)
.add(INSTALL_CURL)
@@ -163,23 +162,32 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
List<String> commands = Lists.newLinkedList();
commands.add(sudo("mkdir -p " + getRiakEtcDir()));
- String vmArgsTemplate = processTemplate(entity.getConfig(RiakNode.RIAK_VM_ARGS_TEMPLATE_URL));
- String saveAsVmArgs = Urls.mergePaths(getRunDir(), "vm.args");
- DynamicTasks.queueIfPossible(SshEffectorTasks.put(saveAsVmArgs).contents(vmArgsTemplate));
- commands.add(sudo("mv " + saveAsVmArgs + " " + getRiakEtcDir()));
+ if (isVersion1()) {
+ String vmArgsTemplate = processTemplate(entity.getConfig(RiakNode.RIAK_VM_ARGS_TEMPLATE_URL));
+ String saveAsVmArgs = Urls.mergePaths(getRunDir(), "vm.args");
+ DynamicTasks.queueIfPossible(SshEffectorTasks.put(saveAsVmArgs).contents(vmArgsTemplate));
+ commands.add(sudo("mv " + saveAsVmArgs + " " + getRiakEtcDir()));
- String appConfigTemplate = processTemplate(entity.getConfig(RiakNode.RIAK_APP_CONFIG_TEMPLATE_URL));
- String saveAsAppConfig = Urls.mergePaths(getRunDir(), "app.config");
- DynamicTasks.queueIfPossible(SshEffectorTasks.put(saveAsAppConfig).contents(appConfigTemplate));
- commands.add(sudo("mv " + saveAsAppConfig + " " + getRiakEtcDir()));
+ String appConfigTemplate = processTemplate(entity.getConfig(RiakNode.RIAK_APP_CONFIG_TEMPLATE_URL));
+ String saveAsAppConfig = Urls.mergePaths(getRunDir(), "app.config");
+ DynamicTasks.queueIfPossible(SshEffectorTasks.put(saveAsAppConfig).contents(appConfigTemplate));
+ commands.add(sudo("mv " + saveAsAppConfig + " " + getRiakEtcDir()));
+ } else {
+ String templateUrl = osDetails.isMac() ? entity.getConfig(RiakNode.RIAK_CONF_TEMPLATE_URL_MAC) :
+ entity.getConfig(RiakNode.RIAK_CONF_TEMPLATE_URL_LINUX);
+ String riakConfTemplate = processTemplate(templateUrl);
+ String saveAsRiakConf = Urls.mergePaths(getRunDir(), "riak.conf");
+ DynamicTasks.queueIfPossible(SshEffectorTasks.put(saveAsRiakConf).contents(riakConfTemplate));
+ commands.add(sudo("mv " + saveAsRiakConf + " " + getRiakEtcDir()));
+ }
//increase open file limit (default min for riak is: 4096)
- //TODO: detect the actual limit then do the modificaiton.
+ //TODO: detect the actual limit then do the modification.
//TODO: modify ulimit for linux distros
// commands.add(sudo("launchctl limit maxfiles 4096 32768"));
if (osDetails.isMac()) {
commands.add("ulimit -n 4096");
- } else if (osDetails.isLinux()) {
+ } else if (osDetails.isLinux() && isVersion1()) {
commands.add(sudo("chown -R riak:riak " + getRiakEtcDir()));
}
@@ -192,7 +200,7 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
log.warn("riak command not found on PATH. Altering future commands' environment variables from {} to {}", getShellEnvironment(), newPathVariable);
customizeScript.environmentVariablesReset(newPathVariable);
}
- customizeScript.execute();
+ customizeScript.failOnNonZeroResultCode().execute();
//set the riak node name
entity.setAttribute(RiakNode.RIAK_NODE_NAME, format("riak@%s", getEntity().getAttribute(Attributes.SUBNET_HOSTNAME)));
@@ -200,19 +208,25 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
@Override
public void launch() {
-
- String command = format("%s start >/dev/null 2>&1 < /dev/null &", getRiakCmd());
- command = isPackageInstall ? BashCommands.sudo(command) : command;
+ List<String> commands = Lists.newLinkedList();
+ if (isPackageInstall) {
+ commands.add(sudo("service riak start"));
+ } else {
+ // NOTE: See instructions at http://superuser.com/questions/433746/is-there-a-fix-for-the-too-many-open-files-in-system-error-on-os-x-10-7-1
+ // for increasing the system limit for number of open files
+ commands.add("ulimit -n 65536 || true"); // `BashCommands.ok` will put this in parentheses, which will set ulimit -n in the subshell
+ commands.add(format("%s start >/dev/null 2>&1 < /dev/null &", getRiakCmd()));
+ }
ScriptHelper launchScript = newScript(LAUNCHING)
- .body.append(command);
+ .body.append(commands);
if (!isRiakOnPath) {
Map<String, String> newPathVariable = ImmutableMap.of("PATH", sbinPath);
log.warn("riak command not found on PATH. Altering future commands' environment variables from {} to {}", getShellEnvironment(), newPathVariable);
launchScript.environmentVariablesReset(newPathVariable);
}
- launchScript.execute();
+ launchScript.failOnNonZeroResultCode().execute();
}
@Override
@@ -232,7 +246,7 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
stopScript.environmentVariablesReset(newPathVariable);
}
- int result = stopScript.execute();
+ int result = stopScript.failOnNonZeroResultCode().execute();
if (result != 0) {
newScript(ImmutableMap.of(USE_PID_FILE, ""), STOPPING).execute();
}
@@ -240,7 +254,6 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
@Override
public boolean isRunning() {
-
// Version 2.0.0 requires sudo for `riak ping`
ScriptHelper checkRunningScript = newScript(CHECK_RUNNING)
.body.append(sudo(format("%s ping", getRiakCmd())));
@@ -303,7 +316,8 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
ScriptHelper leaveClusterScript = newScript("leaveCluster")
.body.append(sudo(format("%s cluster leave", getRiakAdminCmd())))
.body.append(sudo(format("%s cluster plan", getRiakAdminCmd())))
- .body.append(sudo(format("%s cluster commit", getRiakAdminCmd())));
+ .body.append(sudo(format("%s cluster commit", getRiakAdminCmd())))
+ .failOnNonZeroResultCode();
if (!isRiakOnPath) {
Map<String, String> newPathVariable = ImmutableMap.of("PATH", sbinPath);
@@ -324,8 +338,9 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
if (hasJoinedCluster()) {
ScriptHelper commitClusterScript = newScript("commitCluster")
- .body.append(format("%s cluster plan", getRiakAdminCmd()))
- .body.append(format("%s cluster commit", getRiakAdminCmd()));
+ .body.append(sudo(format("%s cluster plan", getRiakAdminCmd())))
+ .body.append(sudo(format("%s cluster commit", getRiakAdminCmd())))
+ .failOnNonZeroResultCode();
if (!isRiakOnPath) {
Map<String, String> newPathVariable = ImmutableMap.of("PATH", sbinPath);
@@ -401,4 +416,15 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
//TODO: check for non-package install.
return isPackageInstall ? "/var/lib/riak/ring" : Urls.mergePaths(getExpandedInstallDir(), "lib/ring");
}
+
+ private boolean isVersion1() {
+ return getVersion().startsWith("1.");
+ }
+
+ @Override
+ public String getOsMajorVersion() {
+ OsDetails osDetails = getMachine().getMachineDetails().getOsDetails();
+ String osVersion = osDetails.getVersion();
+ return osVersion.contains(".") ? osVersion.substring(0, osVersion.indexOf(".")) : osVersion;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4abc623e/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/app.config
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/app.config b/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/app.config
index f1100fa..7ee8a37 100644
--- a/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/app.config
+++ b/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/app.config
@@ -326,7 +326,7 @@
%% riak_control config
{riak_control, [
%% Set to false to disable the admin panel.
- {enabled, false},
+ {enabled, true},
%% Authentication style used for access to the admin
%% panel. Valid styles are 'userlist' <TODO>.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4abc623e/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak-mac.conf
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak-mac.conf b/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak-mac.conf
new file mode 100644
index 0000000..d123000
--- /dev/null
+++ b/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak-mac.conf
@@ -0,0 +1,494 @@
+## Brooklyn note: file from 2.0.1 Mac install, with erlang section added, and ports templated
+
+## Where to emit the default log messages (typically at 'info'
+## severity):
+## off: disabled
+## file: the file specified by log.console.file
+## console: to standard output (seen when using `riak attach-direct`)
+## both: log.console.file and standard out.
+##
+## Default: file
+##
+## Acceptable values:
+## - one of: off, file, console, both
+log.console = file
+
+## The severity level of the console log, default is 'info'.
+##
+## Default: info
+##
+## Acceptable values:
+## - one of: debug, info, notice, warning, error, critical, alert, emergency, none
+log.console.level = info
+
+## When 'log.console' is set to 'file' or 'both', the file where
+## console messages will be logged.
+##
+## Default: $(platform_log_dir)/console.log
+##
+## Acceptable values:
+## - the path to a file
+log.console.file = $(platform_log_dir)/console.log
+
+## The file where error messages will be logged.
+##
+## Default: $(platform_log_dir)/error.log
+##
+## Acceptable values:
+## - the path to a file
+log.error.file = $(platform_log_dir)/error.log
+
+## When set to 'on', enables log output to syslog.
+##
+## Default: off
+##
+## Acceptable values:
+## - on or off
+log.syslog = off
+
+## Whether to enable the crash log.
+##
+## Default: on
+##
+## Acceptable values:
+## - on or off
+log.crash = on
+
+## If the crash log is enabled, the file where its messages will
+## be written.
+##
+## Default: $(platform_log_dir)/crash.log
+##
+## Acceptable values:
+## - the path to a file
+log.crash.file = $(platform_log_dir)/crash.log
+
+## Maximum size in bytes of individual messages in the crash log
+##
+## Default: 64KB
+##
+## Acceptable values:
+## - a byte size with units, e.g. 10GB
+log.crash.maximum_message_size = 64KB
+
+## Maximum size of the crash log in bytes, before it is rotated
+##
+## Default: 10MB
+##
+## Acceptable values:
+## - a byte size with units, e.g. 10GB
+log.crash.size = 10MB
+
+## The schedule on which to rotate the crash log. For more
+## information see:
+## https://github.com/basho/lager/blob/master/README.md#internal-log-rotation
+##
+## Default: $D0
+##
+## Acceptable values:
+## - text
+log.crash.rotation = $D0
+
+## The number of rotated crash logs to keep. When set to
+## 'current', only the current open log file is kept.
+##
+## Default: 5
+##
+## Acceptable values:
+## - an integer
+## - the text "current"
+log.crash.rotation.keep = 5
+
+## Name of the Erlang node
+##
+## Default: riak@127.0.0.1
+##
+## Acceptable values:
+## - text
+nodename = riak@${driver.hostname}
+
+## Cookie for distributed node communication. All nodes in the
+## same cluster should use the same cookie or they will not be able to
+## communicate.
+##
+## Default: riak
+##
+## Acceptable values:
+## - text
+distributed_cookie = riak
+
+## Sets the number of threads in async thread pool, valid range
+## is 0-1024. If thread support is available, the default is 64.
+## More information at: http://erlang.org/doc/man/erl.html
+##
+## Default: 64
+##
+## Acceptable values:
+## - an integer
+erlang.async_threads = 64
+
+## The number of concurrent ports/sockets
+## Valid range is 1024-134217727
+##
+## Default: 65536
+##
+## Acceptable values:
+## - an integer
+erlang.max_ports = 65536
+
+## Set scheduler forced wakeup interval. All run queues will be
+## scanned each Interval milliseconds. While there are sleeping
+## schedulers in the system, one scheduler will be woken for each
+## non-empty run queue found. An Interval of zero disables this
+## feature, which also is the default.
+## This feature is a workaround for lengthy executing native code, and
+## native code that do not bump reductions properly.
+## More information: http://www.erlang.org/doc/man/erl.html#+sfwi
+##
+## Acceptable values:
+## - an integer
+## erlang.schedulers.force_wakeup_interval = 500
+
+## Enable or disable scheduler compaction of load. By default
+## scheduler compaction of load is enabled. When enabled, load
+## balancing will strive for a load distribution which causes as many
+## scheduler threads as possible to be fully loaded (i.e., not run out
+## of work). This is accomplished by migrating load (e.g. runnable
+## processes) into a smaller set of schedulers when schedulers
+## frequently run out of work. When disabled, the frequency with which
+## schedulers run out of work will not be taken into account by the
+## load balancing logic.
+## More information: http://www.erlang.org/doc/man/erl.html#+scl
+##
+## Acceptable values:
+## - one of: true, false
+## erlang.schedulers.compaction_of_load = false
+
+## Enable or disable scheduler utilization balancing of load. By
+## default scheduler utilization balancing is disabled and instead
+## scheduler compaction of load is enabled which will strive for a
+## load distribution which causes as many scheduler threads as
+## possible to be fully loaded (i.e., not run out of work). When
+## scheduler utilization balancing is enabled the system will instead
+## try to balance scheduler utilization between schedulers. That is,
+## strive for equal scheduler utilization on all schedulers.
+## More information: http://www.erlang.org/doc/man/erl.html#+sub
+##
+## Acceptable values:
+## - one of: true, false
+## erlang.schedulers.utilization_balancing = true
+
+## Number of partitions in the cluster (only valid when first
+## creating the cluster). Must be a power of 2, minimum 8 and maximum
+## 1024.
+##
+## Default: 64
+##
+## Acceptable values:
+## - an integer
+## ring_size = 64
+
+## Number of concurrent node-to-node transfers allowed.
+##
+## Default: 2
+##
+## Acceptable values:
+## - an integer
+## transfer_limit = 2
+
+## Default cert location for https can be overridden
+## with the ssl config variable, for example:
+##
+## Acceptable values:
+## - the path to a file
+## ssl.certfile = $(platform_etc_dir)/cert.pem
+
+## Default key location for https can be overridden with the ssl
+## config variable, for example:
+##
+## Acceptable values:
+## - the path to a file
+## ssl.keyfile = $(platform_etc_dir)/key.pem
+
+## Default signing authority location for https can be overridden
+## with the ssl config variable, for example:
+##
+## Acceptable values:
+## - the path to a file
+## ssl.cacertfile = $(platform_etc_dir)/cacertfile.pem
+
+## DTrace support Do not enable 'dtrace' unless your Erlang/OTP
+## runtime is compiled to support DTrace. DTrace is available in
+## R15B01 (supported by the Erlang/OTP official source package) and in
+## R14B04 via a custom source repository & branch.
+##
+## Default: off
+##
+## Acceptable values:
+## - on or off
+dtrace = off
+
+## Platform-specific installation paths (substituted by rebar)
+##
+## Default: ./bin
+##
+## Acceptable values:
+## - the path to a directory
+platform_bin_dir = ./bin
+
+##
+## Default: ./data
+##
+## Acceptable values:
+## - the path to a directory
+platform_data_dir = ./data
+
+##
+## Default: ./etc
+##
+## Acceptable values:
+## - the path to a directory
+platform_etc_dir = ./etc
+
+##
+## Default: ./lib
+##
+## Acceptable values:
+## - the path to a directory
+platform_lib_dir = ./lib
+
+##
+## Default: ./log
+##
+## Acceptable values:
+## - the path to a directory
+platform_log_dir = ./log
+
+## Enable consensus subsystem. Set to 'on' to enable the
+## consensus subsystem used for strongly consistent Riak operations.
+##
+## Default: off
+##
+## Acceptable values:
+## - on or off
+## strong_consistency = on
+
+## listener.http.<name> is an IP address and TCP port that the Riak
+## HTTP interface will bind.
+##
+## Default: 127.0.0.1:8098
+##
+## Acceptable values:
+## - an IP/port pair, e.g. 127.0.0.1:10011
+listener.http.internal = 0.0.0.0:${entity.riakWebPort?c}
+
+## listener.protobuf.<name> is an IP address and TCP port that the Riak
+## Protocol Buffers interface will bind.
+##
+## Default: 127.0.0.1:8087
+##
+## Acceptable values:
+## - an IP/port pair, e.g. 127.0.0.1:10011
+listener.protobuf.internal = 0.0.0.0:${entity.riakPbPort?c}
+
+## The maximum length to which the queue of pending connections
+## may grow. If set, it must be an integer > 0. If you anticipate a
+## huge number of connections being initialized *simultaneously*, set
+## this number higher.
+##
+## Default: 128
+##
+## Acceptable values:
+## - an integer
+## protobuf.backlog = 128
+
+## listener.https.<name> is an IP address and TCP port that the Riak
+## HTTPS interface will bind.
+##
+## Acceptable values:
+## - an IP/port pair, e.g. 127.0.0.1:10011
+## listener.https.internal = 127.0.0.1:8098
+
+## How Riak will repair out-of-sync keys. Some features require
+## this to be set to 'active', including search.
+## * active: out-of-sync keys will be repaired in the background
+## * passive: out-of-sync keys are only repaired on read
+## * active-debug: like active, but outputs verbose debugging
+## information
+##
+## Default: active
+##
+## Acceptable values:
+## - one of: active, passive, active-debug
+anti_entropy = active
+
+## Specifies the storage engine used for Riak's key-value data
+## and secondary indexes (if supported).
+##
+## Default: bitcask
+##
+## Acceptable values:
+## - one of: bitcask, leveldb, memory, multi
+storage_backend = bitcask
+
+## Controls which binary representation of a riak value is stored
+## on disk.
+## * 0: Original erlang:term_to_binary format. Higher space overhead.
+## * 1: New format for more compact storage of small values.
+##
+## Default: 1
+##
+## Acceptable values:
+## - the integer 1
+## - the integer 0
+object.format = 1
+
+## Reading or writing objects bigger than this size will write a
+## warning in the logs.
+##
+## Default: 5MB
+##
+## Acceptable values:
+## - a byte size with units, e.g. 10GB
+object.size.warning_threshold = 5MB
+
+## Writing an object bigger than this will send a failure to the
+## client.
+##
+## Default: 50MB
+##
+## Acceptable values:
+## - a byte size with units, e.g. 10GB
+object.size.maximum = 50MB
+
+## Writing an object with more than this number of siblings will
+## generate a warning in the logs.
+##
+## Default: 25
+##
+## Acceptable values:
+## - an integer
+object.siblings.warning_threshold = 25
+
+## Writing an object with more than this number of siblings will
+## send a failure to the client.
+##
+## Default: 100
+##
+## Acceptable values:
+## - an integer
+object.siblings.maximum = 100
+
+## A path under which bitcask data files will be stored.
+##
+## Default: $(platform_data_dir)/bitcask
+##
+## Acceptable values:
+## - the path to a directory
+bitcask.data_root = $(platform_data_dir)/bitcask
+
+## Configure how Bitcask writes data to disk.
+## erlang: Erlang's built-in file API
+## nif: Direct calls to the POSIX C API
+## The NIF mode provides higher throughput for certain
+## workloads, but has the potential to negatively impact
+## the Erlang VM, leading to higher worst-case latencies
+## and possible throughput collapse.
+##
+## Default: erlang
+##
+## Acceptable values:
+## - one of: erlang, nif
+bitcask.io_mode = erlang
+
+## Set to 'off' to disable the admin panel.
+##
+## Default: off
+##
+## Acceptable values:
+## - on or off
+riak_control = on
+
+## Authentication mode used for access to the admin panel.
+##
+## Default: off
+##
+## Acceptable values:
+## - one of: off, userlist
+riak_control.auth.mode = off
+
+## If riak control's authentication mode (riak_control.auth.mode)
+## is set to 'userlist' then this is the list of usernames and
+## passwords for access to the admin panel.
+## To create users with given names, add entries of the format:
+## riak_control.auth.user.USERNAME.password = PASSWORD
+## replacing USERNAME with the desired username and PASSWORD with the
+## desired password for that user.
+##
+## Acceptable values:
+## - text
+## riak_control.auth.user.admin.password = pass
+
+## This parameter defines the percentage of total server memory
+## to assign to LevelDB. LevelDB will dynamically adjust its internal
+## cache sizes to stay within this size. The memory size can
+## alternately be assigned as a byte count via leveldb.maximum_memory
+## instead.
+##
+## Default: 70
+##
+## Acceptable values:
+## - an integer
+leveldb.maximum_memory.percent = 70
+
+## To enable Search set this 'on'.
+##
+## Default: off
+##
+## Acceptable values:
+## - on or off
+search = off
+
+## How long Riak will wait for Solr to start. The start sequence
+## will be tried twice. If both attempts timeout, then the Riak node
+## will be shutdown. This may need to be increased as more data is
+## indexed and Solr takes longer to start. Values lower than 1s will
+## be rounded up to the minimum 1s.
+##
+## Default: 30s
+##
+## Acceptable values:
+## - a time duration with units, e.g. '10s' for 10 seconds
+search.solr.start_timeout = 30s
+
+## The port number which Solr binds to.
+## NOTE: Binds on every interface.
+##
+## Default: 8093
+##
+## Acceptable values:
+## - an integer
+search.solr.port = ${entity.searchSolrPort?c}
+
+## The port number which Solr JMX binds to.
+## NOTE: Binds on every interface.
+##
+## Default: 8985
+##
+## Acceptable values:
+## - an integer
+search.solr.jmx_port = ${entity.searchSolrJmxPort?c}
+
+## The options to pass to the Solr JVM. Non-standard options,
+## i.e. -XX, may not be portable across JVM implementations.
+## E.g. -XX:+UseCompressedStrings
+##
+## Default: -d64 -Xms1g -Xmx1g -XX:+UseStringCache -XX:+UseCompressedOops
+##
+## Acceptable values:
+## - text
+search.solr.jvm_options = -d64 -Xms1g -Xmx1g -XX:+UseStringCache -XX:+UseCompressedOops
+
+## erlang, constrain port range so we can open the internal firewall ports
+erlang.distribution.port_range.minimum = ${entity.erlangPortRangeStart?c}
+erlang.distribution.port_range.maximum = ${entity.erlangPortRangeEnd?c}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4abc623e/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak-with-webapp.yaml
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak-with-webapp.yaml b/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak-with-webapp.yaml
index 6ed1a8e..db2bef1 100644
--- a/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak-with-webapp.yaml
+++ b/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak-with-webapp.yaml
@@ -18,19 +18,19 @@
#
name: Riak Cluster with Webapp
-location: jclouds:softlayer:sjc01
+location: aws-ec2:eu-west-1
services:
- type: brooklyn.entity.nosql.riak.RiakCluster
initialSize: 2
id: cluster
- brooklyn.config:
- install.version: 2.0.0
- type: brooklyn.entity.webapp.jboss.JBoss7Server
name: Web
brooklyn.config:
wars.root: "https://s3-eu-west-1.amazonaws.com/brooklyn-clocker/brooklyn-example-hello-world-sql-webapp.war"
java.sysprops:
brooklyn.example.riak.nodes: $brooklyn:component("cluster").attributeWhenReady("riak.cluster.nodeList")
+ provisioning.properties:
+ osFamily: centos
# Alternative URL for War file if available on classpath
# "classpath://brooklyn-example-hello-world-sql-webapp.war"
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4abc623e/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak.conf
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak.conf b/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak.conf
new file mode 100644
index 0000000..ec0ad30
--- /dev/null
+++ b/software/nosql/src/main/resources/brooklyn/entity/nosql/riak/riak.conf
@@ -0,0 +1,494 @@
+## Brooklyn note: file from 2.0.1 Ubuntu install, with erlang section added, and ports templated
+
+## Where to emit the default log messages (typically at 'info'
+## severity):
+## off: disabled
+## file: the file specified by log.console.file
+## console: to standard output (seen when using `riak attach-direct`)
+## both: log.console.file and standard out.
+##
+## Default: file
+##
+## Acceptable values:
+## - one of: off, file, console, both
+log.console = file
+
+## The severity level of the console log, default is 'info'.
+##
+## Default: info
+##
+## Acceptable values:
+## - one of: debug, info, notice, warning, error, critical, alert, emergency, none
+log.console.level = info
+
+## When 'log.console' is set to 'file' or 'both', the file where
+## console messages will be logged.
+##
+## Default: $(platform_log_dir)/console.log
+##
+## Acceptable values:
+## - the path to a file
+log.console.file = $(platform_log_dir)/console.log
+
+## The file where error messages will be logged.
+##
+## Default: $(platform_log_dir)/error.log
+##
+## Acceptable values:
+## - the path to a file
+log.error.file = $(platform_log_dir)/error.log
+
+## When set to 'on', enables log output to syslog.
+##
+## Default: off
+##
+## Acceptable values:
+## - on or off
+log.syslog = off
+
+## Whether to enable the crash log.
+##
+## Default: on
+##
+## Acceptable values:
+## - on or off
+log.crash = on
+
+## If the crash log is enabled, the file where its messages will
+## be written.
+##
+## Default: $(platform_log_dir)/crash.log
+##
+## Acceptable values:
+## - the path to a file
+log.crash.file = $(platform_log_dir)/crash.log
+
+## Maximum size in bytes of individual messages in the crash log
+##
+## Default: 64KB
+##
+## Acceptable values:
+## - a byte size with units, e.g. 10GB
+log.crash.maximum_message_size = 64KB
+
+## Maximum size of the crash log in bytes, before it is rotated
+##
+## Default: 10MB
+##
+## Acceptable values:
+## - a byte size with units, e.g. 10GB
+log.crash.size = 10MB
+
+## The schedule on which to rotate the crash log. For more
+## information see:
+## https://github.com/basho/lager/blob/master/README.md#internal-log-rotation
+##
+## Default: $D0
+##
+## Acceptable values:
+## - text
+log.crash.rotation = $D0
+
+## The number of rotated crash logs to keep. When set to
+## 'current', only the current open log file is kept.
+##
+## Default: 5
+##
+## Acceptable values:
+## - an integer
+## - the text "current"
+log.crash.rotation.keep = 5
+
+## Name of the Erlang node
+##
+## Default: riak@127.0.0.1
+##
+## Acceptable values:
+## - text
+nodename = riak@${driver.hostname}
+
+## Cookie for distributed node communication. All nodes in the
+## same cluster should use the same cookie or they will not be able to
+## communicate.
+##
+## Default: riak
+##
+## Acceptable values:
+## - text
+distributed_cookie = riak
+
+## Sets the number of threads in async thread pool, valid range
+## is 0-1024. If thread support is available, the default is 64.
+## More information at: http://erlang.org/doc/man/erl.html
+##
+## Default: 64
+##
+## Acceptable values:
+## - an integer
+erlang.async_threads = 64
+
+## The number of concurrent ports/sockets
+## Valid range is 1024-134217727
+##
+## Default: 65536
+##
+## Acceptable values:
+## - an integer
+erlang.max_ports = 65536
+
+## Set scheduler forced wakeup interval. All run queues will be
+## scanned each Interval milliseconds. While there are sleeping
+## schedulers in the system, one scheduler will be woken for each
+## non-empty run queue found. An Interval of zero disables this
+## feature, which also is the default.
+## This feature is a workaround for lengthy executing native code, and
+## native code that do not bump reductions properly.
+## More information: http://www.erlang.org/doc/man/erl.html#+sfwi
+##
+## Acceptable values:
+## - an integer
+## erlang.schedulers.force_wakeup_interval = 500
+
+## Enable or disable scheduler compaction of load. By default
+## scheduler compaction of load is enabled. When enabled, load
+## balancing will strive for a load distribution which causes as many
+## scheduler threads as possible to be fully loaded (i.e., not run out
+## of work). This is accomplished by migrating load (e.g. runnable
+## processes) into a smaller set of schedulers when schedulers
+## frequently run out of work. When disabled, the frequency with which
+## schedulers run out of work will not be taken into account by the
+## load balancing logic.
+## More information: http://www.erlang.org/doc/man/erl.html#+scl
+##
+## Acceptable values:
+## - one of: true, false
+## erlang.schedulers.compaction_of_load = false
+
+## Enable or disable scheduler utilization balancing of load. By
+## default scheduler utilization balancing is disabled and instead
+## scheduler compaction of load is enabled which will strive for a
+## load distribution which causes as many scheduler threads as
+## possible to be fully loaded (i.e., not run out of work). When
+## scheduler utilization balancing is enabled the system will instead
+## try to balance scheduler utilization between schedulers. That is,
+## strive for equal scheduler utilization on all schedulers.
+## More information: http://www.erlang.org/doc/man/erl.html#+sub
+##
+## Acceptable values:
+## - one of: true, false
+## erlang.schedulers.utilization_balancing = true
+
+## Number of partitions in the cluster (only valid when first
+## creating the cluster). Must be a power of 2, minimum 8 and maximum
+## 1024.
+##
+## Default: 64
+##
+## Acceptable values:
+## - an integer
+## ring_size = 64
+
+## Number of concurrent node-to-node transfers allowed.
+##
+## Default: 2
+##
+## Acceptable values:
+## - an integer
+## transfer_limit = 2
+
+## Default cert location for https can be overridden
+## with the ssl config variable, for example:
+##
+## Acceptable values:
+## - the path to a file
+## ssl.certfile = $(platform_etc_dir)/cert.pem
+
+## Default key location for https can be overridden with the ssl
+## config variable, for example:
+##
+## Acceptable values:
+## - the path to a file
+## ssl.keyfile = $(platform_etc_dir)/key.pem
+
+## Default signing authority location for https can be overridden
+## with the ssl config variable, for example:
+##
+## Acceptable values:
+## - the path to a file
+## ssl.cacertfile = $(platform_etc_dir)/cacertfile.pem
+
+## DTrace support Do not enable 'dtrace' unless your Erlang/OTP
+## runtime is compiled to support DTrace. DTrace is available in
+## R15B01 (supported by the Erlang/OTP official source package) and in
+## R14B04 via a custom source repository & branch.
+##
+## Default: off
+##
+## Acceptable values:
+## - on or off
+dtrace = off
+
+## Platform-specific installation paths (substituted by rebar)
+##
+## Default: /usr/sbin
+##
+## Acceptable values:
+## - the path to a directory
+platform_bin_dir = /usr/sbin
+
+##
+## Default: /var/lib/riak
+##
+## Acceptable values:
+## - the path to a directory
+platform_data_dir = /var/lib/riak
+
+##
+## Default: /etc/riak
+##
+## Acceptable values:
+## - the path to a directory
+platform_etc_dir = /etc/riak
+
+##
+## Default: /usr/lib64/riak/lib
+##
+## Acceptable values:
+## - the path to a directory
+platform_lib_dir = /usr/lib64/riak/lib
+
+##
+## Default: /var/log/riak
+##
+## Acceptable values:
+## - the path to a directory
+platform_log_dir = /var/log/riak
+
+## Enable consensus subsystem. Set to 'on' to enable the
+## consensus subsystem used for strongly consistent Riak operations.
+##
+## Default: off
+##
+## Acceptable values:
+## - on or off
+## strong_consistency = on
+
+## listener.http.<name> is an IP address and TCP port that the Riak
+## HTTP interface will bind.
+##
+## Default: 127.0.0.1:8098
+##
+## Acceptable values:
+## - an IP/port pair, e.g. 127.0.0.1:10011
+listener.http.internal = 0.0.0.0:${entity.riakWebPort?c}
+
+## listener.protobuf.<name> is an IP address and TCP port that the Riak
+## Protocol Buffers interface will bind.
+##
+## Default: 127.0.0.1:8087
+##
+## Acceptable values:
+## - an IP/port pair, e.g. 127.0.0.1:10011
+listener.protobuf.internal = 0.0.0.0:${entity.riakPbPort?c}
+
+## The maximum length to which the queue of pending connections
+## may grow. If set, it must be an integer > 0. If you anticipate a
+## huge number of connections being initialized *simultaneously*, set
+## this number higher.
+##
+## Default: 128
+##
+## Acceptable values:
+## - an integer
+## protobuf.backlog = 128
+
+## listener.https.<name> is an IP address and TCP port that the Riak
+## HTTPS interface will bind.
+##
+## Acceptable values:
+## - an IP/port pair, e.g. 127.0.0.1:10011
+## listener.https.internal = 127.0.0.1:8098
+
+## How Riak will repair out-of-sync keys. Some features require
+## this to be set to 'active', including search.
+## * active: out-of-sync keys will be repaired in the background
+## * passive: out-of-sync keys are only repaired on read
+## * active-debug: like active, but outputs verbose debugging
+## information
+##
+## Default: active
+##
+## Acceptable values:
+## - one of: active, passive, active-debug
+anti_entropy = active
+
+## Specifies the storage engine used for Riak's key-value data
+## and secondary indexes (if supported).
+##
+## Default: bitcask
+##
+## Acceptable values:
+## - one of: bitcask, leveldb, memory, multi
+storage_backend = bitcask
+
+## Controls which binary representation of a riak value is stored
+## on disk.
+## * 0: Original erlang:term_to_binary format. Higher space overhead.
+## * 1: New format for more compact storage of small values.
+##
+## Default: 1
+##
+## Acceptable values:
+## - the integer 1
+## - the integer 0
+object.format = 1
+
+## Reading or writing objects bigger than this size will write a
+## warning in the logs.
+##
+## Default: 5MB
+##
+## Acceptable values:
+## - a byte size with units, e.g. 10GB
+object.size.warning_threshold = 5MB
+
+## Writing an object bigger than this will send a failure to the
+## client.
+##
+## Default: 50MB
+##
+## Acceptable values:
+## - a byte size with units, e.g. 10GB
+object.size.maximum = 50MB
+
+## Writing an object with more than this number of siblings will
+## generate a warning in the logs.
+##
+## Default: 25
+##
+## Acceptable values:
+## - an integer
+object.siblings.warning_threshold = 25
+
+## Writing an object with more than this number of siblings will
+## send a failure to the client.
+##
+## Default: 100
+##
+## Acceptable values:
+## - an integer
+object.siblings.maximum = 100
+
+## A path under which bitcask data files will be stored.
+##
+## Default: $(platform_data_dir)/bitcask
+##
+## Acceptable values:
+## - the path to a directory
+bitcask.data_root = $(platform_data_dir)/bitcask
+
+## Configure how Bitcask writes data to disk.
+## erlang: Erlang's built-in file API
+## nif: Direct calls to the POSIX C API
+## The NIF mode provides higher throughput for certain
+## workloads, but has the potential to negatively impact
+## the Erlang VM, leading to higher worst-case latencies
+## and possible throughput collapse.
+##
+## Default: erlang
+##
+## Acceptable values:
+## - one of: erlang, nif
+bitcask.io_mode = erlang
+
+## Set to 'off' to disable the admin panel.
+##
+## Default: off
+##
+## Acceptable values:
+## - on or off
+riak_control = on
+
+## Authentication mode used for access to the admin panel.
+##
+## Default: off
+##
+## Acceptable values:
+## - one of: off, userlist
+riak_control.auth.mode = off
+
+## If riak control's authentication mode (riak_control.auth.mode)
+## is set to 'userlist' then this is the list of usernames and
+## passwords for access to the admin panel.
+## To create users with given names, add entries of the format:
+## riak_control.auth.user.USERNAME.password = PASSWORD
+## replacing USERNAME with the desired username and PASSWORD with the
+## desired password for that user.
+##
+## Acceptable values:
+## - text
+## riak_control.auth.user.admin.password = pass
+
+## This parameter defines the percentage of total server memory
+## to assign to LevelDB. LevelDB will dynamically adjust its internal
+## cache sizes to stay within this size. The memory size can
+## alternately be assigned as a byte count via leveldb.maximum_memory
+## instead.
+##
+## Default: 70
+##
+## Acceptable values:
+## - an integer
+leveldb.maximum_memory.percent = 70
+
+## To enable Search set this 'on'.
+##
+## Default: off
+##
+## Acceptable values:
+## - on or off
+search = off
+
+## How long Riak will wait for Solr to start. The start sequence
+## will be tried twice. If both attempts timeout, then the Riak node
+## will be shutdown. This may need to be increased as more data is
+## indexed and Solr takes longer to start. Values lower than 1s will
+## be rounded up to the minimum 1s.
+##
+## Default: 30s
+##
+## Acceptable values:
+## - a time duration with units, e.g. '10s' for 10 seconds
+search.solr.start_timeout = 30s
+
+## The port number which Solr binds to.
+## NOTE: Binds on every interface.
+##
+## Default: 8093
+##
+## Acceptable values:
+## - an integer
+search.solr.port = ${entity.searchSolrPort?c}
+
+## The port number which Solr JMX binds to.
+## NOTE: Binds on every interface.
+##
+## Default: 8985
+##
+## Acceptable values:
+## - an integer
+search.solr.jmx_port = ${entity.searchSolrJmxPort?c}
+
+## The options to pass to the Solr JVM. Non-standard options,
+## i.e. -XX, may not be portable across JVM implementations.
+## E.g. -XX:+UseCompressedStrings
+##
+## Default: -d64 -Xms1g -Xmx1g -XX:+UseStringCache -XX:+UseCompressedOops
+##
+## Acceptable values:
+## - text
+search.solr.jvm_options = -d64 -Xms1g -Xmx1g -XX:+UseStringCache -XX:+UseCompressedOops
+
+## erlang, constrain port range so we can open the internal firewall ports
+erlang.distribution.port_range.minimum = ${entity.erlangPortRangeStart?c}
+erlang.distribution.port_range.maximum = ${entity.erlangPortRangeEnd?c}
[4/4] git commit: This closes #292
Posted by gr...@apache.org.
This closes #292
* github/pr/292:
Make operating system name lowercase for Riak URL
Fixes for subnetHostname in Riak for Clocker
Fixes Riak 2.0 on various clouds, adds prelim work for Docker
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/83011fe0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/83011fe0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/83011fe0
Branch: refs/heads/master
Commit: 83011fe09f46bb26566eb9ce59b15b2d6159614b
Parents: 5e6b990 48370ae
Author: Andrew Kennedy <gr...@apache.org>
Authored: Mon Nov 3 18:39:25 2014 +0000
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Mon Nov 3 18:39:25 2014 +0000
----------------------------------------------------------------------
.../jclouds/JcloudsSshMachineLocation.java | 19 +-
.../basic/AbstractSoftwareProcessSshDriver.java | 2 +
software/nosql/pom.xml | 2 +
.../brooklyn/entity/nosql/riak/RiakNode.java | 56 ++-
.../entity/nosql/riak/RiakNodeDriver.java | 4 +-
.../entity/nosql/riak/RiakNodeImpl.java | 20 +
.../entity/nosql/riak/RiakNodeSshDriver.java | 152 +++---
.../brooklyn/entity/nosql/riak/app.config | 2 +-
.../brooklyn/entity/nosql/riak/riak-mac.conf | 494 +++++++++++++++++++
.../entity/nosql/riak/riak-with-webapp.yaml | 6 +-
.../brooklyn/entity/nosql/riak/riak.conf | 494 +++++++++++++++++++
.../main/java/brooklyn/util/text/Strings.java | 7 +-
12 files changed, 1164 insertions(+), 94 deletions(-)
----------------------------------------------------------------------
[2/4] git commit: Fixes for subnetHostname in Riak for Clocker
Posted by gr...@apache.org.
Fixes for subnetHostname in Riak for Clocker
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/1c17e735
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/1c17e735
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/1c17e735
Branch: refs/heads/master
Commit: 1c17e735a1c027ae91c7dc00bdb1a12dd655f16d
Parents: 4abc623
Author: Andrew Kennedy <gr...@apache.org>
Authored: Mon Nov 3 15:00:03 2014 +0000
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Mon Nov 3 17:40:51 2014 +0000
----------------------------------------------------------------------
.../jclouds/JcloudsSshMachineLocation.java | 19 +++----------------
.../basic/AbstractSoftwareProcessSshDriver.java | 2 ++
.../entity/nosql/riak/RiakNodeDriver.java | 2 --
.../entity/nosql/riak/RiakNodeSshDriver.java | 19 +++++--------------
4 files changed, 10 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1c17e735/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsSshMachineLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsSshMachineLocation.java b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsSshMachineLocation.java
index d218ec2..e0ceffc 100644
--- a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsSshMachineLocation.java
+++ b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsSshMachineLocation.java
@@ -160,24 +160,11 @@ public class JcloudsSshMachineLocation extends SshMachineLocation implements Has
return node.getPrivateAddresses();
}
- /** returns the hostname (or sometimes IP) for use by peers in the same subnet,
- * defaulting to public hostname if nothing special
- * <p>
- * for use e.g. in clouds like amazon where other machines
- * in the same subnet need to use a different IP
- */
+ /** In most clouds, the public hostname is the only way to ensure VMs in different zones can access each other. */
@Override
public String getSubnetHostname() {
String publicHostname = jcloudsParent.getPublicHostname(node, Optional.<HostAndPort>absent(), getAllConfigBag());
-
- if ("aws-ec2".equals(jcloudsParent.getProvider())) {
- // prefer hostname over IP for aws (resolves to private ip in subnet, and to public from outside)
- if (!Networking.isValidIp4(publicHostname)) {
- return publicHostname; // assume it's a hostname; could check for ip6!
- }
- }
- Optional<String> privateAddress = getPrivateAddress();
- return privateAddress.isPresent() ? privateAddress.get() : publicHostname;
+ return publicHostname;
}
@Override
@@ -186,7 +173,7 @@ public class JcloudsSshMachineLocation extends SshMachineLocation implements Has
if (privateAddress.isPresent()) {
return privateAddress.get();
}
-
+
String hostname = jcloudsParent.getPublicHostname(node, Optional.<HostAndPort>absent(), getAllConfigBag());
if (hostname != null && !Networking.isValidIp4(hostname)) {
try {
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1c17e735/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java
index ffab96b..0e54a20 100644
--- a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java
+++ b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java
@@ -258,6 +258,8 @@ public abstract class AbstractSoftwareProcessSshDriver extends AbstractSoftwareP
public SshMachineLocation getMachine() { return getLocation(); }
public String getHostname() { return entity.getAttribute(Attributes.HOSTNAME); }
public String getAddress() { return entity.getAttribute(Attributes.ADDRESS); }
+ public String getSubnetHostname() { return entity.getAttribute(Attributes.SUBNET_HOSTNAME); }
+ public String getSubnetAddress() { return entity.getAttribute(Attributes.SUBNET_ADDRESS); }
protected Map<String, Object> getSshFlags() {
return SshEffectorTasks.getSshFlags(getEntity(), getMachine());
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1c17e735/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeDriver.java b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeDriver.java
index 7275bbf..3669c1c 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeDriver.java
@@ -22,8 +22,6 @@ import brooklyn.entity.basic.SoftwareProcessDriver;
public interface RiakNodeDriver extends SoftwareProcessDriver {
- public String getSubnetHostname();
-
public String getRiakEtcDir();
public void joinCluster(String nodeName);
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1c17e735/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
index a596e6f..830a798 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
@@ -103,11 +103,8 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
}
private List<String> installLinux(String expandedInstallDir) {
-
DynamicTasks.queueIfPossible(SshTasks.dontRequireTtyForSudo(getMachine(), SshTasks.OnFailingTask.WARN_OR_IF_DYNAMIC_FAIL_MARKING_INESSENTIAL)).orSubmitAndBlock();
- isPackageInstall = true;
-
String installBin = Urls.mergePaths(expandedInstallDir, "bin");
String saveAsYum = "riak.rpm";
String saveAsApt = "riak.deb";
@@ -203,7 +200,7 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
customizeScript.failOnNonZeroResultCode().execute();
//set the riak node name
- entity.setAttribute(RiakNode.RIAK_NODE_NAME, format("riak@%s", getEntity().getAttribute(Attributes.SUBNET_HOSTNAME)));
+ entity.setAttribute(RiakNode.RIAK_NODE_NAME, format("riak@%s", getSubnetHostname()));
}
@Override
@@ -231,11 +228,10 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
@Override
public void stop() {
-
leaveCluster();
String command = format("%s stop", getRiakCmd());
- command = isPackageInstall ? "sudo " + command : command;
+ command = isPackageInstall ? sudo(command) : command;
ScriptHelper stopScript = newScript(ImmutableMap.of(USE_PID_FILE, false), STOPPING)
.body.append(command);
@@ -248,7 +244,7 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
int result = stopScript.failOnNonZeroResultCode().execute();
if (result != 0) {
- newScript(ImmutableMap.of(USE_PID_FILE, ""), STOPPING).execute();
+ newScript(ImmutableMap.of(USE_PID_FILE, false), STOPPING).execute();
}
}
@@ -335,7 +331,6 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
@Override
public void commitCluster() {
-
if (hasJoinedCluster()) {
ScriptHelper commitClusterScript = newScript("commitCluster")
.body.append(sudo(format("%s cluster plan", getRiakAdminCmd())))
@@ -366,10 +361,10 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
String stopCommand = format("%s stop", getRiakCmd());
- stopCommand = isPackageInstall ? "sudo " + stopCommand : stopCommand;
+ stopCommand = isPackageInstall ? sudo(stopCommand) : stopCommand;
String startCommand = format("%s start >/dev/null 2>&1 < /dev/null &", getRiakCmd());
- startCommand = isPackageInstall ? "sudo " + startCommand : startCommand;
+ startCommand = isPackageInstall ? sudo(startCommand) : startCommand;
ScriptHelper recoverNodeScript = newScript("recoverNode")
.body.append(stopCommand)
@@ -394,10 +389,6 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver implemen
}
}
- public String getSubnetHostname() {
- return getEntity().getAttribute(Attributes.SUBNET_HOSTNAME);
- }
-
private Boolean hasJoinedCluster() {
return ((RiakNode) entity).hasJoinedCluster();
}