forked from cerc-io/stack-orchestrator
Compare commits
61
Commits
v1.0.36
...
publish-test
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6396e43c68 | ||
|
|
6cb7bbf1d0 | ||
|
|
acbadc83fc | ||
|
|
728bf653cc | ||
|
|
607b85f447 | ||
|
|
a5b5054af5 | ||
|
|
ce6ef81fe5 | ||
|
|
3cdad5b2d6 | ||
|
|
7bcad7b936 | ||
|
|
d72dcb6c74 | ||
|
|
1559330fd7 | ||
|
|
bb33cdffec | ||
|
|
79891b9128 | ||
|
|
75958adf82 | ||
|
|
1abde44a31 | ||
|
|
19eb67ed08 | ||
|
|
c69ce45190 | ||
|
|
b3732bc7a6 | ||
|
|
9cd3ac2567 | ||
|
|
0c1170e51c | ||
|
|
3b9fe60e59 | ||
|
|
6bd84e5b2f | ||
|
|
317608140f | ||
|
|
21d7a1ba61 | ||
|
|
17d5e37368 | ||
|
|
f90000d9cc | ||
|
|
bf85c61711 | ||
|
|
59afaf66ae | ||
|
|
18279fcef3 | ||
|
|
a8815924c6 | ||
|
|
fe77955845 | ||
|
|
8fb9e6d39b | ||
|
|
0d6bc81233 | ||
|
|
35d7649689 | ||
|
|
504ed542c3 | ||
|
|
6dad03c031 | ||
|
|
124a838ab5 | ||
|
|
b36f9bc974 | ||
|
|
4ae959eb4f | ||
|
|
af82c8c431 | ||
|
|
d2c85e6f1d | ||
|
|
53516f3109 | ||
|
|
5a27a94a7d | ||
|
|
4fa9d675ba | ||
|
|
dcc0f91140 | ||
|
|
e8139bd372 | ||
|
|
b915db426d | ||
|
|
69d215e8ec | ||
|
|
060ac520e4 | ||
|
|
484d80be5f | ||
|
|
792887a121 | ||
|
|
129d581141 | ||
|
|
44421049ae | ||
|
|
86f13e9c6b | ||
|
|
72737bfa29 | ||
|
|
63fbaa7ae3 | ||
|
|
464ef89a01 | ||
|
|
0c5f252465 | ||
|
|
b4d9a3a831 | ||
|
|
4da19b652e | ||
|
|
22bb1a0bfa |
@@ -0,0 +1,47 @@
|
|||||||
|
name: Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- publish-test
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: "Build and publish"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Clone project repository"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: "Get build info"
|
||||||
|
id: build-info
|
||||||
|
run: |
|
||||||
|
build_tag=$(./scripts/create_build_tag_file.sh)
|
||||||
|
echo "build-tag=v${build_tag}" >> $GITHUB_OUTPUT
|
||||||
|
- name: "Install Python"
|
||||||
|
uses: cerc-io/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.8'
|
||||||
|
- name: "Print Python version"
|
||||||
|
run: python3 --version
|
||||||
|
- name: "Install shiv"
|
||||||
|
run: pip install shiv
|
||||||
|
- name: "Build local shiv package"
|
||||||
|
id: build
|
||||||
|
run: |
|
||||||
|
./scripts/build_shiv_package.sh
|
||||||
|
result_code=$?
|
||||||
|
echo "package-file=$(ls ./package/*)" >> $GITHUB_OUTPUT
|
||||||
|
exit $result_code
|
||||||
|
- name: "Stage artifact file"
|
||||||
|
run: |
|
||||||
|
cp ${{ steps.build.outputs.package-file }} ./laconic-so
|
||||||
|
- name: "Create release"
|
||||||
|
uses: cerc-io/action-gh-release@gitea-v1
|
||||||
|
with:
|
||||||
|
tag_name: ${{ steps.build-info.outputs.build-tag }}
|
||||||
|
# On the publish test branch, mark our release as a draft
|
||||||
|
# Hack using endsWith to workaround Gitea sometimes sending "publish-test" vs "refs/heads/publish-test"
|
||||||
|
draft: ${{ endsWith('publish-test', github.ref ) }}
|
||||||
|
files: ./laconic-so
|
||||||
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: '*'
|
||||||
|
push:
|
||||||
|
branches: '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: "Run basic test suite"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Clone project repository"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: "Install Python"
|
||||||
|
uses: cerc-io/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.8'
|
||||||
|
- name: "Print Python version"
|
||||||
|
run: python3 --version
|
||||||
|
- name: "Install shiv"
|
||||||
|
run: pip install shiv
|
||||||
|
- name: "Build local shiv package"
|
||||||
|
run: ./scripts/build_shiv_package.sh
|
||||||
|
- name: "Run smoke tests"
|
||||||
|
run: ./tests/smoke-test/run-smoke-test.sh
|
||||||
@@ -6,6 +6,11 @@ Stack Orchestrator allows building and deployment of a Laconic Stack on a single
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
**To get started quickly** on a fresh Ubuntu instance (e.g, Digital Ocean); [try this script](./scripts/quick-install-ubuntu.sh). **WARNING:** always review scripts prior to running them so that you know what is happening on your machine.
|
||||||
|
|
||||||
|
For any other installation, follow along below and **adapt these instructions based on the specifics of your system.**
|
||||||
|
|
||||||
|
|
||||||
Ensure that the following are already installed:
|
Ensure that the following are already installed:
|
||||||
|
|
||||||
- [Python3](https://wiki.python.org/moin/BeginnersGuide/Download): `python3 --version` >= `3.8.10` (the Python3 shipped in Ubuntu 20+ is good to go)
|
- [Python3](https://wiki.python.org/moin/BeginnersGuide/Download): `python3 --version` >= `3.8.10` (the Python3 shipped in Ubuntu 20+ is good to go)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ services:
|
|||||||
"./wait-for-it.sh -h $${L1_HOST} -p $${L1_PORT} -s -t 60 -- ./run.sh"
|
"./wait-for-it.sh -h $${L1_HOST} -p $${L1_PORT} -s -t 60 -- ./run.sh"
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/wait-for-it.sh:/app/packages/contracts-bedrock/wait-for-it.sh
|
- ../config/wait-for-it.sh:/app/packages/contracts-bedrock/wait-for-it.sh
|
||||||
|
- ../container-build/cerc-optimism-contracts/hardhat-tasks/verify-contract-deployment.ts:/app/packages/contracts-bedrock/tasks/verify-contract-deployment.ts
|
||||||
- ../container-build/cerc-optimism-contracts/hardhat-tasks/rekey-json.ts:/app/packages/contracts-bedrock/tasks/rekey-json.ts
|
- ../container-build/cerc-optimism-contracts/hardhat-tasks/rekey-json.ts:/app/packages/contracts-bedrock/tasks/rekey-json.ts
|
||||||
- ../container-build/cerc-optimism-contracts/hardhat-tasks/send-balance.ts:/app/packages/contracts-bedrock/tasks/send-balance.ts
|
- ../container-build/cerc-optimism-contracts/hardhat-tasks/send-balance.ts:/app/packages/contracts-bedrock/tasks/send-balance.ts
|
||||||
- ../config/fixturenet-optimism/optimism-contracts/update-config.js:/app/packages/contracts-bedrock/update-config.js
|
- ../config/fixturenet-optimism/optimism-contracts/update-config.js:/app/packages/contracts-bedrock/update-config.js
|
||||||
@@ -24,7 +25,7 @@ services:
|
|||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
# Generates the config files required for L2 (outputs to volume op_node_data)
|
# Generates the config files required for L2 (outputs to volume l2_config)
|
||||||
op-node-l2-config-gen:
|
op-node-l2-config-gen:
|
||||||
image: cerc/optimism-op-node:local
|
image: cerc/optimism-op-node:local
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -35,12 +36,12 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ../config/fixturenet-optimism/generate-l2-config.sh:/app/generate-l2-config.sh
|
- ../config/fixturenet-optimism/generate-l2-config.sh:/app/generate-l2-config.sh
|
||||||
- l1_deployment:/contracts-bedrock:ro
|
- l1_deployment:/contracts-bedrock:ro
|
||||||
- op_node_data:/app
|
- l2_config:/app
|
||||||
command: ["sh", "/app/generate-l2-config.sh"]
|
command: ["sh", "/app/generate-l2-config.sh"]
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
# Initializes and runs the L2 execution client
|
# Initializes and runs the L2 execution client (outputs to volume l2_geth_data)
|
||||||
op-geth:
|
op-geth:
|
||||||
image: cerc/optimism-l2geth:local
|
image: cerc/optimism-l2geth:local
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -48,12 +49,13 @@ services:
|
|||||||
condition: service_started
|
condition: service_started
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/fixturenet-optimism/run-op-geth.sh:/run-op-geth.sh
|
- ../config/fixturenet-optimism/run-op-geth.sh:/run-op-geth.sh
|
||||||
- op_node_data:/op-node:ro
|
- l2_config:/op-node:ro
|
||||||
- l2_accounts:/l2-accounts:ro
|
- l2_accounts:/l2-accounts:ro
|
||||||
|
- l2_geth_data:/datadir
|
||||||
entrypoint: "sh"
|
entrypoint: "sh"
|
||||||
command: "/run-op-geth.sh"
|
command: "/run-op-geth.sh"
|
||||||
ports:
|
ports:
|
||||||
- "8545"
|
- "0.0.0.0:8545:8545"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "nc", "-vz", "localhost:8545"]
|
test: ["CMD", "nc", "-vz", "localhost:8545"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
@@ -71,11 +73,11 @@ services:
|
|||||||
image: cerc/optimism-op-node:local
|
image: cerc/optimism-op-node:local
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/fixturenet-optimism/run-op-node.sh:/app/run-op-node.sh
|
- ../config/fixturenet-optimism/run-op-node.sh:/app/run-op-node.sh
|
||||||
- op_node_data:/op-node-data:ro
|
- l2_config:/op-node-data:ro
|
||||||
- l2_accounts:/l2-accounts:ro
|
- l2_accounts:/l2-accounts:ro
|
||||||
command: ["sh", "/app/run-op-node.sh"]
|
command: ["sh", "/app/run-op-node.sh"]
|
||||||
ports:
|
ports:
|
||||||
- "8547"
|
- "0.0.0.0:8547:8547"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "nc", "-vz", "localhost:8547"]
|
test: ["CMD", "nc", "-vz", "localhost:8547"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
@@ -110,4 +112,5 @@ volumes:
|
|||||||
fixturenet_geth_accounts:
|
fixturenet_geth_accounts:
|
||||||
l1_deployment:
|
l1_deployment:
|
||||||
l2_accounts:
|
l2_accounts:
|
||||||
op_node_data:
|
l2_config:
|
||||||
|
l2_geth_data:
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
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
|
||||||
|
- ./wait-for-it.sh -h $${WATCHER_HOST} -p $${WATCHER_PORT} -s -t 0 -- ./mobymask-app-start.sh
|
||||||
|
volumes:
|
||||||
|
- ../config/wait-for-it.sh:/app/wait-for-it.sh
|
||||||
|
- ../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'
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mobymask_deployment:
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
version: "3.2"
|
|
||||||
|
|
||||||
services:
|
|
||||||
laconicd:
|
|
||||||
restart: unless-stopped
|
|
||||||
image: cerc/laconicd:local
|
|
||||||
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
|
||||||
volumes:
|
|
||||||
- ../config/fixturenet-laconicd/create-fixturenet.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
|
||||||
ports:
|
|
||||||
- "9473"
|
|
||||||
- "8545"
|
|
||||||
- "8546"
|
|
||||||
- "1317"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "nc", "-v", "localhost", "8545"]
|
|
||||||
interval: 20s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 15
|
|
||||||
start_period: 10s
|
|
||||||
|
|
||||||
networks:
|
|
||||||
# https://docs.docker.com/compose/networking/#configure-the-default-network
|
|
||||||
default:
|
|
||||||
name: mobymask-v2-network
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
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:
|
||||||
|
- ../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/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:
|
||||||
|
test: ["CMD", "nc", "-v", "localhost", "3000"]
|
||||||
|
interval: 20s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 15
|
||||||
|
start_period: 10s
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
version: '3.2'
|
version: '3.2'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
# Starts the PostgreSQL database for watcher
|
||||||
mobymask-watcher-db:
|
mobymask-watcher-db:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: postgres:14-alpine
|
image: postgres:14-alpine
|
||||||
@@ -21,53 +22,55 @@ services:
|
|||||||
retries: 15
|
retries: 15
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
|
||||||
|
# Deploys MobyMask contract and generates an invite link
|
||||||
|
# Deployment is skipped if DEPLOYED_CONTRACT env is already set
|
||||||
mobymask:
|
mobymask:
|
||||||
restart: unless-stopped
|
|
||||||
image: cerc/mobymask:local
|
image: cerc/mobymask:local
|
||||||
working_dir: /app/packages/server
|
working_dir: /app/packages/server
|
||||||
depends_on:
|
env_file:
|
||||||
op-node:
|
- ../config/watcher-mobymask-v2/optimism-params.env
|
||||||
condition: service_healthy
|
- ../config/watcher-mobymask-v2/mobymask-params.env
|
||||||
op-geth:
|
|
||||||
condition: service_healthy
|
|
||||||
# TODO: Configure env file for ETH RPC URL & private key
|
|
||||||
environment:
|
environment:
|
||||||
- ENV=PROD
|
- ENV=PROD
|
||||||
command: ["sh", "./deploy-and-generate-invite.sh"]
|
# Waits for L2 Optimism Geth and Node servers to be up before deploying contract
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
./wait-for-it.sh -h $${L2_GETH_HOST} -p $${L2_GETH_PORT} -s -t 0 && \
|
||||||
|
./wait-for-it.sh -h $${L2_NODE_HOST} -p $${L2_NODE_PORT} -s -t 0 && \
|
||||||
|
./deploy-and-generate-invite.sh
|
||||||
volumes:
|
volumes:
|
||||||
# TODO: add a script to set RPC endpoint from env
|
- ../config/wait-for-it.sh:/app/packages/server/wait-for-it.sh
|
||||||
# add manually if running seperately
|
|
||||||
- ../config/watcher-mobymask-v2/secrets-template.json:/app/packages/server/secrets-template.json
|
- ../config/watcher-mobymask-v2/secrets-template.json:/app/packages/server/secrets-template.json
|
||||||
- ../config/watcher-mobymask-v2/deploy-and-generate-invite.sh:/app/packages/server/deploy-and-generate-invite.sh
|
- ../config/watcher-mobymask-v2/deploy-and-generate-invite.sh:/app/packages/server/deploy-and-generate-invite.sh
|
||||||
- moby_data_server:/app/packages/server
|
- mobymask_deployment:/app/packages/server
|
||||||
- fixturenet_geth_accounts:/geth-accounts:ro
|
- fixturenet_geth_accounts:/geth-accounts:ro
|
||||||
healthcheck:
|
extra_hosts:
|
||||||
test: ["CMD", "nc", "-v", "localhost", "3330"]
|
- "host.docker.internal:host-gateway"
|
||||||
interval: 20s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 15
|
|
||||||
start_period: 10s
|
|
||||||
|
|
||||||
|
# Starts the mobymask-v2-watcher server
|
||||||
mobymask-watcher-server:
|
mobymask-watcher-server:
|
||||||
# TODO: pass optimism RPC endpoint
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
mobymask-watcher-db:
|
mobymask-watcher-db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
mobymask:
|
mobymask:
|
||||||
condition: service_healthy
|
condition: service_completed_successfully
|
||||||
image: cerc/watcher-mobymask-v2:local
|
image: cerc/watcher-mobymask-v2:local
|
||||||
command: ["sh", "server-start.sh"]
|
env_file:
|
||||||
|
- ../config/watcher-mobymask-v2/optimism-params.env
|
||||||
|
- ../config/watcher-mobymask-v2/mobymask-params.env
|
||||||
|
command: ["sh", "start-server.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
# TODO: add a script to set RPC endpoint from env
|
|
||||||
# add manually if running seperately
|
|
||||||
- ../config/watcher-mobymask-v2/watcher-config-template.toml:/app/packages/mobymask-v2-watcher/environments/watcher-config-template.toml
|
- ../config/watcher-mobymask-v2/watcher-config-template.toml:/app/packages/mobymask-v2-watcher/environments/watcher-config-template.toml
|
||||||
- ../config/watcher-mobymask-v2/peer.env:/app/packages/peer/.env
|
- ../config/watcher-mobymask-v2/peer.env:/app/packages/peer/.env
|
||||||
- ../config/watcher-mobymask-v2/relay-id.json:/app/packages/mobymask-v2-watcher/relay-id.json
|
- ../config/watcher-mobymask-v2/relay-id.json:/app/packages/mobymask-v2-watcher/relay-id.json
|
||||||
- ../config/watcher-mobymask-v2/peer-id.json:/app/packages/mobymask-v2-watcher/peer-id.json
|
- ../config/watcher-mobymask-v2/peer-id.json:/app/packages/mobymask-v2-watcher/peer-id.json
|
||||||
- ../config/watcher-mobymask-v2/server-start.sh:/app/packages/mobymask-v2-watcher/server-start.sh
|
- ../config/watcher-mobymask-v2/start-server.sh:/app/packages/mobymask-v2-watcher/start-server.sh
|
||||||
- moby_data_server:/server
|
- mobymask_deployment:/server
|
||||||
- fixturenet_geth_accounts:/geth-accounts:ro
|
- fixturenet_geth_accounts:/geth-accounts:ro
|
||||||
|
# Expose GQL, metrics and relay node ports
|
||||||
ports:
|
ports:
|
||||||
- "0.0.0.0:3001:3001"
|
- "0.0.0.0:3001:3001"
|
||||||
- "0.0.0.0:9001:9001"
|
- "0.0.0.0:9001:9001"
|
||||||
@@ -78,50 +81,10 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 15
|
retries: 15
|
||||||
start_period: 5s
|
start_period: 5s
|
||||||
|
extra_hosts:
|
||||||
# TODO: Move to a separate pod
|
- "host.docker.internal:host-gateway"
|
||||||
mobymask-app:
|
|
||||||
depends_on:
|
|
||||||
mobymask-watcher-server:
|
|
||||||
condition: service_healthy
|
|
||||||
mobymask:
|
|
||||||
condition: service_healthy
|
|
||||||
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
|
|
||||||
- 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:
|
volumes:
|
||||||
mobymask_watcher_db_data:
|
mobymask_watcher_db_data:
|
||||||
moby_data_server:
|
mobymask_deployment:
|
||||||
fixturenet_geth_accounts:
|
fixturenet_geth_accounts:
|
||||||
|
|||||||
@@ -4,6 +4,27 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check existing config if it exists
|
||||||
|
if [ -f /app/jwt.txt ] && [ -f /app/rollup.json ]; then
|
||||||
|
echo "Found existing L2 config, cross-checking with L1 deployment config"
|
||||||
|
|
||||||
|
SOURCE_L1_CONF=$(cat /contracts-bedrock/deploy-config/getting-started.json)
|
||||||
|
EXP_L1_BLOCKHASH=$(echo "$SOURCE_L1_CONF" | jq -r '.l1StartingBlockTag')
|
||||||
|
EXP_BATCHER=$(echo "$SOURCE_L1_CONF" | jq -r '.batchSenderAddress')
|
||||||
|
|
||||||
|
GEN_L2_CONF=$(cat /app/rollup.json)
|
||||||
|
GEN_L1_BLOCKHASH=$(echo "$GEN_L2_CONF" | jq -r '.genesis.l1.hash')
|
||||||
|
GEN_BATCHER=$(echo "$GEN_L2_CONF" | jq -r '.genesis.system_config.batcherAddr')
|
||||||
|
|
||||||
|
if [ "$EXP_L1_BLOCKHASH" = "$GEN_L1_BLOCKHASH" ] && [ "$EXP_BATCHER" = "$GEN_BATCHER" ]; then
|
||||||
|
echo "Config cross-checked, exiting"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Existing L2 config doesn't match the L1 deployment config, please clear L2 config volume before starting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
op-node genesis l2 \
|
op-node genesis l2 \
|
||||||
--deploy-config /contracts-bedrock/deploy-config/getting-started.json \
|
--deploy-config /contracts-bedrock/deploy-config/getting-started.json \
|
||||||
--deployment-dir /contracts-bedrock/deployments/getting-started/ \
|
--deployment-dir /contracts-bedrock/deployments/getting-started/ \
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
# Change if pointing to an external L1 endpoint
|
# Change if pointing to an external L1 endpoint
|
||||||
L1_RPC="http://fixturenet-eth-geth-1:8545"
|
|
||||||
|
# L1 endpoint
|
||||||
L1_CHAIN_ID=1212
|
L1_CHAIN_ID=1212
|
||||||
|
L1_RPC="http://fixturenet-eth-geth-1:8545"
|
||||||
L1_HOST="fixturenet-eth-geth-1"
|
L1_HOST="fixturenet-eth-geth-1"
|
||||||
L1_PORT=8545
|
L1_PORT=8545
|
||||||
|
|
||||||
|
# Credentials for accounts on L1 to send balance to Optimism Proxy contract from
|
||||||
|
# (enables them to do transactions on L2)
|
||||||
L1_ADDRESS=
|
L1_ADDRESS=
|
||||||
L1_PRIV_KEY=
|
L1_PRIV_KEY=
|
||||||
L1_ADDRESS_2=
|
L1_ADDRESS_2=
|
||||||
|
|||||||
@@ -4,22 +4,43 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO Support restarts; fixturenet-eth-geth currently starts fresh on a restart
|
|
||||||
# Exit if a deployment already exists (on restarts)
|
|
||||||
# if [ -d "deployments/getting-started" ]; then
|
|
||||||
# echo "Deployment directory deployments/getting-started already exists, exiting"
|
|
||||||
# exit 0
|
|
||||||
# fi
|
|
||||||
|
|
||||||
echo "Using L1 RPC endpoint ${L1_RPC}"
|
echo "Using L1 RPC endpoint ${L1_RPC}"
|
||||||
|
|
||||||
# Append tasks/index.ts file
|
IMPORT_1="import './verify-contract-deployment'"
|
||||||
echo "import './rekey-json'" >> tasks/index.ts
|
IMPORT_2="import './rekey-json'"
|
||||||
echo "import './send-balance'" >> tasks/index.ts
|
IMPORT_3="import './send-balance'"
|
||||||
|
|
||||||
|
# Append mounted tasks to tasks/index.ts file if not present
|
||||||
|
if ! grep -Fxq "$IMPORT_1" tasks/index.ts; then
|
||||||
|
echo "$IMPORT_1" >> tasks/index.ts
|
||||||
|
echo "$IMPORT_2" >> tasks/index.ts
|
||||||
|
echo "$IMPORT_3" >> tasks/index.ts
|
||||||
|
fi
|
||||||
|
|
||||||
# Update the chainId in the hardhat config
|
# Update the chainId in the hardhat config
|
||||||
sed -i "/getting-started/ {n; s/.*chainId.*/ chainId: $L1_CHAIN_ID,/}" hardhat.config.ts
|
sed -i "/getting-started/ {n; s/.*chainId.*/ chainId: $L1_CHAIN_ID,/}" hardhat.config.ts
|
||||||
|
|
||||||
|
# Exit if a deployment already exists (on restarts)
|
||||||
|
# Note: fixturenet-eth-geth currently starts fresh on a restart
|
||||||
|
if [ -d "deployments/getting-started" ]; then
|
||||||
|
echo "Deployment directory deployments/getting-started found, checking SystemDictator deployment"
|
||||||
|
|
||||||
|
# Read JSON file into variable
|
||||||
|
SYSTEM_DICTATOR_DETAILS=$(cat deployments/getting-started/SystemDictator.json)
|
||||||
|
|
||||||
|
# Parse JSON into variables
|
||||||
|
SYSTEM_DICTATOR_ADDRESS=$(echo "$SYSTEM_DICTATOR_DETAILS" | jq -r '.address')
|
||||||
|
SYSTEM_DICTATOR_TXHASH=$(echo "$SYSTEM_DICTATOR_DETAILS" | jq -r '.transactionHash')
|
||||||
|
|
||||||
|
if yarn hardhat verify-contract-deployment --contract "${SYSTEM_DICTATOR_ADDRESS}" --transaction-hash "${SYSTEM_DICTATOR_TXHASH}"; then
|
||||||
|
echo "Deployment verfication successful, exiting"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Deployment verfication failed, please clear L1 deployment volume before starting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Generate the L2 account addresses
|
# Generate the L2 account addresses
|
||||||
yarn hardhat rekey-json --output /l2-accounts/keys.json
|
yarn hardhat rekey-json --output /l2-accounts/keys.json
|
||||||
|
|
||||||
|
|||||||
@@ -4,34 +4,50 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir datadir
|
|
||||||
|
|
||||||
echo "pwd" > datadir/password
|
|
||||||
|
|
||||||
# TODO: Add in container build or use other tool
|
# TODO: Add in container build or use other tool
|
||||||
echo "installing jq"
|
echo "Installing jq"
|
||||||
apk update && apk add jq
|
apk update && apk add jq
|
||||||
|
|
||||||
# Get SEQUENCER KEY from keys.json
|
# Get SEQUENCER key from keys.json
|
||||||
SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')
|
SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||||
echo $SEQUENCER_KEY > datadir/block-signer-key
|
|
||||||
|
|
||||||
geth account import --datadir=datadir --password=datadir/password datadir/block-signer-key
|
# Initialize op-geth if datadir/geth not found
|
||||||
|
if [ -f /op-node/jwt.txt ] && [ -d datadir/geth ]; then
|
||||||
|
echo "Found existing datadir, checking block signer key"
|
||||||
|
|
||||||
while [ ! -f "/op-node/jwt.txt" ]
|
BLOCK_SIGNER_KEY=$(cat datadir/block-signer-key)
|
||||||
do
|
|
||||||
echo "Config files not created. Checking after 5 seconds."
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Config files created by op-node, proceeding with script..."
|
if [ "$SEQUENCER_KEY" = "$BLOCK_SIGNER_KEY" ]; then
|
||||||
|
echo "Sequencer and block signer keys match, skipping initialization"
|
||||||
|
else
|
||||||
|
echo "Sequencer and block signer keys don't match, please clear L2 geth data volume before starting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Initializing op-geth"
|
||||||
|
|
||||||
cp /op-node/genesis.json ./
|
mkdir -p datadir
|
||||||
geth init --datadir=datadir genesis.json
|
echo "pwd" > datadir/password
|
||||||
|
echo $SEQUENCER_KEY > datadir/block-signer-key
|
||||||
|
|
||||||
|
geth account import --datadir=datadir --password=datadir/password datadir/block-signer-key
|
||||||
|
|
||||||
|
while [ ! -f "/op-node/jwt.txt" ]
|
||||||
|
do
|
||||||
|
echo "Config files not created. Checking after 5 seconds."
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Config files created by op-node, proceeding with the initialization..."
|
||||||
|
|
||||||
|
geth init --datadir=datadir /op-node/genesis.json
|
||||||
|
echo "Node Initialized"
|
||||||
|
fi
|
||||||
|
|
||||||
SEQUENCER_ADDRESS=$(jq -r '.Sequencer.address' /l2-accounts/keys.json | tr -d '"')
|
SEQUENCER_ADDRESS=$(jq -r '.Sequencer.address' /l2-accounts/keys.json | tr -d '"')
|
||||||
echo "SEQUENCER_ADDRESS: ${SEQUENCER_ADDRESS}"
|
echo "SEQUENCER_ADDRESS: ${SEQUENCER_ADDRESS}"
|
||||||
cp /op-node/jwt.txt ./
|
|
||||||
|
# Run op-geth
|
||||||
geth \
|
geth \
|
||||||
--datadir ./datadir \
|
--datadir ./datadir \
|
||||||
--http \
|
--http \
|
||||||
@@ -52,7 +68,7 @@ geth \
|
|||||||
--authrpc.vhosts="*" \
|
--authrpc.vhosts="*" \
|
||||||
--authrpc.addr=0.0.0.0 \
|
--authrpc.addr=0.0.0.0 \
|
||||||
--authrpc.port=8551 \
|
--authrpc.port=8551 \
|
||||||
--authrpc.jwtsecret=./jwt.txt \
|
--authrpc.jwtsecret=/op-node/jwt.txt \
|
||||||
--rollup.disabletxpoolgossip=true \
|
--rollup.disabletxpoolgossip=true \
|
||||||
--password=./datadir/password \
|
--password=./datadir/password \
|
||||||
--allow-insecure-unlock \
|
--allow-insecure-unlock \
|
||||||
|
|||||||
Regular → Executable
+63
-5
@@ -1,11 +1,69 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
# Read the private key of L1 account to deploy contract
|
echo "Using L2 RPC endpoint ${L2_GETH_RPC}"
|
||||||
# TODO: Take from env if /geth-accounts volume doesn't exist to allow using separately running L1
|
|
||||||
L1_PRIV_KEY=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3)
|
if [ -f /geth-accounts/accounts.csv ]; then
|
||||||
|
echo "Using L1 private key from the mounted volume"
|
||||||
|
# Read the private key of L1 account to deploy contract
|
||||||
|
PRIVATE_KEY_DEPLOYER=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3)
|
||||||
|
else
|
||||||
|
echo "Using PRIVATE_KEY_DEPLOYER from env"
|
||||||
|
fi
|
||||||
|
|
||||||
# Set the private key
|
# Set the private key
|
||||||
jq --arg privateKey "$L1_PRIV_KEY" '.privateKey = ($privateKey)' secrets-template.json > secrets.json
|
jq --arg privateKey "$PRIVATE_KEY_DEPLOYER" '.privateKey = $privateKey' secrets-template.json > secrets.json
|
||||||
|
|
||||||
npm start
|
# Set the RPC URL
|
||||||
|
jq --arg rpcUrl "$L2_GETH_RPC" '.rpcUrl = $rpcUrl' secrets.json > secrets_updated.json && mv secrets_updated.json secrets.json
|
||||||
|
|
||||||
|
# Set the MobyMask app base URI
|
||||||
|
jq --arg baseURI "$MOBYMASK_APP_BASE_URI" '.baseURI = $baseURI' secrets.json > secrets_updated.json && mv secrets_updated.json secrets.json
|
||||||
|
|
||||||
|
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"
|
||||||
|
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"
|
||||||
|
|
||||||
|
# Read JSON file
|
||||||
|
DEPLOYMENT_DETAILS=$(cat config.json)
|
||||||
|
CONTRACT_ADDRESS=$(echo "$DEPLOYMENT_DETAILS" | jq -r '.address')
|
||||||
|
|
||||||
|
cd ../hardhat
|
||||||
|
if yarn verifyDeployment --network optimism --contract "${CONTRACT_ADDRESS}"; then
|
||||||
|
echo "Deployment verfication successful"
|
||||||
|
cd ../server
|
||||||
|
else
|
||||||
|
echo "Deployment verfication failed, please clear MobyMask deployment volume before starting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait until balance for deployer account is updated
|
||||||
|
cd ../hardhat
|
||||||
|
while true; do
|
||||||
|
ACCOUNT_BALANCE=$(yarn balance --network optimism "$PRIVATE_KEY_DEPLOYER" | grep ETH)
|
||||||
|
|
||||||
|
if [ "$ACCOUNT_BALANCE" != "0.0 ETH" ]; then
|
||||||
|
echo "Account balance updated: $ACCOUNT_BALANCE"
|
||||||
|
break # exit the loop
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Account balance not updated: $ACCOUNT_BALANCE"
|
||||||
|
echo "Checking after 2 seconds"
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
cd ../server
|
||||||
|
npm run deployAndGenerateInvite
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"name": "MobyMask",
|
||||||
"relayNodes": [
|
"relayNodes": [
|
||||||
"/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"
|
"/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,9 +1,25 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
# Merging config files to get deployed contract address
|
# Use config from mounted volume if available (when running web-app along with watcher stack)
|
||||||
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
|
# Set config values from environment variables
|
||||||
|
jq --arg address "$DEPLOYED_CONTRACT" \
|
||||||
|
--argjson chainId $CHAIN_ID \
|
||||||
|
--argjson relayNodes "$RELAY_NODES" \
|
||||||
|
'.address = $address | .chainId = $chainId | .relayNodes = $relayNodes' \
|
||||||
|
/app/src/mobymask-app-config.json > /app/src/config.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
REACT_APP_WATCHER_URI="$APP_WATCHER_URL/graphql" npm run build
|
||||||
|
|
||||||
serve -s build
|
serve -s build
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
REACT_APP_WATCHER_URI=http://localhost:3001/graphql
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Change if pointing web app to external watcher endpoint
|
||||||
|
WATCHER_HOST="mobymask-watcher-server"
|
||||||
|
WATCHER_PORT=3001
|
||||||
|
APP_WATCHER_URL="http://localhost:3001"
|
||||||
|
|
||||||
|
# Base URI for mobymask-app (used for generating invite)
|
||||||
|
MOBYMASK_APP_BASE_URI="http://127.0.0.1:3002/#"
|
||||||
|
|
||||||
|
# Set to false for disabling watcher peer to send txs to L2
|
||||||
|
ENABLE_PEER_L2_TXS=true
|
||||||
|
|
||||||
|
# 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 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"]
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Change if pointing to an external optimism geth endpoint
|
||||||
|
|
||||||
|
# L2 endpoints
|
||||||
|
L2_GETH_RPC="http://op-geth:8545"
|
||||||
|
L2_GETH_HOST="op-geth"
|
||||||
|
L2_GETH_PORT=8545
|
||||||
|
|
||||||
|
L2_NODE_HOST="op-node"
|
||||||
|
L2_NODE_PORT=8547
|
||||||
|
|
||||||
|
# Credentials for accounts to perform txs on L2
|
||||||
|
PRIVATE_KEY_DEPLOYER=
|
||||||
|
PRIVATE_KEY_PEER=
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"rpcUrl": "http://op-geth:8545",
|
"rpcUrl": "",
|
||||||
"privateKey": "",
|
"privateKey": "",
|
||||||
"baseURI": "http://127.0.0.1:3002/#"
|
"baseURI": ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Assign deployed contract address from server config
|
|
||||||
CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"')
|
|
||||||
L1_PRIV_KEY_2=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv)
|
|
||||||
|
|
||||||
sed "s/REPLACE_WITH_PRIVATE_KEY/${L1_PRIV_KEY_2}/" environments/watcher-config-template.toml > environments/local.toml
|
|
||||||
sed -i "s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/" environments/local.toml
|
|
||||||
|
|
||||||
echo 'yarn server'
|
|
||||||
yarn server
|
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
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 (created by mobymask container after deploying contract)
|
||||||
|
CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /geth-accounts/accounts.csv ]; then
|
||||||
|
echo "Using L1 private key from the mounted volume"
|
||||||
|
# Read the private key of L1 account for sending txs from peer
|
||||||
|
PRIVATE_KEY_PEER=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv)
|
||||||
|
else
|
||||||
|
echo "Using PRIVATE_KEY_PEER from env"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Read in the config template TOML file and modify it
|
||||||
|
WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml)
|
||||||
|
WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
|
||||||
|
sed -E "s/REPLACE_WITH_ENABLE_PEER_L2_TXS/${ENABLE_PEER_L2_TXS}/g; \
|
||||||
|
s/REPLACE_WITH_PRIVATE_KEY_PEER/${PRIVATE_KEY_PEER}/g; \
|
||||||
|
s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/g; \
|
||||||
|
s|REPLACE_WITH_L2_GETH_RPC_ENDPOINT|${L2_GETH_RPC}| ")
|
||||||
|
|
||||||
|
# Write the modified content to a new file
|
||||||
|
echo "$WATCHER_CONFIG" > environments/local.toml
|
||||||
|
|
||||||
|
echo 'yarn server'
|
||||||
|
yarn server
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
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
|
||||||
|
|
||||||
|
yarn build
|
||||||
|
|
||||||
|
serve -s build
|
||||||
@@ -35,9 +35,10 @@
|
|||||||
pubSubTopic = 'mobymask'
|
pubSubTopic = 'mobymask'
|
||||||
peerIdFile = './peer-id.json'
|
peerIdFile = './peer-id.json'
|
||||||
enableDebugInfo = true
|
enableDebugInfo = true
|
||||||
|
enableL2Txs = REPLACE_WITH_ENABLE_PEER_L2_TXS
|
||||||
|
|
||||||
[server.p2p.peer.l2TxConfig]
|
[server.p2p.peer.l2TxsConfig]
|
||||||
privateKey = 'REPLACE_WITH_PRIVATE_KEY'
|
privateKey = 'REPLACE_WITH_PRIVATE_KEY_PEER'
|
||||||
contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS'
|
contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS'
|
||||||
|
|
||||||
[metrics]
|
[metrics]
|
||||||
@@ -59,7 +60,7 @@
|
|||||||
[upstream]
|
[upstream]
|
||||||
[upstream.ethServer]
|
[upstream.ethServer]
|
||||||
gqlApiEndpoint = "http://ipld-eth-server:8083/graphql"
|
gqlApiEndpoint = "http://ipld-eth-server:8083/graphql"
|
||||||
rpcProviderEndpoint = "http://op-geth:8545"
|
rpcProviderEndpoint = "REPLACE_WITH_L2_GETH_RPC_ENDPOINT"
|
||||||
blockDelayInMilliSecs = 60000
|
blockDelayInMilliSecs = 60000
|
||||||
|
|
||||||
[upstream.cache]
|
[upstream.cache]
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ DEPS=(github.com/fare/gerbil-utils
|
|||||||
) ;
|
) ;
|
||||||
for i in ${DEPS[@]} ; do
|
for i in ${DEPS[@]} ; do
|
||||||
echo "Installing gerbil package: $i"
|
echo "Installing gerbil package: $i"
|
||||||
gxpkg install $i &&
|
gxpkg install $i
|
||||||
gxpkg build $i
|
gxpkg build $i
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
FROM node:18.15.0-alpine3.16
|
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
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
FROM node:16.17.1-alpine3.16
|
FROM node:16.17.1-alpine3.16
|
||||||
|
|
||||||
RUN apk --update --no-cache add python3 alpine-sdk jq
|
RUN apk --update --no-cache add python3 alpine-sdk jq bash
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
import { task } from 'hardhat/config'
|
||||||
|
import '@nomiclabs/hardhat-ethers'
|
||||||
|
|
||||||
|
task(
|
||||||
|
'verify-contract-deployment',
|
||||||
|
'Verifies the given contract deployment transaction'
|
||||||
|
)
|
||||||
|
.addParam('contract', 'Address of the contract deployed')
|
||||||
|
.addParam('transactionHash', 'Hash of the deployment transaction')
|
||||||
|
.setAction(async ({ contract, transactionHash }, { ethers }) => {
|
||||||
|
const provider = new ethers.providers.JsonRpcProvider(
|
||||||
|
`${process.env.L1_RPC}`
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the deployment tx receipt
|
||||||
|
const receipt = await provider.getTransactionReceipt(transactionHash)
|
||||||
|
if (
|
||||||
|
receipt &&
|
||||||
|
receipt.contractAddress &&
|
||||||
|
receipt.contractAddress === contract
|
||||||
|
) {
|
||||||
|
console.log(
|
||||||
|
`Deployment for contract ${contract} in transaction ${transactionHash} verified`
|
||||||
|
)
|
||||||
|
process.exit(0)
|
||||||
|
} else {
|
||||||
|
console.log(`Contract ${contract} deployment verification failed`)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
FROM node:18.15.0-alpine3.16
|
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
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ watcher-erc20
|
|||||||
watcher-erc721
|
watcher-erc721
|
||||||
watcher-uniswap-v3
|
watcher-uniswap-v3
|
||||||
watcher-mobymask-v2
|
watcher-mobymask-v2
|
||||||
mobymask-laconicd
|
mobymask-app
|
||||||
|
peer-test-app
|
||||||
test
|
test
|
||||||
eth-probe
|
eth-probe
|
||||||
keycloak
|
keycloak
|
||||||
|
|||||||
@@ -12,10 +12,9 @@ To use a user-supplied registry set these environment variables:
|
|||||||
Leave `CERC_NPM_REGISTRY_URL` un-set to use the local gitea registry.
|
Leave `CERC_NPM_REGISTRY_URL` un-set to use the local gitea registry.
|
||||||
|
|
||||||
### 1. Build support containers
|
### 1. Build support containers
|
||||||
```
|
|
||||||
$ laconic-so --stack build-support build-containers
|
Note: the scheme/gerbil container is excluded as it isn't currently required for the package registry.
|
||||||
```
|
|
||||||
Note that the scheme/gerbil builder container can take a while to build so if you aren't going to build scheme projects it can be skipped with:
|
|
||||||
```
|
```
|
||||||
$ laconic-so --stack build-support build-containers --exclude cerc/builder-gerbil
|
$ laconic-so --stack build-support build-containers --exclude cerc/builder-gerbil
|
||||||
```
|
```
|
||||||
@@ -23,6 +22,7 @@ $ laconic-so --stack build-support build-containers --exclude cerc/builder-gerbi
|
|||||||
|
|
||||||
```
|
```
|
||||||
$ laconic-so --stack package-registry setup-repositories
|
$ laconic-so --stack package-registry setup-repositories
|
||||||
|
$ laconic-so --stack package-registry build-containers
|
||||||
$ laconic-so --stack package-registry deploy up
|
$ laconic-so --stack package-registry deploy up
|
||||||
[+] Running 3/3
|
[+] Running 3/3
|
||||||
⠿ Network laconic-aecc4a21d3a502b14522db97d427e850_gitea Created 0.0s
|
⠿ Network laconic-aecc4a21d3a502b14522db97d427e850_gitea Created 0.0s
|
||||||
@@ -36,6 +36,9 @@ Gitea was configured to use host name: gitea.local, ensure that this resolves to
|
|||||||
Success, gitea is properly initialized
|
Success, gitea is properly initialized
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: the above commands can take several minutes depending on the specs of your machine.
|
||||||
|
|
||||||
### 3. Configure the hostname gitea.local
|
### 3. Configure the hostname gitea.local
|
||||||
How to do this is OS-dependent but usually involves editing a `hosts` file. For example on Linux add this line to the file `/etc/hosts` (needs sudo):
|
How to do this is OS-dependent but usually involves editing a `hosts` file. For example on Linux add this line to the file `/etc/hosts` (needs sudo):
|
||||||
```
|
```
|
||||||
@@ -55,5 +58,5 @@ Now npm packages can be built:
|
|||||||
Ensure that `CERC_NPM_AUTH_TOKEN` is set with the token printed above when the package-registry stack was deployed (the actual token value will be different than shown in this example):
|
Ensure that `CERC_NPM_AUTH_TOKEN` is set with the token printed above when the package-registry stack was deployed (the actual token value will be different than shown in this example):
|
||||||
```
|
```
|
||||||
$ export CERC_NPM_AUTH_TOKEN=84fe66a73698bf11edbdccd0a338236b7d1d5c45
|
$ export CERC_NPM_AUTH_TOKEN=84fe66a73698bf11edbdccd0a338236b7d1d5c45
|
||||||
$ laconic-so build-npms --include laconic-sdk
|
$ laconic-so build-npms --include laconic-sdk,laconic-registry-cli
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
Instructions to setup and deploy an end-to-end L1+L2 stack with [fixturenet-eth](../fixturenet-eth/) (L1) and [Optimism](https://stack.optimism.io) (L2)
|
Instructions to setup and deploy an end-to-end L1+L2 stack with [fixturenet-eth](../fixturenet-eth/) (L1) and [Optimism](https://stack.optimism.io) (L2)
|
||||||
|
|
||||||
|
We support running just the L2 part of stack, given an external L1 endpoint. Follow [l2-only](./l2-only.md) for the same.
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
Clone required repositories:
|
Clone required repositories:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack fixturenet-optimism setup-repositories
|
laconic-so --stack fixturenet-optimism setup-repositories
|
||||||
|
|
||||||
# Exclude cerc-io/go-ethereum repository if running L1 separately
|
|
||||||
laconic-so --stack fixturenet-optimism setup-repositories --exclude cerc-io/go-ethereum
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Checkout to the required versions and branches in repos:
|
Checkout to the required versions and branches in repos:
|
||||||
@@ -25,9 +24,6 @@ Build the container images:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack fixturenet-optimism build-containers
|
laconic-so --stack fixturenet-optimism build-containers
|
||||||
|
|
||||||
# Only build containers required for L2 if running L1 separately
|
|
||||||
laconic-so --stack fixturenet-optimism build-containers --include cerc/foundry,cerc/optimism-contracts,cerc/optimism-op-node,cerc/optimism-l2geth,cerc/optimism-op-batcher
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This should create the required docker images in the local image registry:
|
This should create the required docker images in the local image registry:
|
||||||
@@ -43,19 +39,10 @@ This should create the required docker images in the local image registry:
|
|||||||
|
|
||||||
## Deploy
|
## Deploy
|
||||||
|
|
||||||
(Optional) Update the [l1-params.env](../../config/fixturenet-optimism/l1-params.env) file with L1 endpoint (`L1_RPC`, `L1_HOST` and `L1_PORT`) and other params if running L1 separately
|
|
||||||
|
|
||||||
* NOTE:
|
|
||||||
* Stack Orchestrator needs to be run in [`dev`](/docs/CONTRIBUTING.md#install-developer-mode) mode to be able to edit the env file
|
|
||||||
* If L1 is running on the host machine, use `host.docker.internal` as the hostname to access the host port
|
|
||||||
|
|
||||||
Deploy the stack:
|
Deploy the stack:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack fixturenet-optimism deploy up
|
laconic-so --stack fixturenet-optimism deploy up
|
||||||
|
|
||||||
# Only start fixturenet-optimism pod (L2) if running L1 separately
|
|
||||||
laconic-so --stack fixturenet-optimism deploy up --include fixturenet-optimism
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The `fixturenet-optimism-contracts` service may take a while (`~15 mins`) to complete running as it:
|
The `fixturenet-optimism-contracts` service may take a while (`~15 mins`) to complete running as it:
|
||||||
@@ -81,24 +68,51 @@ Stop all services running in the background:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack fixturenet-optimism deploy down
|
laconic-so --stack fixturenet-optimism deploy down
|
||||||
|
|
||||||
# If only ran fixturenet-optimism pod (L2)
|
|
||||||
laconic-so --stack fixturenet-optimism deploy down --include fixturenet-optimism
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Clear volumes created by this stack:
|
Clear volumes created by this stack:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# List all relevant volumes
|
# List all relevant volumes
|
||||||
docker volume ls -q --filter name=laconic*
|
docker volume ls -q --filter "name=.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data"
|
||||||
|
|
||||||
# Remove all the listed volumes
|
# Remove all the listed volumes
|
||||||
docker volume rm $(docker volume ls -q --filter name=laconic*)
|
docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
* If `op-geth` service aborts or is restarted, the following error might occur in the `op-node` service:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
WARN [02-16|21:22:02.868] Derivation process temporary error attempts=14 err="stage 0 failed resetting: temp: failed to find the L2 Heads to start from: failed to fetch L2 block by hash 0x0000000000000000000000000000000000000000000000000000000000000000: failed to determine block-hash of hash 0x0000000000000000000000000000000000000000000000000000000000000000, could not get payload: not found"
|
||||||
|
```
|
||||||
|
|
||||||
|
* This means that the data directory that `op-geth` is using is corrupted and needs to be reinitialized; the containers `op-geth`, `op-node` and `op-batcher` need to be started afresh:
|
||||||
|
* Stop and remove the concerned containers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List the containers
|
||||||
|
docker ps -f "name=op-geth|op-node|op-batcher"
|
||||||
|
|
||||||
|
# Force stop and remove the listed containers
|
||||||
|
docker rm -f $(docker ps -qf "name=op-geth|op-node|op-batcher")
|
||||||
|
```
|
||||||
|
|
||||||
|
* Remove the concerned volume:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List the volume
|
||||||
|
docker volume ls -q --filter name=l2_geth_data
|
||||||
|
|
||||||
|
# Remove the listed volume
|
||||||
|
docker volume rm $(docker volume ls -q --filter name=l2_geth_data)
|
||||||
|
```
|
||||||
|
|
||||||
|
* Reuse the deployment command used in [Deploy](#deploy) to restart the stopped containers
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
* Currently not supported:
|
* `fixturenet-eth` currently starts fresh on a restart
|
||||||
* Stopping and restarting the stack from where it left off; currently starts fresh on a restart
|
* Resource requirements (memory + time) for building the `cerc/foundry` image are on the higher side
|
||||||
* Resource requirements (memory + time) for building `cerc/foundry` image are on the higher side
|
|
||||||
* `cerc/optimism-contracts` image is currently based on `cerc/foundry` (Optimism requires foundry installation)
|
* `cerc/optimism-contracts` image is currently based on `cerc/foundry` (Optimism requires foundry installation)
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
# fixturenet-optimism
|
||||||
|
|
||||||
|
Instructions to setup and deploy L2 fixturenet using [Optimism](https://stack.optimism.io)
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
Prerequisite: An L1 Ethereum RPC endpoint
|
||||||
|
|
||||||
|
Clone required repositories:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack fixturenet-optimism setup-repositories --exclude cerc-io/go-ethereum
|
||||||
|
```
|
||||||
|
|
||||||
|
Checkout to the required versions and branches in repos:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Optimism
|
||||||
|
cd ~/cerc/optimism
|
||||||
|
git checkout @eth-optimism/sdk@0.0.0-20230329025055
|
||||||
|
```
|
||||||
|
|
||||||
|
Build the container images:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack fixturenet-optimism build-containers --include cerc/foundry,cerc/optimism-contracts,cerc/optimism-op-node,cerc/optimism-l2geth,cerc/optimism-op-batcher
|
||||||
|
```
|
||||||
|
|
||||||
|
This should create the required docker images in the local image registry:
|
||||||
|
* `cerc/foundry`
|
||||||
|
* `cerc/optimism-contracts`
|
||||||
|
* `cerc/optimism-l2geth`
|
||||||
|
* `cerc/optimism-op-batcher`
|
||||||
|
* `cerc/optimism-op-node`
|
||||||
|
|
||||||
|
## Deploy
|
||||||
|
|
||||||
|
Update the [l1-params.env](../../config/fixturenet-optimism/l1-params.env) file with L1 endpoint (`L1_RPC`, `L1_HOST` and `L1_PORT`) and other params
|
||||||
|
|
||||||
|
* NOTE:
|
||||||
|
* Stack Orchestrator needs to be run in [`dev`](/docs/CONTRIBUTING.md#install-developer-mode) mode to be able to edit the env file
|
||||||
|
* If L1 is running on the host machine, use `host.docker.internal` as the hostname to access the host port
|
||||||
|
|
||||||
|
Deploy the stack:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack fixturenet-optimism deploy up --include fixturenet-optimism
|
||||||
|
```
|
||||||
|
|
||||||
|
The `fixturenet-optimism-contracts` service may take a while (`~15 mins`) to complete running as it:
|
||||||
|
1. waits for the 'Merge' to happen on L1
|
||||||
|
2. waits for a finalized block to exist on L1 (so that it can be taken as a starting block for roll ups)
|
||||||
|
3. deploys the L1 contracts
|
||||||
|
|
||||||
|
To list down and monitor the running containers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack fixturenet-optimism deploy --include fixturenet-optimism ps
|
||||||
|
|
||||||
|
# With status
|
||||||
|
docker ps
|
||||||
|
|
||||||
|
# Check logs for a container
|
||||||
|
docker logs -f <CONTAINER_ID>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Clean up
|
||||||
|
|
||||||
|
Stop all services running in the background:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack fixturenet-optimism deploy down --include fixturenet-optimism
|
||||||
|
```
|
||||||
|
|
||||||
|
Clear volumes created by this stack:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List all relevant volumes
|
||||||
|
docker volume ls -q --filter "name=.*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=.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
See [Troubleshooting](./README.md#troubleshooting)
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
# MobyMask v2 watcher
|
# MobyMask v2 watcher
|
||||||
|
|
||||||
Instructions to deploy MobyMask v2 watcher stack using [laconic-stack-orchestrator](/README.md#install)
|
Instructions to setup and deploy an end-to-end MobyMask v2 stack ([L1](../fixturenet-eth/) + [L2](../fixturenet-optimism/) chains + watcher) using [laconic-stack-orchestrator](/README.md#install)
|
||||||
|
|
||||||
|
We support running just the watcher part of stack, given an external L2 Optimism endpoint.
|
||||||
|
Follow [mobymask-only](./mobymask-only.md) for the same.
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
@@ -18,7 +21,7 @@ Checkout to the required versions and branches in repos
|
|||||||
```bash
|
```bash
|
||||||
# watcher-ts
|
# watcher-ts
|
||||||
cd ~/cerc/watcher-ts
|
cd ~/cerc/watcher-ts
|
||||||
git checkout v0.2.34
|
git checkout v0.2.35
|
||||||
|
|
||||||
# react-peer
|
# react-peer
|
||||||
cd ~/cerc/react-peer
|
cd ~/cerc/react-peer
|
||||||
@@ -30,7 +33,7 @@ git checkout laconic
|
|||||||
|
|
||||||
# MobyMask
|
# MobyMask
|
||||||
cd ~/cerc/MobyMask
|
cd ~/cerc/MobyMask
|
||||||
git checkout v0.1.1
|
git checkout v0.1.2
|
||||||
|
|
||||||
# Optimism
|
# Optimism
|
||||||
cd ~/cerc/optimism
|
cd ~/cerc/optimism
|
||||||
@@ -68,19 +71,9 @@ Deploy the stack:
|
|||||||
Find the watcher container's id and export it for later use:
|
Find the watcher container's id and export it for later use:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack mobymask-v2 deploy-system ps | grep "mobymask-watcher-server"
|
export CONTAINER_ID=$(docker ps -q --filter "name=mobymask-watcher-server")
|
||||||
|
|
||||||
export CONTAINER_ID=<CONTAINER_ID>
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Example output:
|
|
||||||
|
|
||||||
```
|
|
||||||
id: 5d3aae4b22039fcd1c9b18feeb91318ede1100581e75bb5ac54f9e436066b02c, name: laconic-bfb01caf98b1b8f7c8db4d33f11b905a-mobymask-watcher-server-1, ports: 0.0.0.0:3001->3001/tcp, 0.0.0.0:9001->9001/tcp, 0.0.0.0:9090->9090/tcp
|
|
||||||
```
|
|
||||||
|
|
||||||
In above output the container ID is `5d3aae4b22039fcd1c9b18feeb91318ede1100581e75bb5ac54f9e436066b02c`
|
|
||||||
|
|
||||||
Run the peer tests:
|
Run the peer tests:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -123,16 +116,12 @@ Stop all the services running in background run:
|
|||||||
laconic-so --stack mobymask-v2 deploy-system down
|
laconic-so --stack mobymask-v2 deploy-system down
|
||||||
```
|
```
|
||||||
|
|
||||||
Clear volumes:
|
Clear volumes created by this stack:
|
||||||
|
|
||||||
* List all relevant volumes:
|
```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"
|
||||||
|
|
||||||
```bash
|
# Remove all the listed volumes
|
||||||
docker volume ls -q --filter name=laconic*
|
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")
|
||||||
```
|
```
|
||||||
|
|
||||||
* Remove all the listed volumes:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker volume rm $(docker volume ls -q --filter name=laconic*)
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Get the root invite link URL for mobymask-app:
|
* Get the root invite link URL for mobymask-app:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack mobymask-v2 deploy-system logs mobymask
|
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
||||||
```
|
```
|
||||||
|
|
||||||
The invite link is seen at the end of the logs. Example log:
|
The invite link is seen at the end of the logs. Example log:
|
||||||
@@ -29,19 +29,11 @@
|
|||||||
|
|
||||||
* In the `MESSAGES` tab of other browsers, a message can be seen with the signed invocations.
|
* In the `MESSAGES` tab of other browsers, a message can be seen with the signed invocations.
|
||||||
|
|
||||||
* In a terminal check logs from the watcher peer container.
|
* In a terminal, check logs from the watcher peer container:
|
||||||
|
|
||||||
* Get the container id:
|
```bash
|
||||||
|
docker logs -f $(docker ps -aq --filter name="mobymask-watcher-server")
|
||||||
```bash
|
```
|
||||||
laconic-so --stack mobymask-v2 deploy-system ps | grep mobymask-watcher-server
|
|
||||||
```
|
|
||||||
|
|
||||||
* Check logs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker logs -f <CONTAINER_ID>
|
|
||||||
```
|
|
||||||
|
|
||||||
* It should have received the message, sent transaction to L2 chain and received a transaction receipt for an `invoke` message with block details.
|
* It should have received the message, sent transaction to L2 chain and received a transaction receipt for an `invoke` message with block details.
|
||||||
|
|
||||||
@@ -74,7 +66,7 @@
|
|||||||
* Get the deployed contract address:
|
* Get the deployed contract address:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack mobymask-v2 deploy-system exec mobymask-app "cat src/config.json"
|
docker exec -it $(docker ps -aq --filter name="mobymask-app") cat src/config.json
|
||||||
```
|
```
|
||||||
|
|
||||||
The value of `address` field is the deployed contract address
|
The value of `address` field is the deployed contract address
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
# MobyMask v2 watcher
|
||||||
|
|
||||||
|
Instructions to setup and deploy MobyMask v2 watcher independently
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
Prerequisite: L2 Optimism Geth and Node RPC endpoints
|
||||||
|
|
||||||
|
Clone required repositories:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack mobymask-v2 setup-repositories --include cerc-io/MobyMask,cerc-io/watcher-ts
|
||||||
|
```
|
||||||
|
|
||||||
|
Checkout to the required versions and branches in repos:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# watcher-ts
|
||||||
|
cd ~/cerc/watcher-ts
|
||||||
|
git checkout v0.2.35
|
||||||
|
|
||||||
|
# MobyMask
|
||||||
|
cd ~/cerc/MobyMask
|
||||||
|
git checkout v0.1.2
|
||||||
|
```
|
||||||
|
|
||||||
|
Build the container images:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack mobymask-v2 build-containers --include cerc/watcher-mobymask-v2,cerc/mobymask
|
||||||
|
```
|
||||||
|
|
||||||
|
This should create the required docker images in the local image registry
|
||||||
|
|
||||||
|
## Deploy
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
* In [mobymask-params.env](../../config/watcher-mobymask-v2/mobymask-params.env) file set `DEPLOYED_CONTRACT` to existing deployed mobymask contract address
|
||||||
|
* Setting `DEPLOYED_CONTRACT` will skip contract deployment when running stack
|
||||||
|
* `ENABLE_PEER_L2_TXS` is used to enable/disable sending txs to L2 chain from watcher peer.
|
||||||
|
* Update the [optimism-params.env](../../config/watcher-mobymask-v2/optimism-params.env) file with Optimism endpoints and other params for the Optimism running separately
|
||||||
|
* `PRIVATE_KEY_PEER` is used by watcher peer to send txs to L2 chain
|
||||||
|
* NOTE:
|
||||||
|
* Stack Orchestrator needs to be run in [`dev`](/docs/CONTRIBUTING.md#install-developer-mode) mode to be able to edit the env file
|
||||||
|
* If Optimism is running on the host machine, use `host.docker.internal` as the hostname to access the host port
|
||||||
|
|
||||||
|
### Deploy the stack
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 up
|
||||||
|
```
|
||||||
|
|
||||||
|
To list down and monitor the running containers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 ps
|
||||||
|
|
||||||
|
# With status
|
||||||
|
docker ps
|
||||||
|
|
||||||
|
# Check logs for a container
|
||||||
|
docker logs -f <CONTAINER_ID>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
See [Tests](./README.md#tests)
|
||||||
|
|
||||||
|
## Clean up
|
||||||
|
|
||||||
|
Stop all services running in the background:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 down
|
||||||
|
```
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
# Remove all the listed volumes
|
||||||
|
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*mobymask_deployment|.*fixturenet_geth_accounts")
|
||||||
|
```
|
||||||
@@ -27,3 +27,5 @@ pods:
|
|||||||
- fixturenet-eth
|
- fixturenet-eth
|
||||||
- fixturenet-optimism
|
- fixturenet-optimism
|
||||||
- watcher-mobymask-v2
|
- watcher-mobymask-v2
|
||||||
|
- mobymask-app
|
||||||
|
- peer-test-app
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
# Web Apps
|
||||||
|
|
||||||
|
Instructions to setup and deploy MobyMask and Peer Test web apps
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
Prerequisite: Watcher with GQL and relay node endpoints
|
||||||
|
|
||||||
|
Clone required repositories:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack mobymask-v2 setup-repositories --include cerc-io/react-peer,cerc-io/mobymask-ui
|
||||||
|
```
|
||||||
|
|
||||||
|
Checkout to the required versions and branches in repos:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# react-peer
|
||||||
|
cd ~/cerc/react-peer
|
||||||
|
git checkout v0.2.31
|
||||||
|
|
||||||
|
# mobymask-ui
|
||||||
|
cd ~/cerc/mobymask-ui
|
||||||
|
git checkout laconic
|
||||||
|
```
|
||||||
|
|
||||||
|
Build the container images:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack mobymask-v2 build-containers --include cerc/react-peer-v2,cerc/mobymask-ui
|
||||||
|
```
|
||||||
|
|
||||||
|
This should create the required docker images in the local image registry
|
||||||
|
|
||||||
|
## Deploy
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
* Update the [mobymask-params.env](../../config/watcher-mobymask-v2/mobymask-params.env) file with watcher endpoints and other params required by the web-apps
|
||||||
|
* `WATCHER_HOST` and `WATCHER_PORT` is used to check if watcher is up before building and deploying mobymask-app
|
||||||
|
* `APP_WATCHER_URL` is used by mobymask-app to make GQL queries
|
||||||
|
* `DEPLOYED_CONTRACT` and `CHAIN_ID` is used by mobymask-app in app config when creating messgaes for L2 txs
|
||||||
|
* `RELAY_NODES` is used by the web-apps to connect to the relay nodes (run in watcher)
|
||||||
|
* NOTE:
|
||||||
|
* Stack Orchestrator needs to be run in [`dev`](/docs/CONTRIBUTING.md#install-developer-mode) mode to be able to edit the env file
|
||||||
|
* If watcher is running on the host machine, use `host.docker.internal` as the hostname to access the host port
|
||||||
|
|
||||||
|
### Deploy the stack
|
||||||
|
|
||||||
|
For running mobymask-app
|
||||||
|
```bash
|
||||||
|
laconic-so --stack mobymask-v2 deploy --include mobymask-app up
|
||||||
|
```
|
||||||
|
|
||||||
|
For running peer-test-app
|
||||||
|
```bash
|
||||||
|
laconic-so --stack mobymask-v2 deploy --include peer-test-app up
|
||||||
|
```
|
||||||
|
|
||||||
|
To list down and monitor the running containers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker ps
|
||||||
|
|
||||||
|
# Check logs for a container
|
||||||
|
docker logs -f <CONTAINER_ID>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Clean up
|
||||||
|
|
||||||
|
Stop all services running in the background:
|
||||||
|
|
||||||
|
For mobymask-app
|
||||||
|
```bash
|
||||||
|
laconic-so --stack mobymask-v2 deploy --include mobymask-app down
|
||||||
|
```
|
||||||
|
|
||||||
|
For peer-test-app
|
||||||
|
```bash
|
||||||
|
laconic-so --stack mobymask-v2 deploy --include peer-test-app down
|
||||||
|
```
|
||||||
|
|
||||||
|
Clear volumes created by this stack:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List all relevant volumes
|
||||||
|
docker volume ls -q --filter "name=.*mobymask_deployment"
|
||||||
|
|
||||||
|
# Remove all the listed volumes
|
||||||
|
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_deployment")
|
||||||
|
```
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
# This file should be re-generated running: scripts/update-version-file.sh script
|
# Manually updated product release version
|
||||||
v1.0.35-df23476
|
1.1.0
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ def command(ctx):
|
|||||||
|
|
||||||
# See: https://stackoverflow.com/a/20885799/1701505
|
# See: https://stackoverflow.com/a/20885799/1701505
|
||||||
from . import data
|
from . import data
|
||||||
with importlib.resources.open_text(data, "version.txt") as version_file:
|
with importlib.resources.open_text(data, "build_tag.txt") as version_file:
|
||||||
# TODO: code better version that skips comment lines
|
# TODO: code better version that skips comment lines
|
||||||
version_string = version_file.read().splitlines()[1]
|
version_string = version_file.read().splitlines()[1]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Builds the shiv "package" for distribution
|
# Builds the shiv "package" for distribution
|
||||||
mkdir -p ./package
|
mkdir -p ./package
|
||||||
version_string=$( ./scripts/update_version_file.sh)
|
version_string=$( ./app/data/version.txt )
|
||||||
shiv -c laconic-so -o package/laconic-so-${version_string} .
|
shiv -c laconic-so -o package/laconic-so-${version_string} .
|
||||||
|
|||||||
Executable
+8
@@ -0,0 +1,8 @@
|
|||||||
|
build_tag_file_name=./app/data/build_tag.txt
|
||||||
|
echo "# This file should be re-generated running: scripts/create_build_tag_file.sh script" > $build_tag_file_name
|
||||||
|
product_version_string=$( tail -1 ./app/data/version.txt )
|
||||||
|
commit_string=$( git rev-parse --short HEAD )
|
||||||
|
timestamp_string=$(date +'%Y%m%d%H%M')
|
||||||
|
build_tag_string=${product_version_string}-${commit_string}-${timestamp_string}
|
||||||
|
echo ${build_tag_string} >> $build_tag_file_name
|
||||||
|
echo ${build_tag_string}
|
||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Script to automate the steps needed to make a cloned project repo runnable on the path
|
||||||
|
# (beware of PATH having some other file with the same name ahead of ours)
|
||||||
|
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
||||||
|
set -x
|
||||||
|
echo PATH is $PATH
|
||||||
|
fi
|
||||||
|
python3 -m venv venv
|
||||||
|
source ./venv/bin/activate
|
||||||
|
pip install --editable .
|
||||||
|
pip install shiv
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
python3 -m venv venv
|
|
||||||
source ./venv/bin/activate
|
|
||||||
pip install --editable .
|
|
||||||
pip install shiv
|
|
||||||
shiv -c laconic-so -o laconic-so .
|
|
||||||
./laconic-so --verbose --local-stack setup-repositories
|
|
||||||
Executable
+118
@@ -0,0 +1,118 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
install_dir=~/bin
|
||||||
|
|
||||||
|
# First display a reasonable warning to the user unless run with -y
|
||||||
|
if ! [[ $# -eq 1 && $1 == "-y" ]]; then
|
||||||
|
echo "**************************************************************************************"
|
||||||
|
echo "This script requires sudo privilege. It installs Laconic Stack Orchestrator"
|
||||||
|
echo "into: ${install_dir}. It also *removes* any existing docker installed on"
|
||||||
|
echo "this machine and then installs the latest docker release as well as other"
|
||||||
|
echo "required packages."
|
||||||
|
echo "Only proceed if you are sure you want to make those changes to this machine."
|
||||||
|
echo "**************************************************************************************"
|
||||||
|
read -p "Are you sure you want to proceed? " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This script assumes root permissions on a fresh Ubuntu Digital Ocean droplet
|
||||||
|
# with these recommended specs: 16 GB Memory / 8 Intel vCPUs / 320 GB Disk
|
||||||
|
|
||||||
|
# TODO:
|
||||||
|
# Check python3 is available
|
||||||
|
# Check machine resources are sufficient
|
||||||
|
|
||||||
|
# dismiss the popups
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
## https://docs.docker.com/engine/install/ubuntu/
|
||||||
|
## https://superuser.com/questions/518859/ignore-packages-that-are-not-currently-installed-when-using-apt-get-remove1
|
||||||
|
packages_to_remove="docker docker-engine docker.io containerd runc"
|
||||||
|
installed_packages_to_remove=""
|
||||||
|
for package_to_remove in $(echo $packages_to_remove); do
|
||||||
|
$(dpkg --info $package_to_remove &> /dev/null)
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
installed_packages_to_remove="$installed_packages_to_remove $package_to_remove"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Enable stop on error now, since we needed it off for the code above
|
||||||
|
set -euo pipefail ## https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
|
||||||
|
|
||||||
|
if [[ -n "${installed_packages_to_remove}" ]]; then
|
||||||
|
echo "**************************************************************************************"
|
||||||
|
echo "Removing existing docker packages"
|
||||||
|
sudo apt -y remove $installed_packages_to_remove
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "**************************************************************************************"
|
||||||
|
echo "Installing dependencies"
|
||||||
|
sudo apt -y update
|
||||||
|
|
||||||
|
# laconic-so depends on jq
|
||||||
|
sudo apt -y install jq
|
||||||
|
# laconic-so depends on git
|
||||||
|
sudo apt -y install git
|
||||||
|
# curl used below
|
||||||
|
sudo apt -y install jq
|
||||||
|
# docker repo add depends on gnupg and updated ca-certificates
|
||||||
|
sudo apt -y install ca-certificates gnupg
|
||||||
|
|
||||||
|
# Add dockerco package repository
|
||||||
|
sudo mkdir -m 0755 -p /etc/apt/keyrings
|
||||||
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||||
|
echo \
|
||||||
|
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
|
||||||
|
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
|
||||||
|
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
|
||||||
|
# Penny in the update jar
|
||||||
|
sudo apt -y update
|
||||||
|
|
||||||
|
echo "**************************************************************************************"
|
||||||
|
echo "Installing docker"
|
||||||
|
sudo apt -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
|
||||||
|
# Allow the current user to use Docker
|
||||||
|
sudo usermod -aG docker $USER
|
||||||
|
|
||||||
|
echo "**************************************************************************************"
|
||||||
|
echo "Installing laconic-so"
|
||||||
|
# install latest `laconic-so`
|
||||||
|
install_filename=${install_dir}/laconic-so
|
||||||
|
mkdir -p ${install_dir}
|
||||||
|
curl -L -o ${install_filename} https://github.com/cerc-io/stack-orchestrator/releases/latest/download/laconic-so
|
||||||
|
chmod +x ${install_filename}
|
||||||
|
|
||||||
|
echo "**************************************************************************************"
|
||||||
|
# Check if our PATH line is already there
|
||||||
|
path_add_command="export PATH=\$PATH:${install_dir}"
|
||||||
|
if ! grep -q "${path_add_command}" ~/.profile
|
||||||
|
then
|
||||||
|
echo "Adding this line to the end of ~/.profile:"
|
||||||
|
echo ${path_add_command}
|
||||||
|
echo ${path_add_command} >> ~/.profile
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "**************************************************************************************"
|
||||||
|
# PATH set here for commands run in this script
|
||||||
|
export PATH=$PATH:${install_dir}
|
||||||
|
echo Installed laconic-so version: $(laconic-so version)
|
||||||
|
|
||||||
|
echo "**************************************************************************************"
|
||||||
|
echo "The Laconic Stack Orchestrator program laconic-so has been installed at ${install_filename}"
|
||||||
|
echo "The directory ${install_dir} has been added to PATH in *new* shells via ~/.profile"
|
||||||
|
echo "**************************************************************************************"
|
||||||
|
# Message the user to check docker is working for them
|
||||||
|
echo "Please log in again (docker will not work in this current shell) then:"
|
||||||
|
echo "test that docker is correctly installed and working for your user by running the"
|
||||||
|
echo "command below (it should print a message beginning \"Hello from Docker!\"):"
|
||||||
|
echo
|
||||||
|
echo "docker run hello-world"
|
||||||
|
echo
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
version_file_name=./app/data/version.txt
|
|
||||||
echo "# This file should be re-generated running: scripts/update-version-file.sh script" > $version_file_name
|
|
||||||
tag_string=$( git describe --tags --abbrev=0 )
|
|
||||||
commit_string=$( git rev-parse --short HEAD )
|
|
||||||
version_string=${tag_string}-${commit_string}
|
|
||||||
echo ${version_string} >> $version_file_name
|
|
||||||
echo ${version_string}
|
|
||||||
Reference in New Issue
Block a user