diff --git a/deploy_rln_contract.sh b/deploy_rln_contract.sh new file mode 100644 index 0000000..bae4194 --- /dev/null +++ b/deploy_rln_contract.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +set -e + +# 1. Install foundry +curl -L https://foundry.paradigm.xyz | bash && . /root/.bashrc && foundryup && export PATH=$PATH:$HOME/.foundry/bin + +#. 2. Clone and build waku-rln-contract repo +git clone https://github.com/waku-org/waku-rln-contract.git +cd /waku-rln-contract +forge install && yarn install && yarn compile + +# 3. Create .env file with RPC_PROVIDER variable +echo "creating .env file with RPC_PROVIDER=$RPC_URL" +echo "RPC_PROVIDER=$RPC_URL" > .env + +# 3. Deploy the contracts +yarn deploy localhost_integration \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 0aff6a7..9d26ce3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,15 +16,32 @@ services: com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}' ports: - 127.0.0.1:8545:8545 - command: > - "anvil - --port=8545 - --host=0.0.0.0 - --chain-id=1337 - --block-time=12 - --accounts=1 - --allow-origin=* - --silent" + command: + - anvil + --port=8545 + --host=0.0.0.0 + --chain-id=1337 + --accounts=1 + --allow-origin=* + --block-time=12 + --silent + --config-out=anvil-config.txt + networks: + - simulation + + contract-repo-deployer: + image: node:hydrogen-bullseye + labels: + com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}' + environment: + - RPC_URL=${RPC_URL:-http://foundry:8545} + entrypoint: sh + command: + - '/opt/deploy_rln_contract.sh' + volumes: + - ./deploy_rln_contract.sh:/opt/deploy_rln_contract.sh + depends_on: + - foundry networks: - simulation @@ -41,7 +58,7 @@ services: - 127.0.0.1:8645:8645 entrypoint: sh command: - - '/opt/run_bootstrap.sh' + - '/opt/run_bootstrap.sh' volumes: - ./run_bootstrap.sh:/opt/run_bootstrap.sh:Z networks: @@ -56,7 +73,7 @@ services: replicas: ${NUM_NWAKU_NODES:-5} entrypoint: sh environment: - - RPC_URL=http://foundry:8545 + - RPC_URL=${RPC_URL:-http://foundry:8545} - PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 - RLN_CONTRACT_ADDRESS=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 - RLN_CREDENTIAL_PATH=/keystore.json @@ -67,7 +84,7 @@ services: - ./run_nwaku.sh:/opt/run_nwaku.sh:Z depends_on: - bootstrap - - foundry + - contract-repo-deployer networks: - simulation @@ -165,7 +182,7 @@ services: ports: - 127.0.0.1:8090:8090 environment: - - NODE_ENDPOINT=http://foundry:8545 + - NODE_ENDPOINT=${RPC_URL:-http://foundry:8545} - MONGO_CLIENT_URI=mongodb://mongodb:27017 - REINDEX_ENDPOINT=http://ingestion/reindex/ - MONGO_DB_NAME=epirus @@ -204,7 +221,7 @@ services: ingestion: image: web3labs/epirus-free-ingestion:latest environment: - - NODE_ENDPOINT=http://foundry:8545 + - NODE_ENDPOINT=${RPC_URL:-http://foundry:8545} - MONGO_CLIENT_URI=mongodb://mongodb:27017 - MONGO_DB_NAME=epirus - LIST_OF_METRICS_TO_CALCULATE_PER_MINUTE=hourly,daily,monthly,yearly diff --git a/wakusim.env b/wakusim.env index c404722..8a47baf 100644 --- a/wakusim.env +++ b/wakusim.env @@ -10,3 +10,5 @@ MSG_SIZE_KBYTES=10 TRAFFIC_DELAY_SECONDS=15 # Enable automatic Docker image updates. WATCHTOWER_ENABLED=true +# Anvil RPC Node external IP and port +RPC_URL=http://foundry:8545 \ No newline at end of file