Spotter-VM/doc/applications/taarifa.rst

63 lines
2.2 KiB
ReStructuredText
Raw Normal View History

Taarifa Waterpoints
===================
Overview
--------
Taarifa Waterpoints is a mapping application for waterpoint management system for Tanzania. It has frontend written in JavaScript and backed in python. Uses TaarifaAPI as a framefork and MongoDB as a document storage.
Upstream URL: https://github.com/taarifa/TaarifaWaterpoints
API URL: https://github.com/taarifa/TaarifaAPI
Fork URL: https://github.com/trendspotter/TaarifaWaterpoints - the fork contains fixes for python3 compatibility and ready-to-use release package with frontent build using the method below.
2021-01-24 12:14:59 +01:00
MongoDB
-------
Application uses MongoDB NoSQL database as a data storage, currently running as unsecured instance without any admin user.
Data need to be prepopulated before the application can be used for the first time. Prepopulation is done as part of installation script as follows
.. code-block:: bash
cd /srv/taarifa
export MONGO_URI=mongodb://taarifa-mongodb/taarifa
python manage.py create_facility
python manage.py create_service
python manage.py upload_waterpoints demodata.csv
Frontend build
--------------
2021-01-24 12:14:59 +01:00
Frontend requires ancient verions of packages to work correctly. Following sequence produces usable dist directory on Debian 10.
.. code-block:: bash
# Install build packages
apt-get update
apt-get -y install build-essential git libpng-dev xz-utils wget
# Install Node.js 4
wget https://nodejs.org/dist/latest-v4.x/node-v4.9.1-linux-x64.tar.xz
mkdir -p /usr/local/lib/nodejs
tar -xJvf node-v4.9.1-linux-x64.tar.xz -C /usr/local/lib/nodejs
export PATH=/usr/local/lib/nodejs/node-v4.9.1-linux-x64/bin:${PATH}
# Clone Taarifa Waterpoints
git clone https://github.com/taarifa/TaarifaWaterpoints.git /tmp/taarifa
cd /tmp/taarifa
git checkout 7d0c784eb01b811e65c829796c88d9367f8fa5f7
git cherry-pick -n 984a6353f8b50e9f7f643d22e5c77ad0eb352bcb
# Install NPM packages
export HOME=/root
npm install
npm install -g grunt-cli bower
bower install --allow-root
# Hackfix grunt task and build dist
sed -i "s/'bower',//" Gruntfile.js
grunt build