You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2014/11/11 15:17:11 UTC
[07/11] incubator-brooklyn git commit: misc doc fixes and code
comments/reporting
misc doc fixes and code comments/reporting
including improving persistence docs, and comments on tomcat and typo in couchbase
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/cc77677e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/cc77677e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/cc77677e
Branch: refs/heads/master
Commit: cc77677ed9c41740d5c6830740bf3ba51c6da388
Parents: df5fb25
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Nov 10 11:36:10 2014 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Nov 11 13:54:54 2014 +0000
----------------------------------------------------------------------
.../basic/internal/ApiObjectsFactory.java | 3 ++-
.../java/brooklyn/util/file/ArchiveBuilder.java | 7 ++++--
docs/use/guide/persistence/index.md | 25 +++++++++++++++++++-
.../entity/webapp/tomcat/Tomcat7SshDriver.java | 9 ++++++-
.../launcher/src/test/resources/couchbase.yaml | 2 +-
5 files changed, 40 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc77677e/api/src/main/java/brooklyn/basic/internal/ApiObjectsFactory.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/brooklyn/basic/internal/ApiObjectsFactory.java b/api/src/main/java/brooklyn/basic/internal/ApiObjectsFactory.java
index ecbb7fb..5a87805 100644
--- a/api/src/main/java/brooklyn/basic/internal/ApiObjectsFactory.java
+++ b/api/src/main/java/brooklyn/basic/internal/ApiObjectsFactory.java
@@ -47,7 +47,8 @@ public class ApiObjectsFactory {
INSTANCE = Maybe.of(item);
return INSTANCE.get();
}
- INSTANCE = Maybe.absent("Implementation of " + ApiObjectsFactoryInterface.class + " not found on classpath");
+ INSTANCE = Maybe.absent("Implementation of " + ApiObjectsFactoryInterface.class + " not found on classpath; "
+ + "can be caused by IDE not copying resources, or by something else clobbering non-class resources needed for service loading");
return INSTANCE.get();
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc77677e/core/src/main/java/brooklyn/util/file/ArchiveBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/util/file/ArchiveBuilder.java b/core/src/main/java/brooklyn/util/file/ArchiveBuilder.java
index 88cd111..6985406 100644
--- a/core/src/main/java/brooklyn/util/file/ArchiveBuilder.java
+++ b/core/src/main/java/brooklyn/util/file/ArchiveBuilder.java
@@ -35,14 +35,12 @@ import java.util.zip.ZipOutputStream;
import brooklyn.util.exceptions.Exceptions;
import brooklyn.util.file.ArchiveUtils.ArchiveType;
-import brooklyn.util.io.FileUtil;
import brooklyn.util.os.Os;
import com.google.common.annotations.Beta;
import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
-import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
/**
@@ -86,6 +84,11 @@ public class ArchiveBuilder {
return new ArchiveBuilder(ArchiveType.JAR);
}
+ // TODO would be nice to support TAR and TGZ
+ // e.g. using commons-compress
+ // TarArchiveOutputStream out = new TarArchiveOutputStream(new GZIPOutputStream(bytes));
+ // but I think the way entries are done is slightly different so we'd need a bit of refactoring
+
private final ArchiveType type;
private File archive;
private Manifest manifest;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc77677e/docs/use/guide/persistence/index.md
----------------------------------------------------------------------
diff --git a/docs/use/guide/persistence/index.md b/docs/use/guide/persistence/index.md
index bdbbf70..22ba5ce 100644
--- a/docs/use/guide/persistence/index.md
+++ b/docs/use/guide/persistence/index.md
@@ -45,7 +45,6 @@ To persist to the file system, start brooklyn with:
brooklyn launch --persist auto --persistenceDir /path/to/myPersistenceDir
{% endhighlight %}
-an
If there is already data at `/path/to/myPersistenceDir`, then a backup of the directory will
be made. This will have a name like `/path/to/myPersistenceDir.20140701-142101345.bak`.
@@ -106,6 +105,25 @@ HTTP or JMX). This new state will be reported in the web-console and can also tr
any registered policies.
+<a name="copy-state"></a>
+Copying Persistence State
+-------------------------
+
+Brooklyn includes a command to copy persistence state easily between two locations.
+The `copy-state` CLI command takes the following arguments:
+
+* `--persistenceDir` <source persistence dir>
+ The directory to read persisted state (or container name if using an object store).
+* `--persistenceLocation` <source persistence location>
+ The location spec for an object store to read persisted state.
+* `--destinationDir` <target persistence dir>
+ The directory to copy persistence data to (or container name if using an object store).
+* `--destinationLocation` <target persistence location>
+ The location spec for an object store to copy data to.
+* `--transformations` <transformations>
+ The local transformations file to be applied to the copy of the data before uploading it.
+
+
<a name="handling-rebind-failures"></a>
Handling Rebind Failures
------------------------
@@ -224,6 +242,11 @@ including setting priority to control which nodes will be promoted on master fai
* `/server/ha/priority`: Returns the HA node priority for MASTER failover (GET),
or sets that priority (POST)
+Note that when POSTing to a non-master server it is necessary to pass a `Brooklyn-Allow-Non-Master-Access: true` header.
+For example, the following cURL command could be used to change the state of a `STANDBY` node on `localhost:8082` to `HOT_STANDBY`:
+
+ curl -v -X POST -d mode=HOT_STANDBY -H "Brooklyn-Allow-Non-Master-Access: true" http://localhost:8082/v1/server/ha/state
+
<a name="writing-persistable-code"></a>
Writing Persistable Code
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc77677e/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
index 05d8fc2..3593bc0 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
@@ -24,8 +24,9 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import com.google.common.collect.Iterables;
+
import brooklyn.entity.basic.Entities;
-import brooklyn.entity.drivers.downloads.DownloadResolver;
import brooklyn.entity.webapp.JavaWebAppSshDriver;
import brooklyn.location.basic.SshMachineLocation;
import brooklyn.util.collections.MutableList;
@@ -69,6 +70,12 @@ public class Tomcat7SshDriver extends JavaWebAppSshDriver implements Tomcat7Driv
commands.add(BashCommands.INSTALL_TAR);
commands.add(format("tar xvzf %s", saveAs));
+ if (getEnabledProtocols().size()!=1) {
+ log.warn("TomcatServer only supports one protocol, http; ignoring requested protocols "+getEnabledProtocols());
+ } else if (!"http".equalsIgnoreCase(Iterables.getOnlyElement(getEnabledProtocols()))) {
+ log.warn("TomcatServer only supports one protocol, http; ignoring requested protocol "+getEnabledProtocols());
+ }
+
newScript(INSTALLING)
.environmentVariablesReset()
.body.append(commands)
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc77677e/usage/launcher/src/test/resources/couchbase.yaml
----------------------------------------------------------------------
diff --git a/usage/launcher/src/test/resources/couchbase.yaml b/usage/launcher/src/test/resources/couchbase.yaml
index bba8670..11b1b09 100644
--- a/usage/launcher/src/test/resources/couchbase.yaml
+++ b/usage/launcher/src/test/resources/couchbase.yaml
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-name: Couchbase Two Bucket
+name: Couchbase One Bucket
location: softlayer:wdc01