Skip to content

Commit

Permalink
add multideployer image
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawel Peregud committed Jan 26, 2024
1 parent c9242b8 commit 774445e
Show file tree
Hide file tree
Showing 13 changed files with 426 additions and 44 deletions.
9 changes: 9 additions & 0 deletions backend/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ def pytest_collection_modifyitems(config, items):
item.add_marker(skip_api)


def random_string() -> str:
import random
import string

length_of_string = 6
characters = string.ascii_letters + string.digits
return "".join(random.choices(characters, k=length_of_string))


@pytest.fixture
def flask_client() -> FlaskClient:
"""An application for the integration / API tests."""
Expand Down
30 changes: 11 additions & 19 deletions localenv/docker-apitest.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.8"
services:

anvil:
image: octant/anvil:latest
platform: linux/amd64
Expand All @@ -8,7 +9,6 @@ services:
networks:
- octant

#### SUBGRAPH
graph-node:
image: graphprotocol/graph-node:v0.26.0
platform: linux/amd64
Expand All @@ -33,6 +33,7 @@ services:
ipfs: 'ipfs:5001'
ethereum: localhost:http://anvil:8545
GRAPH_LOG: info

ipfs:
image: ipfs/go-ipfs:v0.10.0
platform: linux/amd64
Expand All @@ -57,16 +58,16 @@ services:
POSTGRES_PASSWORD: let-me-in
POSTGRES_DB: graph-node

contracts-deployer:
image: octant/contracts-deployer:latest
depends_on:
- anvil

multideployer:
image: octant/multideployer:latest
networks:
- octant
depends_on:
- anvil
- graph-node
ports:
- '8546:8546'
healthcheck:
test: ["CMD", "curl", "-f", "localhost:8546"]
- '8022:8022'
environment:
RPC_URL: http://anvil:8545
NETWORK: localhost
Expand All @@ -76,20 +77,11 @@ services:
PROPOSALS_CID: QmXq3Eaz5xQF51J7mWzxDmfrVjDuGdhnirthttJ9Q2WTF8
PROPOSALS_ADDRESSES: 0x13aB14d9f8a40a0a19f7c8Ba8B23a3F12D25fD12,0x50b641Fb1CC42bE8a292263c68f0612b8182dA51,0x519a0307b7364D21aB1227bf37689271233B3F93,0x5a873cB89BAd323b1acfd998C36aAc6b1a90a91d,0x608309bF063599DdaaF79409879917032377AC44,0x6d614D51D1Ed4eE97A37614F431771Fdb92D5Ae7,0x839a14166Af647F9DD5CdeA616c0354286Cc1593,0xBfD2704FEbD0d6A3f82Ed338731Fdf63077F76Fa,0xdE49c0928ECC3cfb5d07F69f5C82949168Fc6805,0xeAe7825257E71ba345FFcC54D0581ccE819738B9,0x13aB14d9f8a40a0a19f7c8Ba8B23a3F12D25fD12,0x50b641Fb1CC42bE8a292263c68f0612b8182dA51,0x519a0307b7364D21aB1227bf37689271233B3F93,0x5a873cB89BAd323b1acfd998C36aAc6b1a90a91d,0x608309bF063599DdaaF79409879917032377AC44,0x6d614D51D1Ed4eE97A37614F431771Fdb92D5Ae7,0x839a14166Af647F9DD5CdeA616c0354286Cc1593,0xBfD2704FEbD0d6A3f82Ed338731Fdf63077F76Fa,0xdE49c0928ECC3cfb5d07F69f5C82949168Fc6805,0xeAe7825257E71ba345FFcC54D0581ccE819738B9

subgraph-deployer:
image: octant/subgraph-deployer:latest
depends_on:
- contracts-deployer
- graph-node
networks:
- octant
environment:
LOCAL_CONTRACTS: true
CONTRACTS_DEPLOYER_URL: http://contracts-deployer:8546

NETWORK: localhost
IPFS_URL: http://ipfs:5001
SUBGRAPH_URL: http://graph-node:8020
SUBGRAPH_ADMIN_URL: http://graph-node:8020
SUBGRAPH_QUERY_URL: http://graph-node:8000

backend-postgres:
image: 'postgres:13'
Expand Down
16 changes: 16 additions & 0 deletions localenv/multideployer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM octant/contracts:latest as hardhat
FROM octant/subgraph:latest as graph

RUN apk add curl python3 bash

WORKDIR /app

RUN mkdir /hardhat/
COPY --from=hardhat /app/ /hardhat/

COPY --chmod=+x entrypoint.sh .
COPY --chmod=+x wait_for_subgraph.sh .
COPY --chmod=+x wait_for_graph_rpc.sh .
COPY server.py /app/server.py

ENTRYPOINT ["./entrypoint.sh"]
21 changes: 21 additions & 0 deletions localenv/multideployer/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env sh

set -ueo pipefail

export LOCAL_RPC_URL=${RPC_URL}
export PORT=${PORT:-8546}

wait_for_rpc(){
curl --retry-connrefused --retry 10 --retry-delay 1 \
-s -X POST "${RPC_URL}" \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'
}

echo ""
echo "waiting for anvil RPC..."
wait_for_rpc
echo ""
echo "anvil is ready!"

python3 /app/server.py
147 changes: 147 additions & 0 deletions localenv/multideployer/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions localenv/multideployer/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tool.poetry]
name = "multideployer"
version = "0.1.0"
description = ""
authors = ["Pawel Peregud <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"

[tool.poetry.group.dev.dependencies]
black = "^23.12.1"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Loading

0 comments on commit 774445e

Please sign in to comment.