Separate out watcher and web-apps in mobymask stack
This commit is contained in:
parent
59fe9aae59
commit
b05109259b
48
app/data/compose/docker-compose-mobymask-app.yml
Normal file
48
app/data/compose/docker-compose-mobymask-app.yml
Normal file
@ -0,0 +1,48 @@
|
||||
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"
|
||||
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
|
||||
ports:
|
||||
- "0.0.0.0:3002:3000"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "3000"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
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:
|
||||
21
app/data/compose/docker-compose-peer-test-app.yml
Normal file
21
app/data/compose/docker-compose-peer-test-app.yml
Normal file
@ -0,0 +1,21 @@
|
||||
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"
|
||||
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
|
||||
@ -76,48 +76,6 @@ services:
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# TODO: Move to a separate pod
|
||||
mobymask-app:
|
||||
depends_on:
|
||||
mobymask-watcher-server:
|
||||
condition: service_healthy
|
||||
mobymask:
|
||||
condition: service_completed_successfully
|
||||
image: cerc/mobymask-ui:local
|
||||
command: ["sh", "mobymask-app-start.sh"]
|
||||
volumes:
|
||||
- ../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
|
||||
- mobymask_deployment:/server
|
||||
ports:
|
||||
- "0.0.0.0:3002:3000"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "3000"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
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:
|
||||
mobymask_watcher_db_data:
|
||||
mobymask_deployment:
|
||||
|
||||
@ -21,6 +21,12 @@ jq --arg rpcUrl "$L2_GETH_URL" '.rpcUrl = $rpcUrl' secrets.json > secrets_update
|
||||
|
||||
export RPC_URL="${L2_GETH_URL}"
|
||||
|
||||
if [[ -n "$DEPLOYED_CONTRACT" ]]; then
|
||||
echo "DEPLOYED_CONTRACT is set to '$DEPLOYED_CONTRACT'"
|
||||
echo "Exiting without deploying contract"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check and exit if a deployment already exists (on restarts)
|
||||
if [ -f ./config.json ]; then
|
||||
echo "config.json already exists, checking the contract deployment"
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
{
|
||||
"name": "MobyMask",
|
||||
"relayNodes": [
|
||||
"/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"
|
||||
],
|
||||
|
||||
@ -4,9 +4,20 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# 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
|
||||
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"
|
||||
|
||||
npm run build
|
||||
jq --arg address "$DEPLOYED_CONTRACT" \
|
||||
--argjson chainId $CHAIN_ID \
|
||||
--argjson relayNodes "$RELAY_NODES" \
|
||||
'.address = $address | .chainId = $chainId | .relayNodes = $myArray' \
|
||||
/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
|
||||
|
||||
serve -s build
|
||||
|
||||
@ -1 +0,0 @@
|
||||
REACT_APP_WATCHER_URI=http://localhost:3001/graphql
|
||||
11
app/data/config/watcher-mobymask-v2/mobymask-params.env
Normal file
11
app/data/config/watcher-mobymask-v2/mobymask-params.env
Normal file
@ -0,0 +1,11 @@
|
||||
# Change if pointing web app to external watcher endpoint
|
||||
WATCHER_URL_SCHEME=http
|
||||
WATCHER_HOST=localhost
|
||||
WATCHER_PORT=3001
|
||||
|
||||
# Set deployed MobyMask contract address to avoid deploying contract in stack
|
||||
# mobymask-app will use this contract address in config if run separately
|
||||
DEPLOYED_CONTRACT=
|
||||
|
||||
CHAIN_ID=42069
|
||||
RELAY_NODES=["/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"]
|
||||
@ -27,3 +27,5 @@ pods:
|
||||
- fixturenet-eth
|
||||
- fixturenet-optimism
|
||||
- watcher-mobymask-v2
|
||||
- mobymask-app
|
||||
- peer-test-app
|
||||
|
||||
Loading…
Reference in New Issue
Block a user