1. data brewery
Ways of Cubes
Deployment
Stefan Urbanek ■ @Stiivi ■ stefan.urbanek@gmail.com ■ February 2014
2. Simple Slicer
1
HTML & JS
Application
> slicer serve slicer.ini
HTTP request
Public
Run Slicer server
JSON reply
2
Slicer server
Query server from JavaScript
GET /cubes
!
GET /cube/{CUBE}/model
!
model
store
GET /cube/{CUBE}/aggregate?…
3
Provide desired output
3. WSGI Slicer
HTML & JS
Application
HTTP request
Public
JSON reply
WSGI
Same usage as stand-alone Slicer server
Slicer Flask App
model
store
4. Slicer as a Service
HTML
1
Public
Web Application
PHP, RoR, Django
Run a Slicer server instance
2
Get the model using HTTP
HTTP request
GET /cubes
!
GET /cube/{CUBE}/model
JSON reply
Internal
3
Slicer server
GET /cube/{CUBE}/aggregate?…
model
4
store
Query with HTTP requests
Provide desired output
5. Python Application
1
Public
Python Web App handles the request
2
HTML
Application uses the Cubes directly:
JSON reply
from cubes import Workspace
!
Django, Flask, …
Cubes
Python API
workspace = Workspace(“slicer.ini”)
browser = workspace.browser(…)
result = browser.aggregate(…)
model
3
store
Python Web App provides output
6. Flask Blueprint*
1
Register Slicer as part of Flask app
HTML
from flask import Flask
from cubes.server import slicer
Public
!
Flask
app = Flask(__name__)
Slicer Blueprint
!
model
app.register_blueprint(slicer,
url_prefix=“/slicer",
config="slicer.ini")
store
2
Provide Slicer API as additional
“raw analytical data” API
do whatever you want in Flask
* http://flask.pocoo.org/docs/blueprints/