The sections below detail how to install the project.
(Table of contents automatically generated by https://luciopaiva.com/markdown-toc/).
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.
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.
-
We're assuming you have Python 2.7 installed. If not, install it.
-
Install system-level dependencies.
apt-get install libhdf5-dev libgdal-dev libnetcdf-dev -
Create a Python 2.7 virtual environment and activate it.
-
Install Python build packages.
RUN pip install --upgrade pip setuptools wheel -
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 -
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 .
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".
With Node.js installed (see above), you can install all the test framework dependencies as follows:
npm installNotes:
-
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 installjest-environment-jsdom-fourteen, which upgrades the version ofjsdom. This may become unnecessary with later versions of Jest. -
Since little of the JS code is written with unit testing in mind, we exploit
jsdomheavily 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.