Add code comments
This commit is contained in:
parent
a799f897ac
commit
e223db7599
@ -1,10 +1,13 @@
|
||||
version: '3.2'
|
||||
|
||||
services:
|
||||
# Builds and serves the mobymask react-app
|
||||
mobymask-app:
|
||||
image: cerc/mobymask-ui:local
|
||||
env_file:
|
||||
- ../config/watcher-mobymask-v2/mobymask-params.env
|
||||
# Waits for watcher server to be up before app build
|
||||
# Required when running with watcher stack to get deployed contract address
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
|
||||
@ -2,6 +2,7 @@ version: '3.2'
|
||||
|
||||
services:
|
||||
peer-test-app:
|
||||
# Builds and serves the peer-test react-app
|
||||
image: cerc/react-peer:local
|
||||
working_dir: /app/packages/test-app
|
||||
env_file:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
version: '3.2'
|
||||
|
||||
services:
|
||||
# Starts the postgres database for watcher
|
||||
mobymask-watcher-db:
|
||||
restart: unless-stopped
|
||||
image: postgres:14-alpine
|
||||
@ -21,6 +22,8 @@ services:
|
||||
retries: 15
|
||||
start_period: 10s
|
||||
|
||||
# Deploys mobymask contract and generates an invite link
|
||||
# Deployment is skipped if DEPLOYED_CONTRACT env is already set
|
||||
mobymask:
|
||||
image: cerc/mobymask:local
|
||||
working_dir: /app/packages/server
|
||||
@ -29,6 +32,7 @@ services:
|
||||
- ../config/watcher-mobymask-v2/mobymask-params.env
|
||||
environment:
|
||||
- ENV=PROD
|
||||
# Waits for L2 Optimism Geth and Node servers to be up before deploying contract
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
@ -45,6 +49,7 @@ services:
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# Starts the mobymask-v2-watcher server
|
||||
mobymask-watcher-server:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
@ -65,6 +70,7 @@ services:
|
||||
- ../config/watcher-mobymask-v2/start-server.sh:/app/packages/mobymask-v2-watcher/start-server.sh
|
||||
- mobymask_deployment:/server
|
||||
- fixturenet_geth_accounts:/geth-accounts:ro
|
||||
# Expose GQL, metrics and relay node ports
|
||||
ports:
|
||||
- "0.0.0.0:3001:3001"
|
||||
- "0.0.0.0:9001:9001"
|
||||
|
||||
@ -22,6 +22,7 @@ jq --arg rpcUrl "$L2_GETH_RPC" '.rpcUrl = $rpcUrl' secrets.json > secrets_update
|
||||
|
||||
export RPC_URL="${L2_GETH_RPC}"
|
||||
|
||||
# Check if DEPLOYED_CONTRACT environment variable set to skip contract deployment
|
||||
if [[ -n "$DEPLOYED_CONTRACT" ]]; then
|
||||
echo "DEPLOYED_CONTRACT is set to '$DEPLOYED_CONTRACT'"
|
||||
echo "Exiting without deploying contract"
|
||||
@ -46,7 +47,7 @@ if [ -f ./config.json ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Wait until balance for deployer account is reflected
|
||||
# Wait until balance for deployer account is updated
|
||||
cd ../hardhat
|
||||
while true; do
|
||||
ACCOUNT_BALANCE=$(yarn balance --network optimism "$PRIVATE_KEY_DEPLOYER" | grep ETH)
|
||||
|
||||
@ -4,6 +4,7 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# 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
|
||||
@ -11,6 +12,7 @@ if [ -f /server/config.json ]; then
|
||||
else
|
||||
echo "Setting deployed contract details from env"
|
||||
|
||||
# Set config values from environment variables
|
||||
jq --arg address "$DEPLOYED_CONTRACT" \
|
||||
--argjson chainId $CHAIN_ID \
|
||||
--argjson relayNodes "$RELAY_NODES" \
|
||||
|
||||
@ -7,5 +7,8 @@ APP_WATCHER_URL="http://localhost:3001"
|
||||
# mobymask-app will use this contract address in config if run separately
|
||||
DEPLOYED_CONTRACT=
|
||||
|
||||
# Chain ID is used by mobymask web-app for txs
|
||||
CHAIN_ID=42069
|
||||
|
||||
# Set relay nodes to be used by web-apps
|
||||
RELAY_NODES=["/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"]
|
||||
|
||||
@ -6,10 +6,11 @@ fi
|
||||
|
||||
echo "Using L2 RPC endpoint ${L2_GETH_RPC}"
|
||||
|
||||
# Use contract address from environment variable or set from config.json in mounted volume
|
||||
if [ -n "$DEPLOYED_CONTRACT" ]; then
|
||||
CONTRACT_ADDRESS="${DEPLOYED_CONTRACT}"
|
||||
else
|
||||
# Assign deployed contract address from server config
|
||||
# Assign deployed contract address from server config (created by mobymask container after deploying contract)
|
||||
CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"')
|
||||
fi
|
||||
|
||||
@ -21,16 +22,18 @@ else
|
||||
echo "Using PRIVATE_KEY_PEER from env"
|
||||
fi
|
||||
|
||||
# Set private key and contract address for watcher peer txs to L2 only if PRIVATE_KEY_PEER variable is set
|
||||
if [ -n "$PRIVATE_KEY_PEER" ]; then
|
||||
# Read in the original TOML file and modify it
|
||||
# Read in config template TOML file and modify it
|
||||
CONTENT=$(cat environments/watcher-config-template.toml)
|
||||
NEW_CONTENT=$(echo "$CONTENT" | sed -E "/\[metrics\]/i \\\n\n [server.p2p.peer.l2TxConfig]\n privateKey = \"${PRIVATE_KEY_PEER}\"\n contractAddress = \"${CONTRACT_ADDRESS}\"\n")
|
||||
|
||||
# Write the modified content to a new file
|
||||
# Write the modified content to a watcher config file
|
||||
echo "$NEW_CONTENT" > environments/local.toml
|
||||
|
||||
sed -i 's|REPLACE_WITH_L2_GETH_RPC_ENDPOINT|'"${L2_GETH_RPC}"'|' environments/local.toml
|
||||
else
|
||||
# Copy template config to watcher config without setting params for peer L2 txs
|
||||
cp environments/watcher-config-template.toml environments/local.toml
|
||||
fi
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
|
||||
# Set relay nodes in config from RELAY_NODES environment variable
|
||||
jq --argjson relayNodes "$RELAY_NODES" \
|
||||
'.relayNodes = $relayNodes' \
|
||||
./src/test-app-config.json > ./src/config.json
|
||||
|
||||
Loading…
Reference in New Issue
Block a user