PR to pull over pm-mobymask-v3-demo to upstream repo branch for testing #761

Merged
dboreham merged 14 commits from deep-stack/stack-orchestrator:pm-mobymask-v3-demo into dboreham/mobymask-v3-demo-test 2024-02-22 21:43:31 +00:00
2 changed files with 84 additions and 3 deletions
Showing only changes of commit 2659b87390 - Show all commits

View File

@ -41,7 +41,7 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
# Starts the MobyMask v3 watcher server
# Starts a MobyMask v3 watcher server #1
mobymask-watcher-1-server:
image: cerc/watcher-mobymask-v3:local
restart: unless-stopped
@ -81,6 +81,80 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
# Starts a MobyMask v3 watcher server #2
mobymask-watcher-2-server:
image: cerc/watcher-mobymask-v3:local
restart: unless-stopped
depends_on:
mobymask-watcher-1-server:
condition: service_healthy
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_WATCHER_INDEX: 2
CERC_ETH_RPC_QUERY_ENDPOINT: ${CERC_ETH_RPC_QUERY_ENDPOINT}
CERC_ETH_RPC_MUTATION_ENDPOINT: ${CERC_ETH_RPC_MUTATION_ENDPOINT}
CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL}
command: ["bash", "./start-server.sh"]
volumes:
- ../config/watcher-mobymask-v3-demo/watcher-config-template.toml:/app/environments/watcher-config-template.toml
- ../config/watcher-mobymask-v3-demo/watcher-config-rates.toml:/app/environments/rates.toml
- ../config/watcher-mobymask-v3-demo/local/keys:/app/keys
- ../config/watcher-mobymask-v3-demo/start-server.sh:/app/start-server.sh
- watcher_nitro_data:/app/out/nitro-db
- nitro_deployment:/nitro
- mobymask_deployment:/server
# Expose GQL, metrics and relay node ports
ports:
- "3001"
- "9001"
- "9090"
healthcheck:
test: ["CMD", "busybox", "nc", "localhost", "9090"]
interval: 20s
timeout: 5s
retries: 15
start_period: 5s
extra_hosts:
- "host.docker.internal:host-gateway"
# Starts a MobyMask v3 watcher server #3
mobymask-watcher-3-server:
image: cerc/watcher-mobymask-v3:local
restart: unless-stopped
depends_on:
mobymask-watcher-1-server:
condition: service_healthy
mobymask-watcher-2-server:
condition: service_healthy
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_WATCHER_INDEX: 3
CERC_ETH_RPC_QUERY_ENDPOINT: ${CERC_ETH_RPC_QUERY_ENDPOINT}
CERC_ETH_RPC_MUTATION_ENDPOINT: ${CERC_ETH_RPC_MUTATION_ENDPOINT}
CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL}
command: ["bash", "./start-server.sh"]
volumes:
- ../config/watcher-mobymask-v3-demo/watcher-config-template.toml:/app/environments/watcher-config-template.toml
- ../config/watcher-mobymask-v3-demo/watcher-config-rates.toml:/app/environments/rates.toml
- ../config/watcher-mobymask-v3-demo/local/keys:/app/keys
- ../config/watcher-mobymask-v3-demo/start-server.sh:/app/start-server.sh
- watcher_nitro_data:/app/out/nitro-db
- nitro_deployment:/nitro
- mobymask_deployment:/server
# Expose GQL, metrics and relay node ports
ports:
- "3001"
- "9001"
- "9090"
healthcheck:
test: ["CMD", "busybox", "nc", "localhost", "9090"]
interval: 20s
timeout: 5s
retries: 15
start_period: 5s
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
mobymask_watcher_db_data:
mobymask_deployment:

View File

@ -15,7 +15,7 @@ echo "Using Nitro chain URL ${CERC_NITRO_CHAIN_URL}"
WATCHER_DB="mobymask-watcher-${CERC_WATCHER_INDEX}"
# Use the docker container's host IP for relay multiaddr in peer config
CERC_RELAY_MULTIADDR="/dns4/mobymask-watcher-${CERC_WATCHER_INDEX}-server/tcp/9090/ws/p2p/$(jq -r '.relayPeerId.id' /app/keys/watcher-${CERC_WATCHER_INDEX}.json)"
CERC_RELAY_MULTIADDR="/dns4/mobymask-watcher-${CERC_WATCHER_INDEX}-server/tcp/9090/ws/p2p/$(jq -r '.relayPeerId.id' ${watcher_keys_dir}/watcher-${CERC_WATCHER_INDEX}.json)"
# Assign deployed contract address from server config (created by mobymask container after deploying contract)
CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"')
@ -85,8 +85,15 @@ watcher_parties_json=$(printf '%s\n' "${watcher_parties[@]}" | jq -s .)
echo "$watcher_parties_json" > "${WATCHER_PARTY_PEERS_FILE}"
echo "Watcher party peers exported to ${WATCHER_PARTY_PEERS_FILE}"
# TODO: Configure
# Configure relay peers for watcher 2 and 3
CERC_RELAY_PEERS=[]
if [ "${CERC_WATCHER_INDEX}" = "2" ]; then
# 2 -> 1
CERC_RELAY_PEERS="['/dns4/mobymask-watcher-1-server/tcp/9090/ws/p2p/$(jq -r '.relayPeerId.id' ${watcher_keys_dir}/watcher-1.json)']"
elif [ "${CERC_WATCHER_INDEX}" = "3" ]; then
# 3 -> 1, 2
CERC_RELAY_PEERS="['/dns4/mobymask-watcher-1-server/tcp/9090/ws/p2p/$(jq -r '.relayPeerId.id' ${watcher_keys_dir}/watcher-1.json)', '/dns4/mobymask-watcher-2-server/tcp/9090/ws/p2p/$(jq -r '.relayPeerId.id' ${watcher_keys_dir}/watcher-2.json)']"
fi
# Read in the config template TOML file and modify it
WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml)