Skip to content

Commit

Permalink
add gunicorn for backend api
Browse files Browse the repository at this point in the history
  • Loading branch information
kthf committed Jun 12, 2024
1 parent f12a4e8 commit 94adb5d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- ./docker/postgres/dev.env
ports:
- "5050:5050"
command: ["python", "-m", "app"]
command: ["gunicorn", "--bind", "0.0.0.0:5050", "app:app"]
networks:
- backend
tx_root_publisher:
Expand Down
1 change: 1 addition & 0 deletions services/backend_api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ web3==6.15.1
websockets==12.0
Werkzeug==3.0.1
yarl==1.9.4
gunicorn
6 changes: 3 additions & 3 deletions services/pg_tx_fetcher/src/app/lib/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from moralis import evm_api

# from app.cfg import PgTxFetcherConfig
from app.cfg import PgTxFetcherConfig


@dataclasses.dataclass
Expand Down Expand Up @@ -42,8 +42,8 @@ def fetch_batch(tx_from: str, chain_id: int, block_from: int, step: int = 1) ->
"to_block": block_from + step
}
result = evm_api.transaction.get_wallet_transactions(
api_key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJub25jZSI6ImE1ZTgzNGFhLWM1NGUtNDQ2Zi04Y2U1LTM0NDFkNGQ4YjAyMCIsIm9yZ0lkIjoiMzg4Mzg1IiwidXNlcklkIjoiMzk5MDg5IiwidHlwZUlkIjoiYzA1NDY3NjEtYTVkZi00OGUyLWE4OWUtMWNjM2Q0NjA2MTFhIiwidHlwZSI6IlBST0pFQ1QiLCJpYXQiOjE3MTMzNzE2MDUsImV4cCI6NDg2OTEzMTYwNX0.W9-i2c5ai8ukWMRtM9XHmK9Pbvd83kjB1bWokFvdZHw",
# api_key=PgTxFetcherConfig.MORALIS_API_KEY,
# api_key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJub25jZSI6ImE1ZTgzNGFhLWM1NGUtNDQ2Zi04Y2U1LTM0NDFkNGQ4YjAyMCIsIm9yZ0lkIjoiMzg4Mzg1IiwidXNlcklkIjoiMzk5MDg5IiwidHlwZUlkIjoiYzA1NDY3NjEtYTVkZi00OGUyLWE4OWUtMWNjM2Q0NjA2MTFhIiwidHlwZSI6IlBST0pFQ1QiLCJpYXQiOjE3MTMzNzE2MDUsImV4cCI6NDg2OTEzMTYwNX0.W9-i2c5ai8ukWMRtM9XHmK9Pbvd83kjB1bWokFvdZHw",
api_key=PgTxFetcherConfig.MORALIS_API_KEY,
params=params,
)['result']
return list(map(lambda x: MoralisNativeTransaction(**{
Expand Down
3 changes: 0 additions & 3 deletions services/pg_tx_fetcher/src/app/lib/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ def _get_connection() -> pg_conn:
return conn





_select_interaction_by_hash_sql: str = """
select interaction_hash, chain_id, selector, tx_to
from public.interaction
Expand Down
2 changes: 1 addition & 1 deletion services/tx_root_publisher/src/app/lib/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def push_new_merkle_root():
next_root_hash: bytes = _calc_new_merkle_root()
next_proof_hash: bytes = ...
InteractionDataset = _w3.eth.contract(address=ContractsRelayerConfig.INTERACTION_DATASET_ADDR,
abi=ContractsRelayerConfig.INTERACTION_DATASET_ABI["abi"])
abi=ContractsRelayerConfig.INTERACTION_DATASET_ABI["abi"])
unsigned_tx = InteractionDataset.functions.updateRoot(next_root_hash,
next_proof_hash)
_w3.eth.account.sign_transaction(unsigned_tx, private_key=ContractsRelayerConfig.RELAYER_PK)
Expand Down

0 comments on commit 94adb5d

Please sign in to comment.