Skip to content

Commit b6b7235

Browse files
Updated to Cloud Foundry v2.
1 parent 762df6d commit b6b7235

File tree

24 files changed

+218
-121
lines changed

24 files changed

+218
-121
lines changed

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
target/
2+
3+
lib-cov
4+
*.seed
5+
*.log
6+
*.csv
7+
*.dat
8+
*.out
9+
*.pid
10+
*.gz
11+
12+
pids
13+
logs
14+
results
15+
16+
npm-debug.log
17+
node_modules
18+

README

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
RabbitMQ Cloud Foundry Samples
2+
==============================
3+
4+
This repository contains sample applications to demonstrate the use of [RabbitMQ](http://www.rabbitmq.com/) on [Cloud Foundry](http://www.cloudfoundry.com).
5+
6+
Examples are provided for the following languages/runtimes:
7+
8+
* [Java with Spring](spring)
9+
* [Ruby with Rails](rails)
10+
* [Ruby with Sinatra](sinatra)
11+
* [Node.js](nodejs)

nodejs/Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: node app.js

nodejs/README

Lines changed: 0 additions & 7 deletions
This file was deleted.

nodejs/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This is a simple Node.js application demonstrating the use of RabbitMQ on Cloud Foundry.
2+
3+
## Deploying to Cloud Foundry ##
4+
5+
After installing in the 'cf' [command-line interface](http://docs.cloudfoundry.com/docs/using/managing-apps/cf/) for Cloud Foundry, targeting a Cloud Foundry instance, and logging in, the application can be pushed using these commands:
6+
7+
$ cf push
8+
9+
The provided `manifest.yml` file will be used to provide the application parameters to Cloud Foundry. You may need to provide a different URL for the application if the `rabbitmq-node` URL is already being used in your Cloud Foundry domain. The `manifest.yml` file specifies a RabbitMQ services that is available on the [run.pivotal.io](http://docs.cloudfoundry.com/docs/dotcom/getting-started.html) Cloud Foundry services marketplace. You may need to change the details of the RabbitMQ service to push to a different Cloud Foundry instance.

nodejs/app.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
require.paths.unshift('./node_modules');
2-
31
var http = require('http');
42
var amqp = require('amqp');
53
var URL = require('url');
64
var htmlEscape = require('sanitizer/sanitizer').escape;
75

86
function rabbitUrl() {
97
if (process.env.VCAP_SERVICES) {
10-
conf = JSON.parse(process.env.VCAP_SERVICES);
11-
return conf['rabbitmq-2.4'][0].credentials.url;
8+
var svcInfo = JSON.parse(process.env.VCAP_SERVICES);
9+
for (var label in svcInfo) {
10+
var svcs = svcInfo[label];
11+
for (var index in svcs) {
12+
var uri = svcs[index].credentials.uri;
13+
if (uri.lastIndexOf("amqp", 0) == 0) {
14+
return uri;
15+
}
16+
}
17+
}
18+
return null;
1219
}
1320
else {
1421
return "amqp://localhost";

nodejs/manifest.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
applications:
3+
- name: rabbitmq-node
4+
memory: 256M
5+
instances: 1
6+
url: rabbitmq-node.${target-base}
7+
path: .
8+
services:
9+
rabbit-sample:
10+
label: cloudamqp
11+
provider: cloudamqp
12+
version: n/a
13+
plan: lemur

nodejs/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
2-
3-
"name":"node-srs-demo",
2+
"name":"rabbitmq-node",
43
"author": "Michael Bridgen",
54
"version":"0.0.2",
65
"dependencies":{

rails/README

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)