1. Amit Narayanan
  2. facilities


Clone wiki

facilities / Home

Facilities Wiki Home

Dev Setup


This is a maven project, so we need a proper maven executable (no, seriously).

You'll also need apache integrated with tomcat thru' either mod_jk or thru' mod_proxy; its really upto you. Personally, I just used mod_jk, but I can give you the config files for mod_proxy if you prefer.

You'll need a database (PostgreSQL in this case).

And finally, you'll need the Mercurial DVCS system to checkout/checkin source.

The easiest way to install all this is via MacPorts (http://macports.org). Download MacPorts (a DMG file) and run the packager (.pkg) file in it to install. Then open up Terminal and run the following:

sudo port selfupdate
sudo port install apache2
sudo port install mod_jk
sudo port install tomcat6
sudo port install mercurial

For PostgreSQL, you've a couple of options. You could either use macports and run, you guessed it, sudo port install postgresql84 and sudo port install postgresql84-server OR you could download a readymade installer from http://postgresql.org. Either will work just fine.

Project arch

Project is setup so that the entire UI is pure HTML and all of the interaction is in JavaScript (much of it patterned after MVC). The app server (Tomcat) has no JSPs or any other such templates. No html ever gets rendered by the app server. The app server acts purely as a datasource for the frontend application that runs in the browser. And it interacts with the frontend primarily by sending and receiving Json objects. The rendering of useful data (models) in the views is done through the PURE JS library, which, rather elegantly and unobtrusively maps presentation element id's (typically div or span ids) with Json object properties.

Because of this setup, the facilities directory in the project should be aliased in apache's httpd conf. (See Apache Alias Config) Alternatively, you could also get away by adding a shortcut to the facilities directory from within apache's htdocs directory. Make sure to configure mod_jk to unmount all of the static content in /facilities (unless using mod_proxy, in which case you'll need to Alias static resource directories and add proper <Directory> configuration for each dir in httpd.conf or mod_proxy.conf). NOTE: Apache is very finicky about permissions and won't deliver static content from configured directories unless the permissions are absolutely perfect--so if you see (13)Permission Denied in apache error_log you know what you need to muck with.

When you get the application up and running, you will be prompted with an auth challenge. Currentlly, this spring security component uses a very rudimentary configuration in securityContext.xml with usernames and passwords hardcoded. You can either use anarayan/anarayan or alisonma/alisonma to login. Of course, this setup is very temporary and there will be a proper security setup (with the option of either using the application's database or an external LDAP) before a serious release.

Subsequent to the above write up, I've created a /conf directory at the project's root that houses httpd.conf.snippet, workers.properties, and settings.xml configurations for Apache 2.2, mod_jk, and maven2 respectively. You can shoe horn the httpd.conf.snippet into your own Apache httpd.conf, create a new (or add to an existing) workers.properties for mod_jk in your Apache conf directory, and create a new (or add to an existing) settings.xml file for maven2 in your ~/.m2 directory.


The DB schema and some working/dummy data can be restored to a fresh Postgres install using the create_db.sh} and facilities_db.sql scripts in the /sql directory at the root of the project. If the DB snapshot seems out of date with the code, let me know or raise an issue and I will dump the latest SQL.

Markets to address