bladepan / cloudbrowser

http://cloudbrowser.cs.vt.edu
MIT License
0 stars 0 forks source link

CloudBrowser

CloudBrowser is a way of rethinking how we write HTML-based Rich Internet Applications, also referred to as AJAX applications. Put simply, the key idea behind CloudBrowser is to keep the entire application, including its data model, controller logic, and view server-side, and use the client-side browser as a (dumb) display device, or thin client, similar to how an X Server displays a remote X client's graphical user. CloudBrowser instances live on a server, and client browsers can connect and disconnect at will, and it is also possible for multiple users to connect to the same instance, which yields a natural co-browsing ability. See http://cloudbrowser.cs.vt.edu/ for a detailed explanation.

External Dependencies

Installation

  1. Install node.js.
  2. Clone the repository to your machine. git clone https://github.com/brianmcd/cloudbrowser.git
  3. cd into the cloned CloudBrowser directory.
  4. Switch to the current production branch deployment2. git checkout deployment2.
  5. Install all the necessary npm modules. npm install -d
  6. Install the mongodb server on your machine. The default configuration, which binds the mongodb server to localhost, should work.
  7. See the section on server configuration for more details.
  8. [Optional, see below on how to try out provided examples] Create a web application using HTML/CSS/JavaScript. In the directory containing the web application, create a configuration file app_config.json and add in suitable configuration details. See the section on application configuration for more details.

Start up

CloudBrowser uses a single master multiple workers architecture. To start a CloudBrowser cluster, you need to start mongodb first.

You can start the master by the following script, if you omit the configPath option, it will load config files from ProjectRoot/config.

bin/run_master.sh --configPath [config directory] [application directories...]

You can start a worker process by the following script, you need to specify different configPath for different workers.

bin/run_worker.sh --configPath [config directory]

You can also try out CloudBrowser in a single process using the single process mode:

bin/single_machine_runner.sh

This will start a cluster with one master and two workers in a single process. It is equivalent to a multi-process CloudBrowser cluster started by the following commands.

bin/run_master.sh --configPath config examples src/server/applications&
bin/run_worker.sh --configPath config/worker1 &
bin/run_worker.sh --configPath config/worker2 &

Verify

Visit domain:port/<mount point of application> in your browser.

Configuration

Server Configuration

The folder config2 contains sample configurations for a CloudBrowser cluster of one master and two workers.

You can copy files from config2 to config folder and modify the config files based on your needs. If you are planning to deploy more than 2 worker nodes, you can run generate_worker_config.sh to generate worker configuration files.

# bin/generate_worker_config.sh [config directory] [number of workers]
bin/generate_worker_config.sh config 15

Master Configuration

Master configuration file should be named as master_config.json. By default, the run_master.sh script will try to look for configuration file in ProjectRoot/config directory. You could use another configuration file by setting configPath flag in command line.

{
    "proxyConfig": {
        "httpPort": 3000
    },
    "databaseConfig": {
        "port": 27017
    },
    "rmiPort": 3040,
    "workerConfig": {
        "admins": [
            "admin@cloudbrowser.com"
        ],
        "defaultUser": "user@cloudbrowser.com"
        "emailerConfig":{
            "email" : "cloudbrowseradmin@gmail.com",
            "password" : "mariokart"
        }
    }
}

Worker Configuration

Worker configuration files should be named as server_config.json. When starting a worker by run_worker.sh script, you should setting configPath flag to the directory that contains the worker's configuration file.

{
    "httpPort": 4000,
    "id": "worker1",
    "rmiPort": 5700,
    "masterConfig": {
        "host": "localhost",
        "rmiPort": 3040
    }
}

Deploy on a single machine

Please allocate different httpPort and rmiPort for the master and the workers.

Master command line options

These options can be set in the JSON configuration file master_config.json under the workerConfig object or through the command line while starting the CloudBrowser master server.

Web Application Configuration

These configuration details are specific to a web application and need to be placed in the JSON file app_config.json inside the directory that contains the source of the corresponding application.

Internals

TBC

DB Tables Explained

To inspect the database tables we used, you can start a mongodb shell by execute mongo in the mongoDB's bin directory.

data bases

Display all the databases using 'show dbs'. You will see something like this :

> show dbs
UID501-cloudbrowser           0.078GB
UID501-cloudbrowser_sessions  0.078GB
admin                         (empty)
local                         0.078GB

> use UID501-cloudbrowser
switched to db UID501-cloudbrowser

> show collections
Permissions
admin_interface.users
chat3.users
counters
helloworld.users
system.indexes

> db.Permissions.find()
{ "_id" : ObjectId("53cf37f4d1dc5a9d49000001"), "_email" : "godmar@gmail.com", "apps" : { "/calendar" : { "permission" : "own" }, "/frames" : { "permission" : "own" }, "/angularjs-basic" : { "permission" : "own" }, "/chat2" : { "permission" : "own" }, "/angular-todo" : { "permission" : "own" }, "/chess" : { "permission" : "own" }, "/frames/authenticate" : { "permission" : "own" }, "/frames/password_reset" : { "permission" : "own" }, "/angularjs-basic/authenticate" : { "permission" : "own" }, "/angularjs-basic/password_reset" : { "permission" : "own" }, "/chat2/authenticate" : { "permission" : "own" }, "/chat2/password_reset" : { "permission" : "own" }, "/chat2/landing_page" : { "permission" : "own" }, "/angular-todo/authenticate" : { "permission" : "own" }, "/angular-todo/password_reset" : { "permission" : "own" }, "/chess/authenticate" : { "permission" : "own" }, "/chess/password_reset" : { "permission" : "own" } } }

UID-cloudbrowser is used to store data from cloudbrowser framework and user applications. UID-cloudbrowser_sessions is for http sessions.