Skip to content

Commit

Permalink
Fix: Update proxy block ingestor docker config
Browse files Browse the repository at this point in the history
Fix: Update proxy block ingestor docker config
  • Loading branch information
mmioana committed Dec 10, 2024
1 parent 77f2fc6 commit 8a58edc
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docker/colony-cdapp-dev-env-block-ingestor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM colony-cdapp-dev-env/base:latest

ENV BLOCK_INGESTOR_HASH=8d699331dba7a874b05e44cc2d7f6b74e497a22c
ENV BLOCK_INGESTOR_HASH=d5c077a352ee3ab75da70fb56666ba6c519237b1

# Declare volumes to set up metadata
VOLUME [ "/colonyCDapp/amplify/mock-data" ]
Expand Down
6 changes: 5 additions & 1 deletion docker/colony-cdapp-dev-env-orchestration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ services:
- /var/run/docker.sock:/var/run/docker.sock # Mount Docker socket
deploy:
replicas: 2
ports:
- '10002-10003'
depends_on:
network-contracts:
network-contracts-remote:
condition: service_healthy
network-contracts-remote-2:
condition: service_healthy
amplify:
condition: service_healthy
Expand Down
11 changes: 6 additions & 5 deletions docker/colony-cdapp-dev-env-proxy-block-ingestor
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
FROM colony-cdapp-dev-env/base:latest

# @TODO maybe add a PROXY_BLOCK_INGESTOR_HASH and fallback to BLOCK_INGESTOR_HASH
ENV BLOCK_INGESTOR_HASH=6a3e8fa3661f6ee328e45e6341cdd7cff2c012ec
ENV BLOCK_INGESTOR_HASH=d5c077a352ee3ab75da70fb56666ba6c519237b1
# @TODO do we need here a contract to be in the format:
# {
# name: 'ColonyNetwork',
# address: '0x777760996135F0791E2e1a74aFAa060711197777',
# path: 'colonyNetwork/ColonyNetwork.sol/ColonyNetwork.json',
# },
# also the RPC url needs to be different for each chain
ENV CONTRACT_ADDRESSES='["0x777760996135F0791E2e1a74aFAa060711197777", "0x777760996135F0791E2e1a74aFAa060711197778", "0x777760996135F0791E2e1a74aFAa060711197779"]'
ENV CONTRACT_ADDRESSES='["0x777760996135F0791E2e1a74aFAa060711197777", "0x777760996135F0791E2e1a74aFAa060711197778"]'
ENV CHAIN_RPC_ENDPOINTS='["http://network-contracts-remote:8545", "http://network-contracts-remote-2:8545"]'
ENV STATS_PORTS='["10002", "10003"]'

# Declare volumes to set up metadata
VOLUME [ "/colonyCDapp/amplify/mock-data" ]
Expand Down Expand Up @@ -47,14 +49,13 @@ RUN npm i -g [email protected]
RUN pnpm install --frozen-lockfile

# Compile JS files
# @TODO change to @joincolony/proxy-chain
RUN pnpm --filter @joincolony/main-chain run build
RUN pnpm --filter @joincolony/proxy-chain run build

WORKDIR /colonyCDappBackend

# Open up ports to the docker image
# Block Ingestor Stats
EXPOSE 10001
EXPOSE 10002 10003

# Make the run script executable
RUN chmod +x ./run.sh
Expand Down
5 changes: 2 additions & 3 deletions docker/files/proxy-block-ingestor/env.base
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
STATS_PORT=10001

VERBOSE_OUTPUT=false

CHAIN_RPC_ENDPOINT=http://network-contracts:8545
# This variable is used by the block ingestor, but for local dev it
# is automatically populated.
# CHAIN_NETWORK_CONTRACT=
# CHAIN_RPC_ENDPOINT=
# STATS_PORT=
AWS_APPSYNC_ENDPOINT=http://amplify:20002/graphql
AWS_APPSYNC_KEY=da2-fakeApiId123456

Expand Down
22 changes: 16 additions & 6 deletions docker/files/proxy-block-ingestor/run.sh.base
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,26 @@ fi
CONTRACT_ADDRESSES_ARRAY=($(echo "$CONTRACT_ADDRESSES" | jq -r '.[]'))
CONTRACT_ADDRESS=${CONTRACT_ADDRESSES_ARRAY[$INDEX]}

echo "Used Contract Address: $CONTRACT_ADDRESS"
echo "Used contract address: $CONTRACT_ADDRESS"

CHAIN_RPC_ENDPOINTS_ARRAY=($(echo "$CHAIN_RPC_ENDPOINTS" | jq -r '.[]'))
CHAIN_RPC_ENDPOINT=${CHAIN_RPC_ENDPOINTS_ARRAY[$INDEX]}

echo "Used chain RPC endpoint: $CHAIN_RPC_ENDPOINT"

STATS_PORTS_ARRAY=($(echo "$STATS_PORTS" | jq -r '.[]'))
STATS_PORT=${STATS_PORTS_ARRAY[$INDEX]}

echo "Used stats port: $STATS_PORT"

# Get etherrouter-address
wget http://network-files:3006/etherrouter-address.json

# Write to env file...
# @TODO change to apps/proxy-chain/.env
echo "CHAIN_NETWORK_CONTRACT=`jq -r .etherRouterAddress etherrouter-address.json`" >> apps/main-chain/.env
# @TODO change to apps/proxy-chain/.env
echo "CONTRACT_ADDRESS=\"$CONTRACT_ADDRESS\"" >> apps/main-chain/.env
echo "CHAIN_NETWORK_CONTRACT=`jq -r .etherRouterAddress etherrouter-address.json`" >> apps/proxy-chain/.env
echo "CONTRACT_ADDRESS=$CONTRACT_ADDRESS" >> apps/proxy-chain/.env
echo "CHAIN_RPC_ENDPOINT=$CHAIN_RPC_ENDPOINT" >> apps/proxy-chain/.env
echo "STATS_PORT=$STATS_PORT" >> apps/proxy-chain/.env

# @TODO change to @joincolony/proxy-chain
pnpm --filter @joincolony/main-chain run start
pnpm --filter @joincolony/proxy-chain run start

0 comments on commit 8a58edc

Please sign in to comment.