Skip to content

Tasking Manager 3 code, issues, documentation and fun. Please see the Tasking Manager 2 repository for any issues related to the previous version of the Tasking Manager.

License

Notifications You must be signed in to change notification settings

OpenStreetMapColombia/tasking-manager

 
 

Repository files navigation

HOT tasking-manager

Intro

The app is split into a Client (AngularJS) and Server (Python) structure. Each can be developed independently of each other. See below for instructions on how to set up your deve environment.

See our FAQ if you hit any problems getting setup

Client Development

Global Dependencies

Following must be available locally:

App Dependencies

You will now have to install all the app dependencies using NPM

cd client
npm install

Running Locally

If you plan to do client development you can run the app using gulp, without having to worry too much about the server. If you want to point the client at a non-local API (e.g. a staging environment), you'll have to change the environment config for development in client/taskingmanager.config.json.

cd client   [if not already in client]
gulp run

Running Unit Tests

The client has a suite of Jasmine Unit Tests, that you can run using Karma as follows

 cd client    [if not already in client]
 karma start ..\tests\client\karma.conf.js

Server Development

Dependencies

Following must be available locally:

Build the Server

  • Create a Python Virtual Environment, using Python 3.6:
    • python -m venv ./venv
  • Activate your virtual environment and install dependencies:
    • Linux/Mac:
      • . ./venv/bin/activate
      • pip install -r requirements.txt
    • Windows (use installer because of precompiled libs):
      • .\venv\scripts\activate
      • .\devops\win\install.bat

Environment vars:

As the project is open source we have to keep secrets out of the repo. You will need to setup the following env vars locally:

  • TM_DB - This is the for the PostGIS connection string. If you can't access an existing DB refer to DevOps page to set up a local DB in Docker

  • TM_SECRET - This is secret key for the TM app used by itsdangerous and flask-oauthlib for entropy

  • TM_CONSUMER_KEY - This is the OAUTH Consumer Key used for authenticating the Tasking Manager App in OSM

  • TM_CONSUMER_SECRET - This is the OAUTH Consumer Secret used for authenticating the Tasking Manager App in OSM

  • TM_SMTP_HOST - The hostname for the SMTP server that is used to send email alerts

  • TM_SMTP_USER - The user for the SMTP server that is used to send email alerts

  • TM_SMTP_PASSWORD - The password for the SMTP server that is used to send email alerts

  • Linux/Mac

    • (It is strongly recommended to set these within your .bash_profile so they are available to all processes )
    • export TM_DB=postgresql://USER:PASSWORD@HOST/DATABASE
    • export TM_SECRET=secret-key-here
    • export TM_CONSUMER_KEY=oauth-consumer-key-goes-here
    • export TM_CONSUMER_SECRET=oauth-consumer-secret-key-goes-here
    • export TM_SMTP_HOST=smtp-server-host-here
    • export TM_SMTP_USER=smtp-server-user-here
    • export TM_SMTP_PASSWORD=smtp-server-password-here
  • Windows:

    • setx TM_DB "postgresql://USER:PASSWORD@HOST/DATABASE"
    • setx TM_SECRET "secret-key-here"
    • setx TM_CONSUMER_KEY "oauth-consumer-key-goes-here"
    • setx TM_CONSUMER_SECRET "oauth-consumer-secret-key-goes-here"
    • setx TM_SMTP_HOST "smtp-server-host-here"
    • setx TM_SMTP_USER "smtp-server-user-here"
    • setx TM_SMTP_PASSWORD "smtp-server-password-here"

Creating the DB

We use Flask-Migrate to create the database from the migrations directory. If you can't access an existing DB refer to DevOps page to set up a local DB in Docker Create the database as follows:

python manage.py db upgrade

Running Locally

API Development only

If you plan to only work on the API you don't need to build the client and can run as follows:

Seeing the client

If you want to see the client you will need to follow all the instruction in Client Development section then build the client as follows:

  • Build the client using gulp:
    • cd client
    • gulp build
  • You can now run the server as above from the root dir:
    • cd ..
    • python manage.py runserver -d -r
  • Point your browser to:

Running Unit Tests

The project includes a suite of Unit and Integration tests that you should run after any changes

python -m unittest discover tests/server

Dev Ops

Server Config

Environment Vars

On boot the Tasking Manager App will look for the following environment vars:

  • TASKING_MANAGER_ENV - Allows you to specify which config to load from ./server/config.py Acceptable values:
    • Dev - This is the default
    • Staging - Use this for your staging/test environment
    • Prod - Use this for your production environment

Localisation

Please see the Localisation Wiki for more details.

About

Tasking Manager 3 code, issues, documentation and fun. Please see the Tasking Manager 2 repository for any issues related to the previous version of the Tasking Manager.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 35.9%
  • JavaScript 31.1%
  • HTML 26.6%
  • CSS 6.2%
  • Shell 0.2%
  • Mako 0.0%