UNOPS / ICAT.PythonApplication

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TraCAD - Python Application

Backend service for ICAT Climate Action Assessment Tool for Transport Sector - TraCAD.

Supported by Initiative for Climate Action Transparency - ICAT.

Built using Python 3 and FastAPI framework.

Manual Installation

  1. Download and install the Python 3 for your operational system.

  2. Download or clone this repository.

  3. In the terminal, go to this repository's main folder.

  4. Install the Pip dependencies with the command:

$ pip3 install -r requirements.txt
  1. Run the app:
$ uvicorn main:app --reload

Google Cloud Installation with Docker

This is an example cloud installation using Docker and Google Cloud Plataform. The provided Dockerfile can be used for local or cloud installation with different services.

  1. In GCP Console, go to Artifact Registry and enable the Artifact Registry API

  2. In the Artifact Registry, create a new repository:

    • Format: Docker
    • Type: Standard
    • Location: desired application location
    • Encryption: Google-managed key
  3. Download and install gcloud CLI.

  4. Download or clone this repository.

  5. In the terminal, go to this repository's main folder.

  6. Build your container in the Artifacts Register using the provided Dockerfile. The container path can be found on the Artifact Registry's repository page.

$ gcloud builds submit --tag [CONTAINER PATH]
  1. Go to Cloud Run and create a New Service:
    • Choose the option Deploy one revision from an existing container image and select the container image updated in the previous step
    • Add a service name
    • Select the application region
    • Select Allow unauthenticated invocations in the Authentication option
    • In the Container section:
      • Select Container port 80

Noticed that some special permissions in GCP can be necessary to perform these tasks.

API Documentation

After the application installation, the API Documentation is available in the application URL + /docs/ with Swagger.

Dependencies

This application provides API service to CountryPortalService application.

The complete dependency diagram of TraCAD Country and PMU applications:

TraCAD Diagram

License

TraCAD - CountryPortalService is Affero GPL licensed.

About

License:GNU Affero General Public License v3.0


Languages

Language:Python 96.6%Language:Dockerfile 3.4%