Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #1 from rwdaigle/README

Update README to have deployment instructions
  • Loading branch information...
commit 82f447a99033377b8fc15bbc51062390b2e8ee3d 2 parents 06aacc9 + 322f766
benzenwen benzenwen authored

Showing 1 changed file with 16 additions and 109 deletions. Show diff stats Hide diff stats

  1. +16 109 README.md
125 README.md
Source Rendered
... ... @@ -1,117 +1,24 @@
1   -# Tractor Push: A Real-time Demo with Ruby, Node.js, Socket.io and MongoDB on Heroku Cedar
  1 +This application is the message-consuming and web component of the system described in [this Heroku Dev Center article](https://devcenter.heroku.com/articles/build-realtime-polyglot-node-ruby-mongodb-socketio-app) and deployed to http://tractorpush.herokuapp.com/.
2 2
  3 +The Ruby message queuing app can be found at: https://github.com/mongolab/tractorpush-writer-ruby
3 4
4   -Learn how to use three rising infrastructure technologies that put
5   -real-time interactivity into Web apps: `socket.io`, `Node.js` and
6   -`MongoDB`. Real-time interactivity examples include chat, large-scale
7   -games, editing collaboration, and low-latency notification. In a
8   -market with dynamic, mobile, and social applications, a strong Web
9   -interface is still an important component to the entire experience.
10   -To demonstrate cross-app functionality with an existing Ruby
11   -application, the article first walks through using a separate Heroku
12   -app to write to a shared MongoDB acting as a simple queue.
13   -Fortuitously, Heroku’s new Celadon Cedar stack offers several features
14   -that support these techniques: a polyglot stack and flexible worker
15   -dynos that connect to arbitrary queuing systems.
  5 +#### Deploy
16 6
17   -<p class="callout" markdown="1"> Part I code:
18   -<a href="https://github.com/mongolab/tractorpush-writer-ruby">https://github.com/mongolab/tractorpush-writer-ruby</a></p>
19   -<p class="callout" markdown="1"> Part II code:
20   -<a href="https://github.com/mongolab/tractorpush-server">https://github.com/mongolab/tractorpush-server</a></p>
  7 +Create the app on Heroku.
21 8
22   -## Overview
  9 +```term
  10 +$ heroku create -s cedar tp-web
  11 +```
23 12
24   -<img src="http://blog.mongolab.com/wp-content/uploads/2012/03/TailableCursorDiagram.png" width="822" height="401" alt="Overview of TractorPush components."/>
25   -
26   -In the rest of the article, you
  13 +Copy the `MONGOLAB_URI` config var from the message queuing app to this one.
27 14
28   -* create the database,
29   -* connect a writer in Ruby,
30   -* connect a reader in Node.js,
31   -* instruct a browser to connect over socket.io.
  15 +```term
  16 +$ heroku config:add -a tp-web `heroku config -a tp-writer -s | grep MONGOLAB_URI`
  17 +```
32 18
33   -First, create a MongoDB collection on MongoLab that serves as a simple
34   -but flexible message queue. The Ruby application writes documents to
35   -the collection, and a Node.js application reads the documents on
36   -demand. The read query in Node.js is initiated by a browser request.
37   -The query returns a tailable cursor to read documents as they arrive.
38   -Additionally, the browser negotiates a XHR-long polling process to
39   -simulate a push of documents to the browser. In effect, the entire
40   -stack, from database to browser presentation works in a push
41   -notification manner.
  19 +Then deploy to Heroku and open in your browser
42 20
43   -<p class="callout" markdown="1">As of this writing, Heroku does not
44   -support the newer true push WebSocket protocol. XHR-long polling works acceptably. </p>
45   -
46   -<img src="http://blog.mongolab.com/wp-content/uploads/2012/03/TractorPushScreenshot.png" width="841" height="563" alt="End user screenshot of TractorPush demo."/>
47   -
48   -From an end user perspective, a browser window updates as existing
49   -messages are sent. Once the existing messages are exhausted, the
50   -browser window is static until new messages arrive at the server. As
51   -they arrive, the browser window continues to update. For the
52   -impatient: http://tractorpush.herokuapp.com shows the running
53   -application.
54   -
55   -Given MongoDB's schema-free design, our messages can be arbitrarily
56   -complex JSON. In this demonstration to show the flexibility of the
57   -object marshalling and unmarshalling, there are three types of
58   -document-based messages that are pushed through the system:
59   -
60   -* simple (name-value),
61   -* array,
62   -* complex (nested documents).
63   -
64   -To demonstrate filtering of the different types of messages on the
65   -queue, one area of the screen shows all types of messages: with their
66   -sequence number and time of creation. In a second side of the screen,
67   -only complex-type messages are shown.
68   -
69   -# Running instance
70   -A running version of the demo is at: http://tractorpush.herokuapp.com
71   -
72   -The server is node.js running socket.io. It reads from a capped
73   -MongoDB database with a tailable cursor. A secondary set of servers
74   -(it happens to be in Ruby) writes to the database.
75   -
76   -Note: Sequence numbers may not be unique.
77   -
78   -In the online demo, the node.js and Ruby components are running on
79   -Heroku's Celedon Cedar stack. The MongoDB database is hosted at
80   -MongoLab. See https://github.com/mongolab/tractorpush-server and https://github.com/mongolab/tractorpush-writer-ruby for more information.
81   -
82   -# HOWTO
83   -
84   -See: (TODO: URL) for detailed instructions on how to run the demo, but succintly:
85   -
86   -* Create a mongodb database 'testdatabase' with a capped collection 'messages' on localhost OR use Heroku and create a MONGOLAB database.
87   -* Run tractorpush-writer-ruby to insert files
88   -* Run 'npm install' Run tractorpush-server (this project): 'node app.js'
89   -* Point your browser to http://localhost:2000 and enjoy
90   -
91   -# Server REQUIRES
92   -
93   -* Node.js 0.6.9 +
94   -* npm 1.1.0-3
95   -* see package.json for more dependencies (socket.io and mongodb)
96   -
97   -
98   -Original Demo: 2012 March by ObjectLabs Corporation, makers of MongoLab.com hosted MongoDB.
99   -
100   -If you have comment or questions please contact us at @mongolab on Twitter or support AT mongolab.com. Thanks for looking.
101   -
102   -## Legal stuff
103   -Copyright 2012 ObjectLabs Corporation.
104   -
105   -Code licensed under the Apache License, Version 2.0 (the "Apache
106   -License"); you may not use this file except in compliance with
107   -the Apache License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
108   -
109   -Unless required by applicable law or agreed to in writing, software
110   -distributed under the Apache License is distributed on an "AS IS"
111   -BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
112   -implied. See the Apache License for the specific language governing
113   -permissions and limitations under the Apache License.
114   -
115   -Non-code content licensed under Creative Commons
116   -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) at
117   -http://creativecommons.org/licenses/by-sa/3.0/
  21 +```term
  22 +$ git push heroku master
  23 +$ heroku open
  24 +```

0 comments on commit 82f447a

Please sign in to comment.
Something went wrong with that request. Please try again.