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/08/21 18:01:25 UTC
[10/11] git commit: Update example blueprint for Node.JS Todo
application
Update example blueprint for Node.JS Todo application
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/e18474f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/e18474f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/e18474f3
Branch: refs/heads/master
Commit: e18474f3e438ec5867447033c045f01d1f25cd0e
Parents: d2e63ca
Author: Andrew Kennedy <gr...@apache.org>
Authored: Wed Aug 20 18:07:59 2014 +0100
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Thu Aug 21 16:35:24 2014 +0100
----------------------------------------------------------------------
.../brooklyn/demo/NodeJsTodoApplication.java | 6 ++-
.../resources/brooklyn/demo/nodejs-todo.yaml | 53 ++++++++++++++++++++
.../webapp/nodejs/NodeJsWebAppSshDriver.java | 2 +-
.../src/test/resources/nodejs-todo.yaml | 42 ----------------
.../src/test/resources/nodejs-word-finder.yaml | 34 -------------
5 files changed, 58 insertions(+), 79 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e18474f3/examples/simple-web-cluster/src/main/java/brooklyn/demo/NodeJsTodoApplication.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/NodeJsTodoApplication.java b/examples/simple-web-cluster/src/main/java/brooklyn/demo/NodeJsTodoApplication.java
index cba766c..54eb008 100644
--- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/NodeJsTodoApplication.java
+++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/NodeJsTodoApplication.java
@@ -26,6 +26,7 @@ import brooklyn.entity.basic.SoftwareProcess;
import brooklyn.entity.basic.StartableApplication;
import brooklyn.entity.nosql.redis.RedisStore;
import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.trait.Startable;
import brooklyn.entity.webapp.nodejs.NodeJsWebAppService;
import brooklyn.event.basic.DependentConfiguration;
@@ -48,10 +49,11 @@ public class NodeJsTodoApplication extends AbstractApplication implements Starta
.configure(NodeJsWebAppService.APP_GIT_REPOSITORY_URL, "https://github.com/amirrajan/nodejs-todo/")
.configure(NodeJsWebAppService.APP_FILE, "server.js")
.configure(NodeJsWebAppService.APP_NAME, "nodejs-todo")
- .configure(NodeJsWebAppService.NODE_PACKAGE_LIST, ImmutableList.of("express", "ejs", "redis"))
+ .configure(NodeJsWebAppService.NODE_PACKAGE_LIST, ImmutableList.of("express", "ejs", "jasmine-node", "underscore", "method-override", "cookie-parser", "express-session", "body-parser", "cookie-session", "redis", "redis-url", "connect"))
.configure(SoftwareProcess.SHELL_ENVIRONMENT, ImmutableMap.<String, Object>of(
"REDISTOGO_URL", DependentConfiguration.formatString("redis://%s:%d/",
- attributeWhenReady(redis, Attributes.HOSTNAME), attributeWhenReady(redis, RedisStore.REDIS_PORT)))));
+ attributeWhenReady(redis, Attributes.HOSTNAME), attributeWhenReady(redis, RedisStore.REDIS_PORT))))
+ .configure(SoftwareProcess.LAUNCH_LATCH, attributeWhenReady(redis, Startable.SERVICE_UP)));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e18474f3/examples/simple-web-cluster/src/main/resources/brooklyn/demo/nodejs-todo.yaml
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/resources/brooklyn/demo/nodejs-todo.yaml b/examples/simple-web-cluster/src/main/resources/brooklyn/demo/nodejs-todo.yaml
new file mode 100644
index 0000000..8bf3f7f
--- /dev/null
+++ b/examples/simple-web-cluster/src/main/resources/brooklyn/demo/nodejs-todo.yaml
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+id: nodejs-todo-application
+name: "Node.JS Todo Application"
+origin: "https://github.com/amirrajan/nodejs-todo/"
+locations:
+- jclouds:softlayer:ams01
+services:
+- serviceType: brooklyn.entity.nosql.redis.RedisStore
+ id: redis
+ name: "Redis"
+- serviceType: brooklyn.entity.webapp.nodejs.NodeJsWebAppService
+ id: nodejs
+ name: "Node.JS"
+ brooklyn.config:
+ gitRepoUrl:
+ "https://github.com/grkvlt/nodejs-todo/"
+ appFileName: server.js
+ appName: nodejs-todo
+ nodePackages:
+ - express
+ - ejs
+ - jasmine-node
+ - underscore
+ - method-override
+ - cookie-parser
+ - express-session
+ - body-parser
+ - cookie-session
+ - redis
+ - redis-url
+ - connect
+ env:
+ REDISTOGO_URL: >
+ $brooklyn:formatString("redis://%s:%d/",
+ component("redis").attributeWhenReady("host.name"),
+ component("redis").attributeWhenReady("redis.port"))
+ launch.latch: $brooklyn:component("redis").attributeWhenReady("service.isUp")
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e18474f3/software/webapp/src/main/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSshDriver.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSshDriver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSshDriver.java
index 24c8581..839d434 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSshDriver.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSshDriver.java
@@ -139,7 +139,7 @@ public class NodeJsWebAppSshDriver extends AbstractSoftwareProcessSshDriver impl
}
commands.add(String.format("cd %s", Os.mergePathsUnix(getRunDir(), appName)));
- commands.add(BashCommands.sudo("nohup " + appCommandLine + " &"));
+ commands.add("nohup " + appCommandLine + " > console.out 2>&1 &");
newScript(MutableMap.of(USE_PID_FILE, true), LAUNCHING)
.body.append(commands)
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e18474f3/usage/launcher/src/test/resources/nodejs-todo.yaml
----------------------------------------------------------------------
diff --git a/usage/launcher/src/test/resources/nodejs-todo.yaml b/usage/launcher/src/test/resources/nodejs-todo.yaml
deleted file mode 100644
index 879a9c1..0000000
--- a/usage/launcher/src/test/resources/nodejs-todo.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-id: nodejs-todo-application
-name: "Node.JS Todo Application"
-origin: "https://github.com/amirrajan/nodejs-todo/"
-locations:
-- jclouds:softlayer:ams01
-services:
-- serviceType: brooklyn.entity.nosql.redis.RedisStore
- id: redis
-- serviceType: brooklyn.entity.webapp.nodejs.NodeJsWebAppService
- id: nodejs
- name: "Node.JS"
- brooklyn.config:
- gitRepoUrl:
- "https://github.com/amirrajan/nodejs-todo/"
- appFileName: server.js
- appName: nodejs-todo
- nodePackages:
- - express
- - ejs
- - redis
- env:
- REDISTOGO_URL: >
- $brooklyn:formatString("redis://%s:%d/",
- component("redis").attributeWhenReady("host.name"),
- component("redis").attributeWhenReady("redis.port"))
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e18474f3/usage/launcher/src/test/resources/nodejs-word-finder.yaml
----------------------------------------------------------------------
diff --git a/usage/launcher/src/test/resources/nodejs-word-finder.yaml b/usage/launcher/src/test/resources/nodejs-word-finder.yaml
deleted file mode 100644
index 5af00fc..0000000
--- a/usage/launcher/src/test/resources/nodejs-word-finder.yaml
+++ /dev/null
@@ -1,34 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-id: nodejs-word-finder-application
-name: "Node.JS Word Finder Application"
-origin: "https://github.com/amirrajan/word-finder/"
-locations:
-- jclouds:softlayer:ams01
-services:
-- serviceType: brooklyn.entity.webapp.nodejs.NodeJsWebAppService
- id: nodejs
- name: "Node.JS"
- brooklyn.config:
- gitRepoUrl:
- "https://github.com/amirrajan/word-finder/"
- appFileName: server.js
- appName: word-finder
- nodePackages:
- - express
- - ejs
\ No newline at end of file