From f094a74e66c38c5f8e689b701491e5da0ce0d833 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 21 Feb 2024 14:59:01 +0530 Subject: [PATCH] Handle port mappings while creating a deployment --- ...ocker-compose-watcher-mobymask-v3-demo.yml | 8 +++---- .../local/fund-accounts-on-l2.sh | 23 +++++++++++-------- .../mobymask-v3-demo/deploy/commands.py | 5 ++++ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/stack_orchestrator/data/compose/docker-compose-watcher-mobymask-v3-demo.yml b/stack_orchestrator/data/compose/docker-compose-watcher-mobymask-v3-demo.yml index c79de01e..738f02cb 100644 --- a/stack_orchestrator/data/compose/docker-compose-watcher-mobymask-v3-demo.yml +++ b/stack_orchestrator/data/compose/docker-compose-watcher-mobymask-v3-demo.yml @@ -69,9 +69,9 @@ services: - mobymask_deployment:/server # Expose GQL, metrics and relay node ports ports: - - "3001" + - "0.0.0.0:3001:3001" - "9001" - - "9090" + - "0.0.0.0:9090:9090" healthcheck: test: ["CMD", "busybox", "nc", "localhost", "9090"] interval: 20s @@ -107,7 +107,7 @@ services: ports: - "3001" - "9001" - - "9090" + - "0.0.0.0:9091:9090" healthcheck: test: ["CMD", "busybox", "nc", "localhost", "9090"] interval: 20s @@ -145,7 +145,7 @@ services: ports: - "3001" - "9001" - - "9090" + - "0.0.0.0:9092:9090" healthcheck: test: ["CMD", "busybox", "nc", "localhost", "9090"] interval: 20s diff --git a/stack_orchestrator/data/config/watcher-mobymask-v3-demo/local/fund-accounts-on-l2.sh b/stack_orchestrator/data/config/watcher-mobymask-v3-demo/local/fund-accounts-on-l2.sh index 920551ef..6635c93d 100755 --- a/stack_orchestrator/data/config/watcher-mobymask-v3-demo/local/fund-accounts-on-l2.sh +++ b/stack_orchestrator/data/config/watcher-mobymask-v3-demo/local/fund-accounts-on-l2.sh @@ -46,8 +46,8 @@ DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID" BRIDGE=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/L1StandardBridgeProxy.json | jq -r .address) # Send balance to bridge contract on L1 -cast send --rpc-url $CERC_L1_RPC --value 10000ether $BRIDGE --private-key $ACCOUNT_1_KEY -cast send --rpc-url $CERC_L1_RPC --value 10000ether $BRIDGE --private-key $ACCOUNT_2_KEY +cast send --rpc-url $CERC_L1_RPC --from $ACCOUNT_1 --value 10000ether $BRIDGE --private-key $ACCOUNT_1_KEY +cast send --rpc-url $CERC_L1_RPC --from $ACCOUNT_2 --value 10000ether $BRIDGE --private-key $ACCOUNT_2_KEY echo "Following accounts have been funded; use them for transactions on L2:" echo "${ACCOUNT_1}" @@ -56,14 +56,17 @@ echo "${ACCOUNT_2}" echo "*************************************" echo "Funding the watcher and app Nitro accounts on L2" -cast send --rpc-url $CERC_L1_RPC --value 200ether $WATCHER_1_ACCOUNT --private-key $ACCOUNT_1_KEY -cast send --rpc-url $CERC_L1_RPC --value 200ether $WATCHER_2_ACCOUNT --private-key $ACCOUNT_1_KEY -cast send --rpc-url $CERC_L1_RPC --value 200ether $WATCHER_3_ACCOUNT --private-key $ACCOUNT_1_KEY -cast send --rpc-url $CERC_L1_RPC --value 200ether $NITRO_APP_ACCOUNT --private-key $ACCOUNT_1_KEY +cast send --rpc-url $CERC_L1_RPC --from $ACCOUNT_1 --value 200ether $WATCHER_1_ACCOUNT --private-key $ACCOUNT_1_KEY +cast send --rpc-url $CERC_L1_RPC --from $ACCOUNT_1 --value 200ether $WATCHER_2_ACCOUNT --private-key $ACCOUNT_1_KEY +cast send --rpc-url $CERC_L1_RPC --from $ACCOUNT_1 --value 200ether $WATCHER_3_ACCOUNT --private-key $ACCOUNT_1_KEY +cast send --rpc-url $CERC_L1_RPC --from $ACCOUNT_1 --value 200ether $NITRO_APP_ACCOUNT --private-key $ACCOUNT_1_KEY -cast send --rpc-url $CERC_L1_RPC --value 100ether $BRIDGE --private-key $WATCHER_1_ACCOUNT_KEY -cast send --rpc-url $CERC_L1_RPC --value 100ether $BRIDGE --private-key $WATCHER_2_ACCOUNT_KEY -cast send --rpc-url $CERC_L1_RPC --value 100ether $BRIDGE --private-key $WATCHER_3_ACCOUNT_KEY -cast send --rpc-url $CERC_L1_RPC --value 100ether $BRIDGE --private-key $NITRO_APP_ACCOUNT_KEY +cast send --rpc-url $CERC_L1_RPC --from $WATCHER_1_ACCOUNT --value 100ether $BRIDGE --private-key $WATCHER_1_ACCOUNT_KEY +sleep 5 +cast send --rpc-url $CERC_L1_RPC --from $WATCHER_2_ACCOUNT --value 100ether $BRIDGE --private-key $WATCHER_2_ACCOUNT_KEY +sleep 5 +cast send --rpc-url $CERC_L1_RPC --from $WATCHER_3_ACCOUNT --value 100ether $BRIDGE --private-key $WATCHER_3_ACCOUNT_KEY +sleep 5 +cast send --rpc-url $CERC_L1_RPC --from $NITRO_APP_ACCOUNT --value 100ether $BRIDGE --private-key $NITRO_APP_ACCOUNT_KEY echo "Done, exiting." diff --git a/stack_orchestrator/data/stacks/mobymask-v3-demo/deploy/commands.py b/stack_orchestrator/data/stacks/mobymask-v3-demo/deploy/commands.py index a3c9b56f..72d198db 100644 --- a/stack_orchestrator/data/stacks/mobymask-v3-demo/deploy/commands.py +++ b/stack_orchestrator/data/stacks/mobymask-v3-demo/deploy/commands.py @@ -45,6 +45,11 @@ def create(context: DeploymentContext, extra_args): # update command to run the script yaml_data['services']['fixturenet-optimism-contracts']['command'] = '"./wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- ./deploy-contracts.sh && ./fund-accounts-on-l2.sh"' + # update port mapping for op-geth: 0.0.0.0:8545:8545 + existing_ports = yaml_data['services']['op-geth']['ports'] + new_ports = ["0.0.0.0:8545:8545" if "8545" in s else s for s in existing_ports] + yaml_data['services']['op-geth']['ports'] = new_ports + with open(fixturenet_optimism_compose_file, 'w') as yaml_file: yaml = YAML() yaml.dump(yaml_data, yaml_file)