Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Getting started

Garbash edited this page Jan 6, 2014 · 37 revisions

Getting Started

OK, so you want to clone and run the KnowNodes application on your own machine. This page is here to guide you through the steps to achieve that.

Prerequisites

  • Install Node.js version 0.8!

  • For MacOSX - do you have an updated Xcode and have command line tools installed? If not update/install through app store and please go through the instructions here

  • For Linux, build-essential package sudo apt-get install build-essential

  • Install the npm modules npm install

  • WebStorm 6 (if you are part of CRI, ask Dor for the licence key)

    • WebStorm is not a required dependency, for instance the app works with Linux from the command line.
  • Unix-based OS

Up until now, no one has had the courage to make the build process compatible with Windows. It shouldn't be THAT hard, however you should now that if you try, you'll be on your own, so good luck. A known issue is relative to line 6 of the package.json file :

"build": "coffee -c controllers/.; _coffee -c modules/.",

Windows won't understand the semi-colon.

  • Install neo4j version 1.8.3

Checkout project

Command-line

git clone https://github.com/CyberCRI/KnowNodes.git

WebStorm

That should be pretty easy. In WebStorm, run :

VCS > Checkout from Version Control > GitHub

When prompted, paste the URL : https://github.com/CyberCRI/KnowNodes.git

Another alternative for OSX users is to use the "clone in mac" option.

Config Files

To run the project, you'll need the configuration files :

  • DB.conf.js
  • settings.js
  • loggly.conf.js

These files include the credentials for the database, and are mandatory to be able to run the project. Ask Dor for them. Keep in mind that these files are top secret, so don't share them lightly and make sure you don't commit them to the Git repository.

Once you have those files, just paste them into the /config folder.

npm install

You will need to install all the dependencies of the KnowNodes project and also compile the .coffee and ._coffee to .js . Node Packaged Modules (npm) will do that for you automatically, all you have to do is :

  1. Open a terminal
  2. Navigate to the root of the KnowNodes project (typically, ~/WebstormProjects/KnowNodes/)
  3. Run npm install
  4. (Probably useless) Run sudo npm install streamline -g
  5. (Might help if problem) Run npm install jugglingdb

A common pitfall at this phase is linked to the presence of the npm-shrinkwrap.json file. If you encounter the following message : awk: line 1: illegal reference to array a Then you should delete the npm-shrinkwrap.json file before running npm install. Restore the file after that. (npm-shrinkwrap.json is used only for appfog deploys, it is not used locally)

Run Configurations

Command-line

Choose to use the production or development environments:

export NODE_ENV=production

or

export NODE_ENV=development

compiling LESS, .coffee and ._coffee

By just running npm install your files will be compiled! You can also use npm run build.

Start

To star the application locally, simply use:

npm start

Then navigate to: localhost:3000

WebStorm

When running the KnowNodes project, you will be able to run against the development or the production database. In order to be able to switch easily from one to another you can either import the settings.jar file or you can manually create two separate run configurations in WebStorm :

Run > Edit Configurations > Add New Configuration ("+") > Node.js

Run Configuration 1 : Production

  • Name : Production
  • Path to Node App JS File : app.js
  • Environment Variables (press the rightside icon to edit it): NODE_ENV=production

Run Configuration 2 : Development

  • Name : Development
  • Path to Node App JS File : app.js
  • Environment Variables (press the rightside icon to edit it) : NODE_ENV=development

compiling LESS, .coffee and ._coffee

By just hitting npm install your files will be compiled!

If you wish, you can add a watcher in Webstorm for coffee, _coffee and Less files.

Start

That should be it ! All you have to do now is to run one of either configurations, and navigate to : localhost:3000

Nice things to know

Jade template engine generates our HTML

Less generates our CSS

BootStrap 2.3.2 is our CSS framework