Skip to content

Commit

Permalink
Merge pull request #673 from joola/feature/#661
Browse files Browse the repository at this point in the history
#661 Joola running on its own
  • Loading branch information
itayw committed Feb 23, 2015
2 parents 986dad7 + 28b44e3 commit dd6ce81
Show file tree
Hide file tree
Showing 66 changed files with 2,319 additions and 1,393 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Expand Up @@ -19,8 +19,11 @@ node_modules
atlassian-ide-plugin.xml

coverage
!build/coverage

config/local.json
config/runtime.json
test/config/local.json

apiary.out.html

Expand All @@ -45,4 +48,5 @@ pages/docs
params.json
search_index.json

build/docker
data

3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -37,3 +37,6 @@
[submodule "build/cookbooks/erlang"]
path = build/cookbooks/erlang
url = https://github.com/opscode-cookbooks/erlang.git
[submodule "wiki"]
path = wiki
url = https://github.com/joola/joola.wiki.git
4 changes: 4 additions & 0 deletions .npmignore
Expand Up @@ -30,3 +30,7 @@ benchmark
Procfile
Vagrantfile
Makefile

joola-data.json

data
66 changes: 37 additions & 29 deletions .travis.yml
@@ -1,58 +1,66 @@
language: node_js

node_js:
- "0.10"
#- "0.12"
#- "iojs"

- '0.10'
services:
- redis-server
- rabbitmq
- mongodb
#- elasticsearch

- elasticsearch
addons:
code_climate:
repo_token: b0cf984d93693c3e827901f766ca1f13b6acca03a3786b5e187356e66e8ffbec

env:
JOOLA_CONFIG_AUTHENTICATION_BASICAUTH_ENABLED=TRUE

env: JOOLA_CONFIG_AUTHENTICATION_BASICAUTH_ENABLED=TRUE
branches:
only:
- master
- develop

- master
- develop
matrix:
fast_finish: true
#allow_failures:
# - node_js: "0.12"
# - node_js: "iojs"


before_install:
- wget http://apache.claz.org/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
- tar -zxvf zookeeper*tar.gz
- zookeeper-3.4.6/bin/zkServer.sh start zookeeper-3.4.6/conf/zoo_sample.cfg

before_script:
- sudo rabbitmq-plugins enable rabbitmq_stomp
- sudo service rabbitmq-server restart
- sudo rabbitmqctl status
- sudo rabbitmq-plugins list
- redis-cli flushall

deploy:
provider: heroku
on: develop
app: joola-develop
api_key:
secure: u2sgcDddY6is6ZB1q1YsFQwlld0cvsSbfH6UtEVP7QvOeITriv2fauXnt+WTSzLqcLphzFPviUceMP9Qm4FcbKd1+qHHCAtpmZMTx7MXoFjJJXDVYwbL9iQURi5IS6lja8eLSJZk8yonDuWZ6f3babr/iW4o//CalslW5WDwHMs=
- provider: heroku
app: joola-develop
on:
branch: develop
api_key:
secure: u2sgcDddY6is6ZB1q1YsFQwlld0cvsSbfH6UtEVP7QvOeITriv2fauXnt+WTSzLqcLphzFPviUceMP9Qm4FcbKd1+qHHCAtpmZMTx7MXoFjJJXDVYwbL9iQURi5IS6lja8eLSJZk8yonDuWZ6f3babr/iW4o//CalslW5WDwHMs=

script: npm run test:coverage
- provider: heroku
app: joola
on:
tags: true
branch: master
api_key:
secure: u2sgcDddY6is6ZB1q1YsFQwlld0cvsSbfH6UtEVP7QvOeITriv2fauXnt+WTSzLqcLphzFPviUceMP9Qm4FcbKd1+qHHCAtpmZMTx7MXoFjJJXDVYwbL9iQURi5IS6lja8eLSJZk8yonDuWZ6f3babr/iW4o//CalslW5WDwHMs=

- provider: npm
email: info@joo.la
api_key:
secure: vHRhVNoacEpB9f10rfNP8S6vRO1P8PYQfMVmtXCjBD1gi+4kwXh1JuSqPJxiS0r+pYmNVg130Wo4ed5/VDcCvW8GoBOWvadw5UGILyJ7f09J/z+sNew0kzVGho07oip419ZWcN1cydQl4zwwSnxtYQMlWSQ6mhnzYqYCQ0tGL/s=
on:
tags: true
branch: master
script: npm run test:scenario
after_success:
- npm run test:scenario:coverage
- node ./build/coverage/aggregate.js
- npm run coveralls
- npm run codeclimate
- npm run test:api

notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/0a43ba3884562555a9c1
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: true # default: false
on_success: change
on_failure: always
95 changes: 17 additions & 78 deletions README.md
Expand Up @@ -24,22 +24,20 @@ Some of the main benefits of using joola include:
- **Extend**, easy to add more data sources, authentication and cache middleware.

### Getting Started
We've pre-loaded the package with a fully working sample site, so it's easy to get started.

joola uses several leading open-source software for its operation. Before getting started, please install [MongoDB](http://mongodb.org), [Redis](http://redis.io) and [RabbitMQ](http://www.rabbitmq.com/), for more details on these pre-requisites please refer to the [wiki](http://github.com/joola/joola/wiki/install-joola).

For the example below to work out-of-the-box, it's required to have both joola and its dependencies installed on localhost.
For more details on the installation process, please refer to [this guide](http://github.com/joola/joola/wiki/install-joola).
```bash
$ npm install -g joola
```

#### Using Docker
We have included a [Docker](http://www.docker.com) file to support easy playing around and testing.
Using Docker will pull the latest docker image and run joola in a container for you.
#### Docker
Joola can be used as a [Docker](http://www.docker.com) container file to support easy playing around and testing.
Docker will pull the latest docker image and run joola in a container for you.

```bash
$ docker run -p 8080:8080 -it joola/joola
```

#### Using Vagrant
#### Vagrant
We have included a [Vagrant](http://www.vagrantup.com) file to support easy playing around and testing. Running `vagrant up` will install all needed dependencies and allow you to run joola in a sand boxed virtual environment.

```bash
Expand All @@ -62,50 +60,19 @@ $ node joola.js

We have configured the VM to use 2 CPUs with 2048MB of memory, but these can be configured from `Vagrantfile` if you prefer different settings.

#### Install via NPM

```bash
$ mkdir /opt/joola
$ cd /opt/joola
$ npm install joola
$ node ./node_modules/joola/joola.js
```
#### Verifying installation

Access REST API using cURL (-k switch due to default localhost SSL certificate)
Access REST API using cURL:

```bash
$ curl -i -k https://localhost:8081/system/version?APIToken=apitoken-demo

HTTP/1.1 200 OK
Server: joola
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: ETag, X-RateLimit-Limit, X-RateLimit-Remaining,
X-RateLimit-Reset
X-joola-Request-Id: 87IpUGxDQ:1399738779977:0xOC0CqXB
X-Powered-By: joola
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4973
X-RateLimit-Reset: 1399741710
Retry-After: 2930
X-joola-Duration: 5
X-joola-Requested-By: 87IpUGxDQ
X-joola-Fulfilled-By: 87IpUGxDQ
X-joola-Duration-Fulfilled: 2
Content-Type: application/json
Content-Length: 36
ETag: "867689076"
Vary: Accept-Encoding
Date: Sat, 10 May 2014 16:19:39 GMT
Connection: keep-alive

{ "version": "joola version 0.4.1" }
```
$ curl http://localhost:8080/system/version?APIToken=apitoken-demo

Following the installation, point your browser to `https://localhost:8081` and you'll be able to use the framework.
{ "version": "joola version 0.9.0" }
```
[**Learn more about getting started with joola**](http://github.com/joola/joola/wiki/technical-documentation)
##### To push your first event
### Push your first event
Using cURL:
```bash
Expand All @@ -114,52 +81,24 @@ $ curl \
--request POST \
--header "Content-Type: application/json" \
--data-binary "[{
\"timestamp\": null,
\"article\": \"Sample Analytics\",
\"browser\": \"Chrome\",
\"device\": \"Desktop\",
\"engine\": \"Webkit\",
\"os\": \"Linux\",
\"userid\": \"demo@joo.la\",
\"ip\": \"127.0.0.1\",
\"referrer\": \"http://joo.la\",
\"visits\": 1,
\"loadtime\": 123
}]" \
https://localhost:8081/beacon/{workspace}/{collection}{?APIToken}
```
Using the SDK:
```js
var joola = require('joola.sdk');
joola.init({host: 'https://localhost:8081', APIToken: 'apitoken-beacon'}, function(err) {
var doc = {
"timestamp": null,
"article": "Sample Analytics",
"browser": "Chrome",
"device": "Desktop",
"engine": "Webkit",
"os": "Linux",
"userid": "demo@joo.la",
"ip": "127.0.0.1",
"referrer": "http://joo.la",
"visits": 1,
"loadtime": 123
};
joola.beacon.insert('collection-name', doc, function(err) {
console.log('Document saved');
});
});
http://localhost:8080/beacon/demo/demo?APIToken=apitoken-demo
```
[**Learn more about pushing data**](http://github.com/joola/joola/wiki/pushing-data)
##### Your first visualization
### Draw your first visualization
```html
<script src="https://localhost:8081/joola.js?APIToken=apitoken-demo"></script>
<script src="http://localhost:8080/joola.js?APIToken=apitoken-demo"></script>
<script>
joola.events.on('ready', function(err) {
joola.on('ready', function(err) {
if (err)
throw err;

Expand Down
21 changes: 21 additions & 0 deletions build/coverage/aggregate.js
@@ -0,0 +1,21 @@
var
path = require('path'),
fs = require('fs'),
istanbul = require('istanbul'),
collector = new istanbul.Collector(),
reporter = new istanbul.Reporter(),
sync = false;

var files = fs.readdirSync(path.join(__dirname, '../../coverage'));
files.forEach(function (f) {
if (f.indexOf('scenario_') > -1) {
var filename = path.join(__dirname, '../../coverage', f, 'coverage.json');
collector.add(JSON.parse(fs.readFileSync(filename, 'utf8')));
}
});

reporter.add('text');
reporter.addAll(['lcov']);
reporter.write(collector, sync, function () {
console.log('All reports generated');
});
Empty file modified build/scripts/postinstall.sh 100644 → 100755
Empty file.

0 comments on commit dd6ce81

Please sign in to comment.