From aabd1659957350a8738e3c0e7b4ed734b63ffd9e Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Wed, 12 Apr 2023 17:49:23 +0530 Subject: [PATCH] Fix mobymask-app deployment script --- .../watcher-mobymask-v2/mobymask-app-start.sh | 24 ++++++++++--------- .../watcher-mobymask-v2/test-app-start.sh | 2 +- app/data/stacks/mobymask-v2/README.md | 4 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/data/config/watcher-mobymask-v2/mobymask-app-start.sh b/app/data/config/watcher-mobymask-v2/mobymask-app-start.sh index 578d86f9..c494ed5c 100755 --- a/app/data/config/watcher-mobymask-v2/mobymask-app-start.sh +++ b/app/data/config/watcher-mobymask-v2/mobymask-app-start.sh @@ -19,20 +19,22 @@ echo "Using CERC_RELAY_NODES $CERC_RELAY_NODES" # Use config from mounted volume if available (when running web-app along with watcher stack) if [ -f /server/config.json ]; then - echo "Merging config for deployed contract from mounted volume" - # Merging config files to get deployed contract address - jq -s '.[0] * .[1]' /app/src/mobymask-app-config.json /server/config.json > /app/src/config.json -else - echo "Setting deployed contract details from env" + echo "Taking config for deployed contract from mounted volume" - # Set config values from environment variables - jq --arg address "$CERC_DEPLOYED_CONTRACT" \ - --argjson chainId "$CERC_CHAIN_ID" \ - --argjson relayNodes "$CERC_RELAY_NODES" \ - '.address = $address | .chainId = $chainId | .relayNodes = $relayNodes' \ - /app/src/mobymask-app-config.json > /app/src/config.json + # Get deployed contract address and chain id + CERC_DEPLOYED_CONTRACT=$(jq -r '.address' /server/config.json | tr -d '"') + CERC_CHAIN_ID=$(jq -r '.chainId' /server/config.json) +else + echo "Taking deployed contract details from env" fi +# Export config values in a json file +jq --arg address "$CERC_DEPLOYED_CONTRACT" \ + --argjson chainId "$CERC_CHAIN_ID" \ + --argjson relayNodes "$CERC_RELAY_NODES" \ + '.address = $address | .chainId = $chainId | .relayNodes = $relayNodes' \ + /app/src/mobymask-app-config.json > /app/src/config.json + REACT_APP_WATCHER_URI="$CERC_APP_WATCHER_URL/graphql" npm run build serve -s build diff --git a/app/data/config/watcher-mobymask-v2/test-app-start.sh b/app/data/config/watcher-mobymask-v2/test-app-start.sh index a7934934..ef7aa539 100755 --- a/app/data/config/watcher-mobymask-v2/test-app-start.sh +++ b/app/data/config/watcher-mobymask-v2/test-app-start.sh @@ -14,7 +14,7 @@ fi echo "Using CERC_RELAY_NODES $CERC_RELAY_NODES" -# Set relay nodes in config from CERC_RELAY_NODES environment variable +# Set relay nodes in config using CERC_RELAY_NODES jq --argjson relayNodes "$CERC_RELAY_NODES" \ '.relayNodes = $relayNodes' \ ./src/test-app-config.json > ./src/config.json diff --git a/app/data/stacks/mobymask-v2/README.md b/app/data/stacks/mobymask-v2/README.md index ab36f302..9dcca6c0 100644 --- a/app/data/stacks/mobymask-v2/README.md +++ b/app/data/stacks/mobymask-v2/README.md @@ -122,8 +122,8 @@ Clear volumes created by this stack: ```bash # List all relevant volumes -docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*mobymask_deployment|.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data" +docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*peers_ids|.*mobymask_deployment|.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data" # Remove all the listed volumes -docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*mobymask_deployment|.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data") +docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*peers_ids|.*mobymask_deployment|.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data") ```