-
Notifications
You must be signed in to change notification settings - Fork 31
Setup
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..
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>
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.
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
If you don't have add-apt-repository you can get it via '''haxe sudo apt-get install software-properties-common '''
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.
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.
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.
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.
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.
The following commands will install the needed dependencies:
sudo apt-get install -qq xsltproc
make install
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.
COMING SOON. No configuration should be necessary for now.
This command starts the back-end service, enabling the API.
make run
To run the test, you should make sure that the service is not already running. If you did a make run
before, make sure to quit it, using q().
. Now you can do a make test, make test will start the service, run the tests and then shut the service down.
make test