Skip to content

Microbrew.it API Web Stack

Torstein Thune edited this page Aug 6, 2013 · 1 revision

This page outlines the stack used by the Microbrew-it backend. You will need to install most of these applications/services to be able to run the API and contribute to the development of the software:

TL;DR

Node.js

Node.js is a Javascript-based server framework. We use Node.js with Express to develop the API-part of the backend. Node.js can be found at http://nodejs.org/. If you use Ubuntu (or other Linux distros) you can find a tutorial on how to add the official packages at: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager.

Our node.js api have some dependencies. These are listed in the package.json file.

PostgreSQL

The API use a PostgreSQL database to store basic user info such as username, email, a hashed and salted password and user settings. PostgreSQL can be found at http://www.postgresql.org/. If you use Ubuntu PostgreSQL can be installed using sudo apt-get install posgtresql. A detailed description of how to install PostgreSQL on Ubuntu 12.04 (should work on all version =< 12.04) can be found at: http://fracturedplane.blogspot.no/2013/02/installsetup-postgres-91-on-ubuntu-1204.html.

Our database definitions:

CREATE TABLE users (
 id serial primary key,
 username varchar(256) NOT NULL,
 email varchar(256) NOT NULL,
 password varchar(60) NOT NULL,
 settings text NOT NULL,
 UNIQUE(username),
 UNIQUE(email));

Redis

Redis is a key-value store with both in-memory and persistent storage of data. The Microbrew-it API currently use it to store user sessions, but will in the future also use Redis to cache frequently requested resources. To install Redis (server and client) you can download an installation file from http://redis.io/download or follow the terminal command guide on the same page. Alternatively, for those using Ubuntu you can install the latest version through the following ppa: https://launchpad.net/~rwky/+archive/redis. More detailed instructions are provided on the ppa site.

Sesame/Tomcat

The Microbrew.it data is stored in a graph store powered by Sesame. Sesame provides a Sparql endpoint that we use to extract data. Sesame and a workbench utility that can be used to directly manipulate the graph through a GUI is available at http://www.openrdf.org/download.jsp. In order to host a Microbrew.it endpoint you will need to import the Microbrew.it ontology, available at https://github.com/Microbrewit/brewingOntology. The ontology defines the entities used in the graph, and the relation between entities.

Sesame runs on a Tomcat instance. Tomcat is a Java-based webserver. Tomcat is available at http://tomcat.apache.org/ or through most package managers.

Clone this wiki locally