Changes to run watcher and mobymask web-app separately

This commit is contained in:
nabarun 2023-04-05 20:25:29 +05:30
parent 24aff2189b
commit 284fb5d6ec
7 changed files with 33 additions and 39 deletions

View File

@ -2,20 +2,18 @@ version: '3.2'
services:
mobymask-app:
depends_on:
mobymask-watcher-server:
condition: service_healthy
mobymask:
condition: service_completed_successfully
image: cerc/mobymask-ui:local
command: |
"./wait-for-it.sh -h $${WATCHER_HOST} -p $${WATCHER_PORT} -s -t 60 -- ./mobymask-app-start.sh"
env_file:
- ../config/watcher-mobymask-v2/mobymask-params.env
command:
- sh
- -c
- ./wait-for-it.sh -h $${WATCHER_HOST} -p $${WATCHER_PORT} -s -t 60 -- ./mobymask-app-start.sh
volumes:
- ../config/wait-for-it.sh:/app/wait-for-it.sh
- ../config/watcher-mobymask-v2/mobymask-app.env:/app/.env
- ../config/watcher-mobymask-v2/mobymask-app-config.json:/app/src/mobymask-app-config.json
- ../config/watcher-mobymask-v2/mobymask-app-start.sh:/app/mobymask-app-start.sh
- moby_data_server:/server
- mobymask_deployment:/server
ports:
- "0.0.0.0:3002:3000"
healthcheck:
@ -26,23 +24,5 @@ services:
start_period: 10s
shm_size: '1GB'
peer-test-app:
depends_on:
mobymask-watcher-server:
condition: service_healthy
image: cerc/react-peer:local
working_dir: /app/packages/test-app
command: ["sh", "-c", "yarn build && serve -s build"]
volumes:
- ../config/watcher-mobymask-v2/test-app-config.json:/app/packages/test-app/src/config.json
ports:
- "0.0.0.0:3003:3000"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "3000"]
interval: 20s
timeout: 5s
retries: 15
start_period: 10s
volumes:
moby_data_server:
mobymask_deployment:

View File

@ -2,15 +2,14 @@ version: '3.2'
services:
peer-test-app:
depends_on:
mobymask-watcher-server:
condition: service_healthy
image: cerc/react-peer:local
working_dir: /app/packages/test-app
command: |
"./wait-for-it.sh -h $${WATCHER_HOST} -p $${WATCHER_PORT} -s -t 60 -- ./test-app-start.sh"
env_file:
- ../config/watcher-mobymask-v2/mobymask-params.env
command: ["sh", "./test-app-start.sh"]
volumes:
- ../config/watcher-mobymask-v2/test-app-config.json:/app/packages/test-app/src/config.json
- ../config/watcher-mobymask-v2/test-app-config.json:/app/packages/test-app/src/test-app-config.json
- ../config/watcher-mobymask-v2/test-app-start.sh:/app/packages/test-app/test-app-start.sh
ports:
- "0.0.0.0:3003:3000"
healthcheck:

View File

@ -14,10 +14,10 @@ else
jq --arg address "$DEPLOYED_CONTRACT" \
--argjson chainId $CHAIN_ID \
--argjson relayNodes "$RELAY_NODES" \
'.address = $address | .chainId = $chainId | .relayNodes = $myArray' \
'.address = $address | .chainId = $chainId | .relayNodes = $relayNodes' \
/app/src/mobymask-app-config.json > /app/src/config.json
fi
REACT_APP_WATCHER_URI="$WATCHER_URL_SCHEME://$WATCHER_HOST:$WATCHER_PORT/graphql" npm run build
REACT_APP_WATCHER_URI="$APP_WATCHER_URL/graphql" npm run build
serve -s build

View File

@ -1,7 +1,8 @@
# Change if pointing web app to external watcher endpoint
WATCHER_URL_SCHEME=http
WATCHER_HOST="mobymask-watcher-server"
WATCHER_HOST=localhost
WATCHER_PORT=3001
APP_WATCHER_URL="http://localhost:3001"
# Set deployed MobyMask contract address to avoid deploying contract in stack
# mobymask-app will use this contract address in config if run separately

View File

@ -0,0 +1,14 @@
#!/bin/sh
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
jq --argjson relayNodes "$RELAY_NODES" \
'.relayNodes = $relayNodes' \
./src/test-app-config.json > ./src/config.json
yarn build
serve -s build

View File

@ -1,6 +1,6 @@
FROM node:18.15.0-alpine3.16
RUN apk --update --no-cache add make git jq
RUN apk --update --no-cache add make git jq bash
WORKDIR /app

View File

@ -1,6 +1,6 @@
FROM node:18.15.0-alpine3.16
RUN apk --update --no-cache add make git python3
RUN apk --update --no-cache add make git python3 jq
WORKDIR /app