Deploying Cubes OLAP Web service server (for analytical API) can be done in four very simple steps:
Note
The model paths have to be full paths to the model, not relative paths to the configuration file.
Place the file in the same directory as the following WSGI script (for convenience).
Create a WSGI script /var/www/wsgi/olap/procurements.wsgi:
import os.path
from cubes.server import create_server
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
# Set the configuration file name (and possibly whole path) here
CONFIG_PATH = os.path.join(CURRENT_DIR, "slicer.ini")
application = create_server(CONFIG_PATH)
Apache site configuration (for example in /etc/apache2/sites-enabled/):
<VirtualHost *:80>
ServerName olap.democracyfarm.org
WSGIScriptAlias /vvo /var/www/wsgi/olap/procurements.wsgi
<Directory /var/www/wsgi/olap>
WSGIProcessGroup olap
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
ErrorLog /var/log/apache2/olap.democracyfarm.org.error.log
CustomLog /var/log/apache2/olap.democracyfarm.org.log combined
</VirtualHost>
Reload apache configuration:
sudo /etc/init.d/apache2 reload
Configuration file uwsgi.ini:
[uwsgi]
http = 127.0.0.1:5000
module = cubes.server.app
callable = application
Run uwsgi uwsgi.ini.
You can set environment variables:
To deploy the slicer in Heroku, prepare a directory with following files:
The Procfile:
web: uwsgi uwsgi.ini
The uwsgi.ini:
[uwsgi]
http-socket = :$(PORT)
master = true
processes = 4
die-on-term = true
memory-report = true
module = cubes.server.app
The requirements.txt:
Flask
SQLAlchemy
-e git+git://github.com/DataBrewery/cubes.git@master#egg=cubes
jsonschema
python-dateutil
pytz
uwsgi
Add any packages that you might need for your Slicer server installation.