Handle port mappings while creating a deployment

This commit is contained in:
Prathamesh Musale 2024-02-21 14:59:01 +05:30
parent d0d0602e88
commit f094a74e66
3 changed files with 22 additions and 14 deletions

View File

@ -69,9 +69,9 @@ services:
- mobymask_deployment:/server - mobymask_deployment:/server
# Expose GQL, metrics and relay node ports # Expose GQL, metrics and relay node ports
ports: ports:
- "3001" - "0.0.0.0:3001:3001"
- "9001" - "9001"
- "9090" - "0.0.0.0:9090:9090"
healthcheck: healthcheck:
test: ["CMD", "busybox", "nc", "localhost", "9090"] test: ["CMD", "busybox", "nc", "localhost", "9090"]
interval: 20s interval: 20s
@ -107,7 +107,7 @@ services:
ports: ports:
- "3001" - "3001"
- "9001" - "9001"
- "9090" - "0.0.0.0:9091:9090"
healthcheck: healthcheck:
test: ["CMD", "busybox", "nc", "localhost", "9090"] test: ["CMD", "busybox", "nc", "localhost", "9090"]
interval: 20s interval: 20s
@ -145,7 +145,7 @@ services:
ports: ports:
- "3001" - "3001"
- "9001" - "9001"
- "9090" - "0.0.0.0:9092:9090"
healthcheck: healthcheck:
test: ["CMD", "busybox", "nc", "localhost", "9090"] test: ["CMD", "busybox", "nc", "localhost", "9090"]
interval: 20s interval: 20s

View File

@ -46,8 +46,8 @@ DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
BRIDGE=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/L1StandardBridgeProxy.json | jq -r .address) BRIDGE=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/L1StandardBridgeProxy.json | jq -r .address)
# Send balance to bridge contract on L1 # 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 --from $ACCOUNT_1 --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_2 --value 10000ether $BRIDGE --private-key $ACCOUNT_2_KEY
echo "Following accounts have been funded; use them for transactions on L2:" echo "Following accounts have been funded; use them for transactions on L2:"
echo "${ACCOUNT_1}" echo "${ACCOUNT_1}"
@ -56,14 +56,17 @@ echo "${ACCOUNT_2}"
echo "*************************************" echo "*************************************"
echo "Funding the watcher and app Nitro accounts on L2" 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 --from $ACCOUNT_1 --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 --from $ACCOUNT_1 --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 --from $ACCOUNT_1 --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 $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 --from $WATCHER_1_ACCOUNT --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 sleep 5
cast send --rpc-url $CERC_L1_RPC --value 100ether $BRIDGE --private-key $WATCHER_3_ACCOUNT_KEY cast send --rpc-url $CERC_L1_RPC --from $WATCHER_2_ACCOUNT --value 100ether $BRIDGE --private-key $WATCHER_2_ACCOUNT_KEY
cast send --rpc-url $CERC_L1_RPC --value 100ether $BRIDGE --private-key $NITRO_APP_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." echo "Done, exiting."

View File

@ -45,6 +45,11 @@ def create(context: DeploymentContext, extra_args):
# update command to run the script # 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"' 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: with open(fixturenet_optimism_compose_file, 'w') as yaml_file:
yaml = YAML() yaml = YAML()
yaml.dump(yaml_data, yaml_file) yaml.dump(yaml_data, yaml_file)