Skip to content
Simon Gaeremynck edited this page Jan 14, 2014 · 7 revisions

OS:

Ubuntu 12.04 LTS

OS Dependencies:

  • Apache 2 (it has been qa'd with 2.2.22, but it's only being used to proxy HTTP, so I doubt it's really important)
  • Node JS 0.10.24 or later (no 0.11 though, odd releases are considered unstable in nodejs-land)
  • npm 1.3 or later
  • grunt-cli v0.1.11 (Used for the front-end build, run npm install -g grunt-cli to install)
  • bower v1.2.8 (Used to manage front-end dependencies, run npm install -g bower to install)

MySQL connection

The app needs to be able to connect to the union catalogue DB. TODO: Expand

Setup of the application:

Structure

The code lives at /opt/libraries-gateway/src and can be cloned from [1].

Dependencies

Run npm install under /opt/libraries-gateway/src
Run bower install under /opt/libraries-gateway/src

HTTP / Proxying

Apache handles all static assets under /opt/libraries-gateway/build/public and proxies all other requests to the node webserver which runs on port 5000 (by default). An example config can be found at [2].

Logging

The node process will log to /opt/libraries-gateway/build/server.log by default. This can be changed in /opt/libraries-gateway/build/config.js if desired. We’re using bunyan [3] which has a couple of built-in logging capabilities:

  • standard out
  • file on disk (be it rotating or not)
  • syslog [4]
  • logstash [5]
  • ..

Front-end Build

To build the application run grunt build:"/opt/libraries-gateway/build" under /opt/libraries-gateway/src. This will copy all the files to the build directory and create optimised versions for all assets. To run the app cd into the build directory and run node app.js.

Running the application without the front-end build

You can also run the application without optimising the front-end assets by running node app.js from /opt/libraries-gateway/src. Before you do so however you will have to run grunt less:dev from /opt/libraries-gateway/src to compile the less files. Also apache will need to be configured to serve the static assets from /opt/libraries-gateway/src/public.

Configuration

The configuration happens in 2 files ./config.js & ./config_private.js TODO: Expand

Links