Server and Developer Setup

Dev setup


Most dependencies can be installed automatically with npm. However, there are a few libraries that had to be patched or where we need a more recent version than what is published on npm. These are listed below. If an updated npm package with the necessary features becomes available, we can switch to using the published package.


The latest version on npm as of 8/5/2011 is 0.2.1, which has a bug where forms are not parsed if there are any asynchronous middleware installed on the server. I've forked the code and fixed this, and there is an  outstanding pull request on github but in the meanwhile:

$ git clone
$ cd connect-form
$ sudo npm link


The latest version on npm as of 8/24/2011 is 0.3.1, which doesn't support libraries that use the module.exports = function ()... idiom. There is an  outstanding pull request on github to make this work, but in the meanwhile:

$ git clone
$ cd yabble
$ sudo npm link


This is a MySQL session store that I wrote. It is published on npm so we don't need to pull it from github, but it is here for reference:

MySQL setup

We need to create a database and a user for the TestHarness to access:

CREATE USER 'TestHarness'@'localhost' IDENTIFIED BY 'TestHarness';
GRANT ALL ON `TestHarness`.* TO 'TestHarness'@'localhost';

Currently node-mysql can only access the MySQL server via a TCP socket connection even on localhost (as opposed to using a Unix domain socket) so the server needs to be configured to accept connections via the TCP port. This is normally the default setting unless it has been changed for security reasons.

Carnegie Learning Flash games

The Flash games are not checked into the git repo. You need to grab them from our internal build, and unzip the fluency-games director to the repository at the following locations:

  • src/static/private/fluency/games

The private directory is ignored by git.

Web app server

$ git clone
$ cd MathFluency
$ npm link connect-form
$ npm link yabble
$ npm install
$ mkdir -p src/static/private/fluency/output
$ node src/TestHarness/servermain.js

The last line should print something like "Test harness server running on port 8000". You should now be able to access the test harness at  http://localhost:8000

Server setup

The server is set up almost exactly the same as the dev environment, except that there is an nginx server acting as a reverse-proxy, and the web app is run using a different config file.


nginx is the front-end HTTP server that acts as a reverse proxy for the web app, and for tracd. Additionally, nginx directly serves static files for the Flash-based games and the fluency browser.

To start, stop, or restart the nginx server:

$ sudo /etc/init.d/nginx [start|stop|restart]

The configuration for nginx is in the repo at config/nginx. The version in the testharness production directory (see below) are symlinked on the server to /etc/nginx/sites-available.

Test Harness

The test harness node server runs on port 8000. There is an  upstart script to handle starting and stopping of the server at /etc/init/testharness. To start, stop or restart the server:

$ sudo [start|stop|restart] testharness

The test harness runs out of a git repository at /var/www/testharness. It is set to track the branch origin/testharness-production via github. To update the server, do:

$ cd /var/www/testharness
$ git pull
$ npm update
$ sudo restart testharness


There is a second installation of the test harness server used to test new code. This server runs on port 8002, and is accessed via This server is generally running the master branch. To update:

$ cd /var/www/testharness-staging
$ git pull
$ npm update
$ sudo restart testharness-staging

Unlike the main server, nginx does not serve static files directly. Instead, all fluency games etc are served via src/static/private/fluency much like the default debug environment.

The staging server uses its own database and user, so follow the MySQL instructions above except use database name `TestHarness_staging` with user and password 'staging'.


This very wiki as running via a tracd server on port 8080, also behind the nginx reverse proxy. The installation is at /var/trac/fluencychallenge. There is an upstart script to handle starting and stoping the server at /etc/init/tracd. To start, stop or restart the server:

$ sudo [start|stop|restart] tracd