Code Monkey home page Code Monkey logo

gateway-api's Introduction

Pastel Gateway API

API Changes from v1.2.1 to v2.0.0

Cascade:

/api/v1/cascade/pastel_ticket_by_stored_file_hash          --> /api/v1/cascade/pastel_registration_ticket_from_stored_file_hash

Sense:

/api/v1/sense/raw_output_file_by_registration_ticket       --> /api/v1/sense/raw_dd_result_file_from_registration_ticket
/api/v1/sense/parsed_output_file_by_registration_ticket    --> /api/v1/sense/parsed_dd_result_file_from_registration_ticket
/api/v1/sense/raw_output_file_by_activation_ticket         --> /api/v1/sense/raw_dd_result_file_from_activation_ticket
/api/v1/sense/parsed_output_file_by_activation_txid        --> /api/v1/sense/parsed_dd_result_file_from_activation_ticket
/api/v1/sense/raw_output_file_by_pastel_id                 --> /api/v1/sense/raw_dd_result_file_from_pastel_id
/api/v1/sense/parsed_output_file_by_pastel_id              --> /api/v1/sense/parsed_dd_result_file_from_pastel_id
/api/v1/sense/pastel_ticket_by_media_file_hash             --> /api/v1/sense/pastel_registration_ticket_from_media_file_hash

NFT:

/api/v1/nft/raw_dd_result_file_by_registration_ticket      --> /api/v1/nft/raw_dd_result_file_from_registration_ticket
/api/v1/nft/parsed_dd_result_file_by_registration_ticket   --> /api/v1/nft/parsed_dd_result_file_from_registration_ticket
/api/v1/nft/raw_dd_result_file_by_activation_ticket        --> /api/v1/nft/raw_dd_result_file_from_activation_ticket
/api/v1/nft/parsed_dd_result_file_by_activation_txid       --> /api/v1/nft/parsed_dd_result_file_from_activation_ticket
/api/v1/nft/raw_dd_result_file_by_pastel_id                --> /api/v1/nft/raw_dd_result_file_from_pastel_id
/api/v1/nft/parsed_dd_result_file_by_pastel_id             --> /api/v1/nft/parsed_dd_result_file_from_pastel_id
/api/v1/nft/pastel_ticket_by_media_file_hash               --> /api/v1/nft/pastel_registration_ticket_from_media_file_hash

Setup

Install poetry

curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"

All following commands will assume thar project are in the directory /home/user/openapi

Install dependencies

cd $HOME/gateway-api/backend/app
poetry install

Set python module path

export PYTHONPATH=$PYTHONPATH:$HOME/gateway-api/backend/app

Copy and edit .env

cp .env.example .env

Gateway supports reading configuration from AWS Secret manager

AWS_SECRET_MANAGER_REGION="us-east-2"
AWS_SECRET_MANAGER_RDS_CREDENTIALS="evnet-gateway-api-db-credentials"
AWS_SECRET_MANAGER_RDS_PARAMETERS="gateway-api-db"
AWS_SECRET_MANAGER_SMTP_SECRETS="gateway-api-smtp"
AWS_SECRET_MANAGER_PASTEL_IDS="gateway-api-pastelids"

Where: AWS_SECRET_MANAGER_RDS_CREDENTIALS should contain: "username": "your_DB_username" "password": "your_DB_password"

AWS_SECRET_MANAGER_RDS_PARAMETERS should contain: "port": "your_DB_port", "host": "your_DB_host" "dbname": "your_DB_name"

AWS_SECRET_MANAGER_SMTP_SECRETS should contain: "password": "your_SMTP_password"

AWS_SECRET_MANAGER_PASTEL_IDS is where gateway will store pastel ids for each user

Start for local development

Start API Server

cd $HOME/gateway-api/backend/app
poetry run python app/main.py

Start celery beat (celery scheduler)

cd $HOME/gateway-api/backend/app
celery -A app.main.celery beat -l debug

Start celery workers (celery workers)

cd $HOME/gateway-api/backend/app
celery -A app.main.celery worker --loglevel=debug -Q cascade,sense,nft,registration_helpers,scheduled_tools

Start celery flower (celery monitoring web UI)

cd /home/user/openapi/backend/app
celery -A app.main.celery flower --port=5555

Or use shell scripts:

0-start-web-server.sh
1-start-celery-worker.sh
2-start-celery-registration-helpers.sh
3-start-celery-scheduled-tools.sh
4-start-celery-beat.sh
5-start-celery-flower.sh

Start for production

Best way is to use systemd service files. Example files are in systemd directory.

You would need minimum 2 hosts, one for API server and celery workers to register and process tasks, and another for account manager:

Host 1: API server and celery workers

  • systemd/psl-gateway-server.service
  • systemd/psl-gateway-workers.service
  • systemd/psl-gateway-registration-helpers.service
  • systemd/psl-gateway-scheduled-tools.service
  • systemd/psl-gateway-beat.service

Host 2: Account manager

  • systemd/psl-gateway-account-mananger.service
  • systemd/psl-gateway-beat.service

Config file (.env):

REGISTRATION_FINISHER_ENABLED=False
REGISTRATION_RE_PROCESSOR_ENABLED=False
FEE_PRE_BURNER_ENABLED=False
TICKET_ACTIVATOR_ENABLED=False
REG_TICKETS_FINDER_ENABLED=False
WATCHDOG_ENABLED=False
ACCOUNT_MANAGER_ENABLED=True

gateway-api's People

Contributors

a-ok123 avatar anthonygeorgiades avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.