Skip to content
Andreas edited this page Nov 5, 2013 · 57 revisions

NOTE: these instructions might only work with the Ubuntu 12.04 LTS 64bit release!

To run the project, you first need to make sure that you have Erlang and R installed, and for some functionality in R to work you need to manually install a package for it..

Install Erlang

Download erlang: http://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_16.b.1~ubuntu~precise_amd64.deb

Install it:

sudo dpkg -i <deb file>

Install R (and friends)

The backend system uses R for statistical computations, such as time series forecasting (a.k.a predictions). It can be used through calls to the API, and uses an internal interface to feed commands from Erlang to R and get back results. In order to compile the project, two of three parts are necessary, and in order to run time series forecasting, an extra step is required.

###R Installing R simply requires a few simple commands, but after you are required to manually set an environment variable when the installation is finished.

installing R

Using a terminal, you enter the following commands:

    sudo add-apt-repository "deb http://ftp.sunet.se/pub/lang/CRAN/bin/linux/ubuntu precise/"
    sudo apt-get update
    sudo apt-get install r-base

Now you should be ready to run R. If you run

make install

it should now be able to download and compile rErlang, and the rest of the project.

Setting R_HOME (important!)

Unfortunately, R does not set the variable R_HOME to what we need to use it from within our engine. There are two ways to set this variable:

  • For each session, before you start the engine, run

export R_HOME=/usr/lib/R

in the terminal. NO BLANKSPACES AROUND THE = SIGN!

  • In $HOME/.profile, insert the line

export R_HOME="/usr/lib/R"

This will set the variable when you log in to the system (will not take effect until you relog/restart ubuntu). This way you don't have to worry about remembering to set it every time you start a new terminal.

rErlang

rErlang is our internal api for connecting Erlang and R. It is included as a dependency in our project and is automatically downloaded and compile when you run

make install

It does require R to compile, so make sure you have done that first.

Forecast package in R

This one needs to be done manually, but is only required for actually running predictions. Start R in a terminal with the command

R

Inside R, enter the following:

install.packages("forecast")

choose y twice, then select the mirror you want to use (preferably one close to you). Once the installation is done, you can quit R with

q()

You should now be ready to go.

Downloading the project

All you need to do is check out our project. We recommend using the develop branch, as it is the latest (most) stable. The demo branch periodically has some newer functionality, but stability is not guaranteed.

Downloading dependencies

The following commands will install the needed dependencies:

sudo apt-get install -qq xsltproc

make install

Running the elasticsearch server

This will run the elasticsearch server on your computer.

make run_es

Our back-end can be started without it, but the API can not be used unless it is started.

Configuring ES

COMING SOON. No configuration should be necessary for now.

Run the application

This command starts the back-end service, enabling the API.

make run

Running tests

make test

Clone this wiki locally