Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.
mbostock edited this page Apr 16, 2012 · 53 revisions

Documentation

Support

For Internal Use Only

Cube is designed for internal use only. Cube does not provide access control, so any data you put into Cube can be queried by anyone that can access your evaluator. You can separate the collector and evaluator, and use a firewall to prevent access to the collector. We may add some type of access control in the future if there is demand for user-facing applications.

Another method of access control is to hide Cube behind a secure, authenticated proxy (that speaks WebSockets). Even then, be aware that Cube is not yet hardened against denial-of-service attacks and other malicious requests, and is still in the early stages of development.

Installation (MongoDB)

Mac OS X

You can install MongoDB, Node.js and NPM like so:

brew install mongodb
brew install node

You can install MongoDB, Node.js and NPM like so:

sudo port selfupdate
sudo port install mongodb nodejs npm

Cube is tested against MongoDB 2.0.1 and Node 0.6.2. If you want MongoDB to start automatically, you can also say:

mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mongodb/2.0.1-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist

Linux

Ubuntu 11.04

sudo apt-get install mongodb mongodb-server

Installation (Cube)

Next you’ll need to install Cube’s node modules.

npm install cube
# OR: git clone https://github.com/square/cube.git
cd cube
npm install

If you're curious, the dependencies are defined in package.json.

Usage

To start Cube:

node bin/collector.js &
node bin/evaluator.js &

You can now connect to localhost:1080 for the collector, and localhost:1081 for the evaluator. You can visit http://localhost:1081/ in your browser to see the default dashboard. Cube is tested mostly on Chrome, but should run in Firefox, Safari and IE9.

You can send events to the collector using WebSockets or HTTP. For WebSockets, connect to ws://localhost:1080/1.0/event/put. Cube supports WebSockets RFC 6455 as well as the older draft-76; however, support for the latter will likely be removed in the future when the standard stabilizes. Once connected, send events one-at-a-time, each in their own text frame. To send events over HTTP, post a JSON array of the event objects to http://localhost:1080/1.0/event/put.

If you just want some data in order to play around with the dashboard, run the random data emitter:

node examples/emitter/random/random.js

You’ll want to ^C the random emitter after a few seconds. You can then reload your dashboard to see the new data.