Developers can set up and run the G2P Bridge Example Bank Simulator on their local machines. This guide outlines the steps to install the same on a Linux-based laptop or desktop.
Installation of Example Bank Simulator
1. Update system packages
Copy sudo apt update
sudo apt upgrade -y
Copy sudo apt install -y python3-pip python3-dev build-essential
3. Install and configure PostgreSQL
4. Clone the G2P Bridge Repository
5. Install Python Libraries and G2P Bridge Components
Example Bank API Example Bank Celery
Setting up the Bridge API
Make a new Python virtual environment.
Copy cd openg2p-g2p-bridge/openg2p-g2p-bridge-example-bank-api
python3 -m venv venv
Activate the virtual environment.
Copy source venv/bin/activate
Use pip
to install the required Python packages, including the core libraries for the G2P Bridge.
Copy python3 -m pip install \
openg2p-fastapi-common== 1.1.0 \
openg2p-fastapi-auth== 1.1.0 \
openg2p-g2p-bridge-example-bank-models== 1.0.0 \
openg2p-g2p-bridge-example-bank-api== 1.0.0
Update the .env
Copy EXAMPLE_BANK_DB_HOSTNAME: localhost
EXAMPLE_BANK_DB_DBNAME: example_bank_db
EXAMPLE_BANK_DB_USERNAME: bankuser
EXAMPLE_BANK_DB_PASSWORD: password
EXAMPLE_BANK_CELERY_BROKER_URL: redis://127.0.0.1:6379/0
EXAMPLE_BANK_CELERY_BACKEND_URL: redis://127.0.0.1:6379/0
Migrate the database schema
Copy python3 main.py migrate;
Run the API server on 127.0.0.1:8000
Copy gunicorn "main:app" --workers 1 --worker-class uvicorn.workers.UvicornWorker --bind 127.0.0.1:8000
Setting up the Example Bank Celery
Make a new Python virtual environment.
Copy cd openg2p-g2p-bridge/openg2p-g2p-bridge-example-bank-celery
python3 -m venv venv
Activate the virtual environment.
Copy source venv/bin/activate
Use pip
to install the required Python packages, including the core libraries for the G2P Bridge.
Copy python3 -m pip install \
openg2p-fastapi-common== 1.1.0 \
openg2p-fastapi-auth== 1.1.0 \
openg2p-g2p-bridge-example-bank-models== 1.0.0 \
openg2p-g2p-bridge-example-bank-celery== 1.0.0
Run redis-server
Copy bash sudo systemctl start redis
Update the .env
Copy EXAMPLE_BANK_CELERY_DB_HOSTNAME: localhost
EXAMPLE_BANK_CELERY_DB_DBNAME: example_bank_db
EXAMPLE_BANK_CELERY_DB_USERNAME: bankuser
EXAMPLE_BANK_CELERY_DB_PASSWORD: password
EXAMPLE_BANK_CELERY_CELERY_BROKER_URL: redis://127.0.0.1:6379/0
EXAMPLE_BANK_CELERY_CELERY_BACKEND_URL: redis://127.0.0.1:6379/0
EXAMPLE_BANK_CELERY_MT940_STATEMENT_CALLBACK_URL: http://openg2p-g2p-bridge-api/upload_mt940
Run the celery beat and worker
Copy celery -A main.celery_app worker --loglevel=info --beat & \
celery -A main.celery_app worker --loglevel=info -Q g2p_bridge_celery_worker_tasks