Skip to content

Latest commit

 

History

History
112 lines (78 loc) · 3.7 KB

File metadata and controls

112 lines (78 loc) · 3.7 KB

Installation

The sections below detail how to install the project.

(Table of contents automatically generated by https://luciopaiva.com/markdown-toc/).

For production

PDP is now deployed in production using Docker. All installation related to production deployments is encapsulated in the production Docker infrastructure. For more details, see Deploying a production instance.

For development

Python

Due to difficulties installing the Python code directly in a workstation (particularly on Ubuntu >=20.04), we've defined Docker infrastructure that eliminates the need to install PDP on your workstation.

For running Python tests, see Docker container for running Python tests.

For running the application, see Deploying locally for development and Deploying a production instance (specifically, remarks on locally testing production deployment).

It may be possible to do a direct installation on a workstation. Here are the steps likely involved. They are drawn from the installation procedures in our Docker infrastructure mentioned just above.

These instructions have not been tested on a workstation. YMMV.

  1. We're assuming you have Python 2.7 installed. If not, install it.

  2. Install system-level dependencies.

    apt-get install libhdf5-dev libgdal-dev libnetcdf-dev
    
  3. Create a Python 2.7 virtual environment and activate it.

  4. Install Python build packages.

    RUN pip install --upgrade pip setuptools wheel
    
  5. Set up GDAL lib paths and the PIP index URL.

    export CPLUS_INCLUDE_PATH=/usr/include/gdal
    export C_INCLUDE_PATH=/usr/include/gdal
    export PIP_INDEX_URL https://pypi.pacificclimate.org/simple
    
  6. Install Python dependencies (separate install for GDAL is required).

    pip install --no-binary :all: numpy==1.16.6 Cython==0.22 gdal==2.2
    pip install --no-binary :all: h5py==2.7.1
    pip install -r requirements.txt -r test_requirements.txt -r deploy_requirements.txt
    pip install -e .
    

JavaScript

The test framework for the PDP frontend JavaScript code runs in Node.js.

There are several valid ways to install Node.js on a Ubuntu system.

We recommend using nvm to manage your node/npm install. It is a little more laborious (not a lot), and provides a lot more flexibility than the simpler installation methods, which you can look up by searching "ubuntu install nodejs".

JS test framework

With Node.js installed (see above), you can install all the test framework dependencies as follows:

npm install

Notes:

  • The JS tests are written using a framework called Jest which provides many useful features, including a simulation of the DOM in JS that enables tests of code that manipulate the DOM.

  • DOM simulation is provided by a package called jsdom, which ships with Jest. However, the version that currently ships lacks a couple of features that we need, so we install jest-environment-jsdom-fourteen, which upgrades the version of jsdom. This may become unnecessary with later versions of Jest.

  • Since little of the JS code is written with unit testing in mind, we exploit jsdom heavily in the tests. Essentially, these tests use jQuery queries to find out what is going on in the DOM as the app does its thing.