Building the System - njc3006/TTKDSeniorProject GitHub Wiki

In order to convert our system's source code from something that is human-maintainable to something that is browser-runnable, the system must first first be built. These instructions will assume you are using a windows-based machine because our system is designed to run on a windows-based machine.

The build process requires a few dependencies in order to work:

  • Node.JS and NPM (Node Package Manager)
  • Gulp (We use this program to actually build the UI)
  • Bower (This manages dependencies for the UI)
  • Python (this is included in the python_dist.zip file in the scripts/ folder)

Installing the build dependencies

Installing Node.JS

Before the UI can be built, Node.JS, a core dependency must be installed. The latest version can be found here. Follow any on-screen instructions to finish the install process, and you will have Node.JS and NPM installed. Be sure to install version 6 or greater.

Installing Gulp

With Node.JS and NPM installed, installing Gulp is a relatively straightforward affair. Perform the following actions to install gulp on your machine:

  1. Open a CMD prompt (Depending on how you installed Node.JS, you may need to run as an administrator).
  2. Enter the following command: npm install -g gulp

Installing Bower

Installing Bower is almost exactly the same process as installing Gulp above. Perform the following steps:

  1. Open a CMD prompt (Depending on how you installed Node.JS, you may need to run as an administrator).
  2. Enter the following command: npm install -g bower

Installing Python Modules

To install python dependencies, cd into the ttkd_api folder and run pip install -r requirements.txt.

Deployment

With all these tools installed, we can build a deployment.

To build a release for the project, setup a unix-like environment with the following dependencies installed (In addition to the dependencies needed to build the project):

  • unzip
  • zip

The easiest way to do this is to first download and install Git Bash. Then, install GNU on Windows.

Then, issue the following commands:

cd scripts
./build-release.sh
  • If you would like to start with a specific data set, export your data using python manage.py dumpdata > data.json, then put data.json in the root project directory.
    • Alternatively, you can run the scripts/import_json.py script prior to building a release to preconfigure your data.
  • If you change the requirements.txt of this project, you will need to extract scripts/python-dist.zip, copy and paste your python libraries you added into python-dist/python-X.X.X-embed-amd64/Lib/site-packages, and re-zip python-X.X.X-embed-amd64.
  • If the UI is all you're interested in, simply copy the static/ folder in the resulting build folder and use it to replace the static/ folder in your install folder with it