G2P Bridge

Installation of G2P Bridge on a developer machine

Developers can set up and run the G2P Bridge on their local machines. This guide outlines the steps to install G2P Bridge on a Linux-based laptop or desktop.

Prerequisites

  • Python3

  • Git

  • PostgreSQL

  • Redis

  • Celery

Installation of G2P Bridge

1. Update system packages

  • Log in to your Linux server using SSH and update the package list and upgrade the existing packages:

sudo apt update
sudo apt upgrade -y

2. Install dependencies

sudo apt install -y python3-pip python3-dev build-essential

3. Install and configure PostgreSQL

  • G2P Bridge requires PostgreSQL as the database engine. Install PostgreSQL and create a new database user for G2P Bridge.

    sudo apt install -y postgresql
    sudo su - postgres
    createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt g2p_bridge_user
    exit

4. Clone the G2P Bridge Repository

  • Clone the openg2p-g2p-bridge repository to your local machine.

    git clone https://github.com/OpenG2P/openg2p-g2p-bridge

5. Install Python Libraries and G2P Bridge Components

Setting up the Bridge API

  • Make a new Python virtual environment.

    cd openg2p-g2p-bridge/openg2p-g2p-bridge-api
    python3 -m venv venv
  • Activate the virtual environment.

    source venv/bin/activate
  • Use pip to install the required Python packages, including the core libraries for the G2P Bridge.

    python3 -m pip install \
        openg2p-fastapi-common==1.1.0 \
        openg2p-fastapi-auth==1.1.0 \
        openg2p-g2pconnect-common-lib==1.1.0 \
        openg2p-g2p-bridge-models==1.0.0 \
        openg2p-g2p-bridge-api==1.0.0
  • Update the .env

      G2P_BRIDGE_DB_DBNAME: openg2p_g2p_bridge_db
      G2P_BRIDGE_DB_HOSTNAME: localhost
      G2P_BRIDGE_DB_PASSWORD: password
      G2P_BRIDGE_DB_PORT: 5432
      G2P_BRIDGE_DB_USERNAME: bridgeuser
      G2P_BRIDGE_WORKER_TYPE: gunicorn
      G2P_BRIDGE_HOST: 0.0.0.0
      G2P_BRIDGE_PORT: '8000'
      G2P_BRIDGE_NO_OF_WORKERS: '1'
      G2P_BRIDGE_OPENAPI_ROOT_PATH: '/api/g2p-bridge'
  • Migrate the database schema

    python3 main.py migrate; 
  • Run the API server on 127.0.0.1:8000

    gunicorn "main:app" --workers 1 --worker-class uvicorn.workers.UvicornWorker --bind 127.0.0.1:8000

Last updated

Logo

Copyright © 2024 OpenG2P. This work is licensed under Creative Commons Attribution International LicenseCC-BY-4.0 unless otherwise noted.