Archived
Compare commits
96
Commits
v1.0.34
...
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 | ||
|
|
be08ee81ea | ||
|
|
22bb1a0bfa | ||
|
|
287468b7c0 | ||
|
|
f23c22d5b9 | ||
|
|
1881554ae0 | ||
|
|
21d6e33dab | ||
|
|
009ce95914 | ||
|
|
f7bb8f2735 | ||
|
|
bddf72ee46 | ||
|
|
2b94ed12c2 | ||
|
|
31f9f0e864 | ||
|
|
1342be5723 | ||
|
|
d25de90df2 | ||
|
|
1fdfb9f568 | ||
|
|
9b22685484 | ||
|
|
8ee702f6ff | ||
|
|
fddd728037 | ||
|
|
fbe76f4713 | ||
|
|
79ad4fb15a | ||
|
|
46cc0e8b94 | ||
|
|
75ca36e5f7 | ||
|
|
398c834b0b | ||
|
|
51ad55b1d1 | ||
|
|
cb7b6f05f2 | ||
|
|
94c69d6596 | ||
|
|
aa7697dd3e | ||
|
|
741b225706 | ||
|
|
99f41a3f9f | ||
|
|
4b0f46bb1b | ||
|
|
e608dca175 | ||
|
|
2d64f49dc5 | ||
|
|
7c69d9477b | ||
|
|
db925bfe35 | ||
|
|
9e138d8a6a | ||
|
|
eb45899433 | ||
|
|
be761d10b1 |
@@ -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
|
||||
|
||||
**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:
|
||||
|
||||
- [Python3](https://wiki.python.org/moin/BeginnersGuide/Download): `python3 --version` >= `3.8.10` (the Python3 shipped in Ubuntu 20+ is good to go)
|
||||
|
||||
@@ -24,6 +24,8 @@ services:
|
||||
env_file:
|
||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
||||
image: cerc/fixturenet-eth-geth:local
|
||||
volumes:
|
||||
- fixturenet_geth_accounts:/opt/testnet/build/el
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "8545"]
|
||||
interval: 30s
|
||||
@@ -79,7 +81,7 @@ services:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "8001"
|
||||
|
||||
|
||||
fixturenet-eth-lighthouse-2:
|
||||
hostname: fixturenet-eth-lighthouse-2
|
||||
healthcheck:
|
||||
@@ -101,3 +103,6 @@ services:
|
||||
condition: service_started
|
||||
fixturenet-eth-geth-2:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
fixturenet_geth_accounts:
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
services:
|
||||
laconic-console:
|
||||
restart: unless-stopped
|
||||
image: cerc/laconic-console-host:local
|
||||
ports:
|
||||
- "80"
|
||||
@@ -13,7 +13,7 @@ services:
|
||||
- "6060"
|
||||
- "26657"
|
||||
- "26656"
|
||||
- "9473"
|
||||
- "9473:9473"
|
||||
- "8545"
|
||||
- "8546"
|
||||
- "9090"
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
# Generates and funds the accounts required when setting up the L2 chain (outputs to volume l2_accounts)
|
||||
# Creates / updates the configuration for L1 contracts deployment
|
||||
# Deploys the L1 smart contracts (outputs to volume l1_deployment)
|
||||
fixturenet-optimism-contracts:
|
||||
hostname: fixturenet-optimism-contracts
|
||||
image: cerc/optimism-contracts:local
|
||||
env_file:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
# Waits for L1 endpoint to be up before running the script
|
||||
command: |
|
||||
"./wait-for-it.sh -h $${L1_HOST} -p $${L1_PORT} -s -t 60 -- ./run.sh"
|
||||
volumes:
|
||||
- ../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/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/run.sh:/app/packages/contracts-bedrock/run.sh
|
||||
- fixturenet_geth_accounts:/geth-accounts:ro
|
||||
- l2_accounts:/l2-accounts
|
||||
- l1_deployment:/app/packages/contracts-bedrock
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# Generates the config files required for L2 (outputs to volume l2_config)
|
||||
op-node-l2-config-gen:
|
||||
image: cerc/optimism-op-node:local
|
||||
depends_on:
|
||||
fixturenet-optimism-contracts:
|
||||
condition: service_completed_successfully
|
||||
env_file:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
volumes:
|
||||
- ../config/fixturenet-optimism/generate-l2-config.sh:/app/generate-l2-config.sh
|
||||
- l1_deployment:/contracts-bedrock:ro
|
||||
- l2_config:/app
|
||||
command: ["sh", "/app/generate-l2-config.sh"]
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# Initializes and runs the L2 execution client (outputs to volume l2_geth_data)
|
||||
op-geth:
|
||||
image: cerc/optimism-l2geth:local
|
||||
depends_on:
|
||||
op-node-l2-config-gen:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- ../config/fixturenet-optimism/run-op-geth.sh:/run-op-geth.sh
|
||||
- l2_config:/op-node:ro
|
||||
- l2_accounts:/l2-accounts:ro
|
||||
- l2_geth_data:/datadir
|
||||
entrypoint: "sh"
|
||||
command: "/run-op-geth.sh"
|
||||
ports:
|
||||
- "0.0.0.0:8545:8545"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost:8545"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
# Runs the L2 consensus client (Sequencer node)
|
||||
op-node:
|
||||
env_file:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
depends_on:
|
||||
op-geth:
|
||||
condition: service_healthy
|
||||
image: cerc/optimism-op-node:local
|
||||
volumes:
|
||||
- ../config/fixturenet-optimism/run-op-node.sh:/app/run-op-node.sh
|
||||
- l2_config:/op-node-data:ro
|
||||
- l2_accounts:/l2-accounts:ro
|
||||
command: ["sh", "/app/run-op-node.sh"]
|
||||
ports:
|
||||
- "0.0.0.0:8547:8547"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost:8547"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# Runs the batcher (takes transactions from the Sequencer and publishes them to L1)
|
||||
op-batcher:
|
||||
env_file:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
depends_on:
|
||||
op-node:
|
||||
condition: service_healthy
|
||||
op-geth:
|
||||
condition: service_healthy
|
||||
image: cerc/optimism-op-batcher:local
|
||||
volumes:
|
||||
- ../config/wait-for-it.sh:/wait-for-it.sh
|
||||
- ../config/fixturenet-optimism/run-op-batcher.sh:/run-op-batcher.sh
|
||||
- l2_accounts:/l2-accounts:ro
|
||||
entrypoint: ["sh", "-c"]
|
||||
# Waits for L1 endpoint to be up before running the batcher
|
||||
command: |
|
||||
"/wait-for-it.sh -h $${L1_HOST} -p $${L1_PORT} -s -t 60 -- /run-op-batcher.sh"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
volumes:
|
||||
fixturenet_geth_accounts:
|
||||
l1_deployment:
|
||||
l2_accounts:
|
||||
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'
|
||||
|
||||
services:
|
||||
# Starts the PostgreSQL database for watcher
|
||||
mobymask-watcher-db:
|
||||
restart: unless-stopped
|
||||
image: postgres:14-alpine
|
||||
@@ -21,37 +22,55 @@ 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:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
mobymask-watcher-db:
|
||||
condition: service_healthy
|
||||
image: cerc/mobymask:local
|
||||
working_dir: /app/packages/server
|
||||
env_file:
|
||||
- ../config/watcher-mobymask-v2/optimism-params.env
|
||||
- ../config/watcher-mobymask-v2/mobymask-params.env
|
||||
environment:
|
||||
- ENV=PROD
|
||||
command: ["sh", "-c", "npm start"]
|
||||
# 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:
|
||||
- ../config/watcher-mobymask-v2/secrets.json:/app/packages/server/secrets.json
|
||||
- moby_data_server:/app/packages/server
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "3330"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 10s
|
||||
- ../config/wait-for-it.sh:/app/packages/server/wait-for-it.sh
|
||||
- ../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
|
||||
- mobymask_deployment:/app/packages/server
|
||||
- fixturenet_geth_accounts:/geth-accounts:ro
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# Starts the mobymask-v2-watcher server
|
||||
mobymask-watcher-server:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
mobymask-watcher-db:
|
||||
condition: service_healthy
|
||||
mobymask:
|
||||
condition: service_completed_successfully
|
||||
image: cerc/watcher-mobymask-v2:local
|
||||
command: ["sh", "-c", "yarn server"]
|
||||
env_file:
|
||||
- ../config/watcher-mobymask-v2/optimism-params.env
|
||||
- ../config/watcher-mobymask-v2/mobymask-params.env
|
||||
command: ["sh", "start-server.sh"]
|
||||
volumes:
|
||||
- ../config/watcher-mobymask-v2/watcher.toml:/app/packages/mobymask-v2-watcher/environments/local.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/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/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"
|
||||
@@ -62,69 +81,10 @@ services:
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
|
||||
mobymask-watcher-peer:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
mobymask:
|
||||
condition: service_healthy
|
||||
image: cerc/watcher-mobymask-v2:local
|
||||
command: ["sh", "peer-start.sh"]
|
||||
volumes:
|
||||
- ../config/watcher-mobymask-v2/watcher.toml:/app/packages/mobymask-v2-watcher/environments/local.toml
|
||||
- ../config/watcher-mobymask-v2/peer-id.json:/app/packages/mobymask-v2-watcher/peer-id.json
|
||||
- ../config/watcher-mobymask-v2/peer-start.sh:/app/packages/mobymask-v2-watcher/peer-start.sh
|
||||
- moby_data_server:/server
|
||||
|
||||
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
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
volumes:
|
||||
mobymask_watcher_db_data:
|
||||
moby_data_server:
|
||||
|
||||
networks:
|
||||
# https://docs.docker.com/compose/networking/#configure-the-default-network
|
||||
default:
|
||||
# https://docs.docker.com/compose/networking/#use-a-pre-existing-network
|
||||
name: mobymask-v2-network
|
||||
external: true
|
||||
|
||||
mobymask_deployment:
|
||||
fixturenet_geth_accounts:
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
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 \
|
||||
--deploy-config /contracts-bedrock/deploy-config/getting-started.json \
|
||||
--deployment-dir /contracts-bedrock/deployments/getting-started/ \
|
||||
--outfile.l2 /app/genesis.json \
|
||||
--outfile.rollup /app/rollup.json \
|
||||
--l1-rpc $L1_RPC
|
||||
|
||||
openssl rand -hex 32 > /app/jwt.txt
|
||||
@@ -0,0 +1,14 @@
|
||||
# Change if pointing to an external L1 endpoint
|
||||
|
||||
# L1 endpoint
|
||||
L1_CHAIN_ID=1212
|
||||
L1_RPC="http://fixturenet-eth-geth-1:8545"
|
||||
L1_HOST="fixturenet-eth-geth-1"
|
||||
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_PRIV_KEY=
|
||||
L1_ADDRESS_2=
|
||||
L1_PRIV_KEY_2=
|
||||
@@ -0,0 +1,120 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
echo "Using L1 RPC endpoint ${L1_RPC}"
|
||||
|
||||
IMPORT_1="import './verify-contract-deployment'"
|
||||
IMPORT_2="import './rekey-json'"
|
||||
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
|
||||
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
|
||||
yarn hardhat rekey-json --output /l2-accounts/keys.json
|
||||
|
||||
# Read JSON file into variable
|
||||
KEYS_JSON=$(cat /l2-accounts/keys.json)
|
||||
|
||||
# Parse JSON into variables
|
||||
ADMIN_ADDRESS=$(echo "$KEYS_JSON" | jq -r '.Admin.address')
|
||||
ADMIN_PRIV_KEY=$(echo "$KEYS_JSON" | jq -r '.Admin.privateKey')
|
||||
PROPOSER_ADDRESS=$(echo "$KEYS_JSON" | jq -r '.Proposer.address')
|
||||
BATCHER_ADDRESS=$(echo "$KEYS_JSON" | jq -r '.Batcher.address')
|
||||
SEQUENCER_ADDRESS=$(echo "$KEYS_JSON" | jq -r '.Sequencer.address')
|
||||
|
||||
# Read the private key of L1 accounts
|
||||
if [ -f /geth-accounts/accounts.csv ]; then
|
||||
echo "Using L1 account credentials from the mounted volume"
|
||||
L1_ADDRESS=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 2)
|
||||
L1_PRIV_KEY=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3)
|
||||
L1_ADDRESS_2=$(awk -F, 'NR==2{print $(NF-1)}' /geth-accounts/accounts.csv)
|
||||
L1_PRIV_KEY_2=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv)
|
||||
else
|
||||
echo "Using L1 account credentials from env"
|
||||
fi
|
||||
|
||||
# Select a finalized L1 block as the starting point for roll ups
|
||||
until FINALIZED_BLOCK=$(cast block finalized --rpc-url "$L1_RPC"); do
|
||||
echo "Waiting for a finalized L1 block to exist, retrying after 10s"
|
||||
sleep 10
|
||||
done
|
||||
|
||||
L1_BLOCKNUMBER=$(echo "$FINALIZED_BLOCK" | awk '/number/{print $2}')
|
||||
L1_BLOCKHASH=$(echo "$FINALIZED_BLOCK" | awk '/hash/{print $2}')
|
||||
L1_BLOCKTIMESTAMP=$(echo "$FINALIZED_BLOCK" | awk '/timestamp/{print $2}')
|
||||
|
||||
echo "Selected L1 block ${L1_BLOCKNUMBER} as the starting block for roll ups"
|
||||
|
||||
# Send balances to the above L2 addresses
|
||||
yarn hardhat send-balance --to "${ADMIN_ADDRESS}" --amount 2 --private-key "${L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${PROPOSER_ADDRESS}" --amount 5 --private-key "${L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${BATCHER_ADDRESS}" --amount 1000 --private-key "${L1_PRIV_KEY}" --network getting-started
|
||||
|
||||
echo "Balances sent to L2 accounts"
|
||||
|
||||
# Update the deployment config
|
||||
sed -i 's/"l2OutputOracleStartingTimestamp": TIMESTAMP/"l2OutputOracleStartingTimestamp": '"$L1_BLOCKTIMESTAMP"'/g' deploy-config/getting-started.json
|
||||
jq --arg chainid "$L1_CHAIN_ID" '.l1ChainID = ($chainid | tonumber)' deploy-config/getting-started.json > tmp.json && mv tmp.json deploy-config/getting-started.json
|
||||
|
||||
node update-config.js deploy-config/getting-started.json "$ADMIN_ADDRESS" "$PROPOSER_ADDRESS" "$BATCHER_ADDRESS" "$SEQUENCER_ADDRESS" "$L1_BLOCKHASH"
|
||||
|
||||
echo "Updated the deployment config"
|
||||
|
||||
# Create a .env file
|
||||
echo "L1_RPC=$L1_RPC" > .env
|
||||
echo "PRIVATE_KEY_DEPLOYER=$ADMIN_PRIV_KEY" >> .env
|
||||
|
||||
echo "Deploying the L1 smart contracts, this will take a while..."
|
||||
|
||||
# Deploy the L1 smart contracts
|
||||
yarn hardhat deploy --network getting-started
|
||||
|
||||
echo "Deployed the L1 smart contracts"
|
||||
|
||||
# Read Proxy contract's JSON and get the address
|
||||
PROXY_JSON=$(cat deployments/getting-started/Proxy__OVM_L1StandardBridge.json)
|
||||
PROXY_ADDRESS=$(echo "$PROXY_JSON" | jq -r '.address')
|
||||
|
||||
# Send balance to the above Proxy contract in L1 for reflecting balance in L2
|
||||
# First account
|
||||
yarn hardhat send-balance --to "${PROXY_ADDRESS}" --amount 1 --private-key "${L1_PRIV_KEY}" --network getting-started
|
||||
# Second account
|
||||
yarn hardhat send-balance --to "${PROXY_ADDRESS}" --amount 1 --private-key "${L1_PRIV_KEY_2}" --network getting-started
|
||||
|
||||
echo "Balance sent to Proxy L2 contract"
|
||||
echo "Use following accounts for transactions in L2:"
|
||||
echo "${L1_ADDRESS}"
|
||||
echo "${L1_ADDRESS_2}"
|
||||
echo "Done"
|
||||
@@ -0,0 +1,36 @@
|
||||
const fs = require('fs')
|
||||
|
||||
// Get the command-line argument
|
||||
const configFile = process.argv[2]
|
||||
const adminAddress = process.argv[3]
|
||||
const proposerAddress = process.argv[4]
|
||||
const batcherAddress = process.argv[5]
|
||||
const sequencerAddress = process.argv[6]
|
||||
const blockHash = process.argv[7]
|
||||
|
||||
// Read the JSON file
|
||||
const configData = fs.readFileSync(configFile)
|
||||
const configObj = JSON.parse(configData)
|
||||
|
||||
// Update the finalSystemOwner property with the ADMIN_ADDRESS value
|
||||
configObj.finalSystemOwner =
|
||||
configObj.portalGuardian =
|
||||
configObj.controller =
|
||||
configObj.l2OutputOracleChallenger =
|
||||
configObj.proxyAdminOwner =
|
||||
configObj.baseFeeVaultRecipient =
|
||||
configObj.l1FeeVaultRecipient =
|
||||
configObj.sequencerFeeVaultRecipient =
|
||||
configObj.governanceTokenOwner =
|
||||
adminAddress
|
||||
|
||||
configObj.l2OutputOracleProposer = proposerAddress
|
||||
|
||||
configObj.batchSenderAddress = batcherAddress
|
||||
|
||||
configObj.p2pSequencerAddress = sequencerAddress
|
||||
|
||||
configObj.l1StartingBlockTag = blockHash
|
||||
|
||||
// Write the updated JSON object back to the file
|
||||
fs.writeFileSync(configFile, JSON.stringify(configObj, null, 2))
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# Get BACTHER_KEY from keys.json
|
||||
BATCHER_KEY=$(jq -r '.Batcher.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
|
||||
op-batcher \
|
||||
--l2-eth-rpc=http://op-geth:8545 \
|
||||
--rollup-rpc=http://op-node:8547 \
|
||||
--poll-interval=1s \
|
||||
--sub-safety-margin=6 \
|
||||
--num-confirmations=1 \
|
||||
--safe-abort-nonce-too-low-count=3 \
|
||||
--resubmission-timeout=30s \
|
||||
--rpc.addr=0.0.0.0 \
|
||||
--rpc.port=8548 \
|
||||
--rpc.enable-admin \
|
||||
--max-channel-duration=1 \
|
||||
--target-l1-tx-size-bytes=2048 \
|
||||
--l1-eth-rpc=$L1_RPC \
|
||||
--private-key=$BATCHER_KEY
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# TODO: Add in container build or use other tool
|
||||
echo "Installing jq"
|
||||
apk update && apk add jq
|
||||
|
||||
# Get SEQUENCER key from keys.json
|
||||
SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
|
||||
# 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"
|
||||
|
||||
BLOCK_SIGNER_KEY=$(cat datadir/block-signer-key)
|
||||
|
||||
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"
|
||||
|
||||
mkdir -p datadir
|
||||
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 '"')
|
||||
echo "SEQUENCER_ADDRESS: ${SEQUENCER_ADDRESS}"
|
||||
|
||||
# Run op-geth
|
||||
geth \
|
||||
--datadir ./datadir \
|
||||
--http \
|
||||
--http.corsdomain="*" \
|
||||
--http.vhosts="*" \
|
||||
--http.addr=0.0.0.0 \
|
||||
--http.api=web3,debug,eth,txpool,net,engine \
|
||||
--ws \
|
||||
--ws.addr=0.0.0.0 \
|
||||
--ws.port=8546 \
|
||||
--ws.origins="*" \
|
||||
--ws.api=debug,eth,txpool,net,engine \
|
||||
--syncmode=full \
|
||||
--gcmode=full \
|
||||
--nodiscover \
|
||||
--maxpeers=0 \
|
||||
--networkid=42069 \
|
||||
--authrpc.vhosts="*" \
|
||||
--authrpc.addr=0.0.0.0 \
|
||||
--authrpc.port=8551 \
|
||||
--authrpc.jwtsecret=/op-node/jwt.txt \
|
||||
--rollup.disabletxpoolgossip=true \
|
||||
--password=./datadir/password \
|
||||
--allow-insecure-unlock \
|
||||
--mine \
|
||||
--miner.etherbase=$SEQUENCER_ADDRESS \
|
||||
--unlock=$SEQUENCER_ADDRESS
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# Get SEQUENCER KEY from keys.json
|
||||
SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
|
||||
op-node \
|
||||
--l2=http://op-geth:8551 \
|
||||
--l2.jwt-secret=/op-node-data/jwt.txt \
|
||||
--sequencer.enabled \
|
||||
--sequencer.l1-confs=3 \
|
||||
--verifier.l1-confs=3 \
|
||||
--rollup.config=/op-node-data/rollup.json \
|
||||
--rpc.addr=0.0.0.0 \
|
||||
--rpc.port=8547 \
|
||||
--p2p.disable \
|
||||
--rpc.enable-admin \
|
||||
--p2p.sequencer.key=$SEQUENCER_KEY \
|
||||
--l1=$L1_RPC \
|
||||
--l1.rpckind=any
|
||||
Executable
+182
@@ -0,0 +1,182 @@
|
||||
#!/usr/bin/env bash
|
||||
# Use this script to test if a given TCP host/port are available
|
||||
|
||||
WAITFORIT_cmdname=${0##*/}
|
||||
|
||||
echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
|
||||
|
||||
usage()
|
||||
{
|
||||
cat << USAGE >&2
|
||||
Usage:
|
||||
$WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args]
|
||||
-h HOST | --host=HOST Host or IP under test
|
||||
-p PORT | --port=PORT TCP port under test
|
||||
Alternatively, you specify the host and port as host:port
|
||||
-s | --strict Only execute subcommand if the test succeeds
|
||||
-q | --quiet Don't output any status messages
|
||||
-t TIMEOUT | --timeout=TIMEOUT
|
||||
Timeout in seconds, zero for no timeout
|
||||
-- COMMAND ARGS Execute command with args after the test finishes
|
||||
USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
wait_for()
|
||||
{
|
||||
if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
|
||||
echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
|
||||
else
|
||||
echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout"
|
||||
fi
|
||||
WAITFORIT_start_ts=$(date +%s)
|
||||
while :
|
||||
do
|
||||
if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then
|
||||
nc -z $WAITFORIT_HOST $WAITFORIT_PORT
|
||||
WAITFORIT_result=$?
|
||||
else
|
||||
(echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1
|
||||
WAITFORIT_result=$?
|
||||
fi
|
||||
if [[ $WAITFORIT_result -eq 0 ]]; then
|
||||
WAITFORIT_end_ts=$(date +%s)
|
||||
echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
return $WAITFORIT_result
|
||||
}
|
||||
|
||||
wait_for_wrapper()
|
||||
{
|
||||
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
|
||||
if [[ $WAITFORIT_QUIET -eq 1 ]]; then
|
||||
timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
|
||||
else
|
||||
timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
|
||||
fi
|
||||
WAITFORIT_PID=$!
|
||||
trap "kill -INT -$WAITFORIT_PID" INT
|
||||
wait $WAITFORIT_PID
|
||||
WAITFORIT_RESULT=$?
|
||||
if [[ $WAITFORIT_RESULT -ne 0 ]]; then
|
||||
echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
|
||||
fi
|
||||
return $WAITFORIT_RESULT
|
||||
}
|
||||
|
||||
# process arguments
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
case "$1" in
|
||||
*:* )
|
||||
WAITFORIT_hostport=(${1//:/ })
|
||||
WAITFORIT_HOST=${WAITFORIT_hostport[0]}
|
||||
WAITFORIT_PORT=${WAITFORIT_hostport[1]}
|
||||
shift 1
|
||||
;;
|
||||
--child)
|
||||
WAITFORIT_CHILD=1
|
||||
shift 1
|
||||
;;
|
||||
-q | --quiet)
|
||||
WAITFORIT_QUIET=1
|
||||
shift 1
|
||||
;;
|
||||
-s | --strict)
|
||||
WAITFORIT_STRICT=1
|
||||
shift 1
|
||||
;;
|
||||
-h)
|
||||
WAITFORIT_HOST="$2"
|
||||
if [[ $WAITFORIT_HOST == "" ]]; then break; fi
|
||||
shift 2
|
||||
;;
|
||||
--host=*)
|
||||
WAITFORIT_HOST="${1#*=}"
|
||||
shift 1
|
||||
;;
|
||||
-p)
|
||||
WAITFORIT_PORT="$2"
|
||||
if [[ $WAITFORIT_PORT == "" ]]; then break; fi
|
||||
shift 2
|
||||
;;
|
||||
--port=*)
|
||||
WAITFORIT_PORT="${1#*=}"
|
||||
shift 1
|
||||
;;
|
||||
-t)
|
||||
WAITFORIT_TIMEOUT="$2"
|
||||
if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi
|
||||
shift 2
|
||||
;;
|
||||
--timeout=*)
|
||||
WAITFORIT_TIMEOUT="${1#*=}"
|
||||
shift 1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
WAITFORIT_CLI=("$@")
|
||||
break
|
||||
;;
|
||||
--help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
echoerr "Unknown argument: $1"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then
|
||||
echoerr "Error: you need to provide a host and port to test."
|
||||
usage
|
||||
fi
|
||||
|
||||
WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15}
|
||||
WAITFORIT_STRICT=${WAITFORIT_STRICT:-0}
|
||||
WAITFORIT_CHILD=${WAITFORIT_CHILD:-0}
|
||||
WAITFORIT_QUIET=${WAITFORIT_QUIET:-0}
|
||||
|
||||
# Check to see if timeout is from busybox?
|
||||
WAITFORIT_TIMEOUT_PATH=$(type -p timeout)
|
||||
WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH)
|
||||
|
||||
WAITFORIT_BUSYTIMEFLAG=""
|
||||
if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then
|
||||
WAITFORIT_ISBUSY=1
|
||||
# Check if busybox timeout uses -t flag
|
||||
# (recent Alpine versions don't support -t anymore)
|
||||
if timeout &>/dev/stdout | grep -q -e '-t '; then
|
||||
WAITFORIT_BUSYTIMEFLAG="-t"
|
||||
fi
|
||||
else
|
||||
WAITFORIT_ISBUSY=0
|
||||
fi
|
||||
|
||||
if [[ $WAITFORIT_CHILD -gt 0 ]]; then
|
||||
wait_for
|
||||
WAITFORIT_RESULT=$?
|
||||
exit $WAITFORIT_RESULT
|
||||
else
|
||||
if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
|
||||
wait_for_wrapper
|
||||
WAITFORIT_RESULT=$?
|
||||
else
|
||||
wait_for
|
||||
WAITFORIT_RESULT=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $WAITFORIT_CLI != "" ]]; then
|
||||
if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then
|
||||
echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess"
|
||||
exit $WAITFORIT_RESULT
|
||||
fi
|
||||
exec "${WAITFORIT_CLI[@]}"
|
||||
else
|
||||
exit $WAITFORIT_RESULT
|
||||
fi
|
||||
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
echo "Using L2 RPC endpoint ${L2_GETH_RPC}"
|
||||
|
||||
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
|
||||
jq --arg privateKey "$PRIVATE_KEY_DEPLOYER" '.privateKey = $privateKey' secrets-template.json > secrets.json
|
||||
|
||||
# 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": [
|
||||
"/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"
|
||||
],
|
||||
|
||||
@@ -1,9 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
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
|
||||
# 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
|
||||
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
|
||||
|
||||
@@ -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,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Private key of account with balance
|
||||
PRIVATE_KEY=
|
||||
|
||||
# Assign deployed contract address from server config
|
||||
CONTRACT_ADDRESS=`jq '.address' /server/config.json`
|
||||
|
||||
echo 'yarn peer-listener --contract-address <CONTRACT_ADDRESS> --private-key <PRIVATE_KEY>'
|
||||
yarn peer-listener --contract-address $CONTRACT_ADDRESS --private-key $PRIVATE_KEY
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rpcUrl": "",
|
||||
"privateKey": "",
|
||||
"baseURI": ""
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"rpcUrl": "http://laconicd:8545",
|
||||
"privateKey": "GENESIS_ACCOUNT_PRIVATE_KEY",
|
||||
"baseURI": "http://127.0.0.1:3002/#"
|
||||
}
|
||||
+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
|
||||
+7
-2
@@ -21,7 +21,7 @@
|
||||
|
||||
[server.p2p]
|
||||
enableRelay = true
|
||||
enablePeer = false
|
||||
enablePeer = true
|
||||
|
||||
[server.p2p.relay]
|
||||
host = "0.0.0.0"
|
||||
@@ -35,6 +35,11 @@
|
||||
pubSubTopic = 'mobymask'
|
||||
peerIdFile = './peer-id.json'
|
||||
enableDebugInfo = true
|
||||
enableL2Txs = REPLACE_WITH_ENABLE_PEER_L2_TXS
|
||||
|
||||
[server.p2p.peer.l2TxsConfig]
|
||||
privateKey = 'REPLACE_WITH_PRIVATE_KEY_PEER'
|
||||
contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS'
|
||||
|
||||
[metrics]
|
||||
host = "0.0.0.0"
|
||||
@@ -55,7 +60,7 @@
|
||||
[upstream]
|
||||
[upstream.ethServer]
|
||||
gqlApiEndpoint = "http://ipld-eth-server:8083/graphql"
|
||||
rpcProviderEndpoint = "http://laconicd:8545"
|
||||
rpcProviderEndpoint = "REPLACE_WITH_L2_GETH_RPC_ENDPOINT"
|
||||
blockDelayInMilliSecs = 60000
|
||||
|
||||
[upstream.cache]
|
||||
@@ -11,6 +11,6 @@ DEPS=(github.com/fare/gerbil-utils
|
||||
) ;
|
||||
for i in ${DEPS[@]} ; do
|
||||
echo "Installing gerbil package: $i"
|
||||
gxpkg install $i &&
|
||||
gxpkg install $i
|
||||
gxpkg build $i
|
||||
done
|
||||
|
||||
@@ -17,12 +17,16 @@ ARG NPM_GLOBAL=/usr/local/share/npm-global
|
||||
# Add NPM global to PATH.
|
||||
ENV PATH=${NPM_GLOBAL}/bin:${PATH}
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN \
|
||||
if [ ${CERC_HOST_GID} -ne 1000 ] ; then \
|
||||
groupmod -g ${CERC_HOST_GID} ${USERNAME} ; \
|
||||
# Don't switch container uid/gid if the host uid/gid is 1000 (which means it's already correct),
|
||||
# or root (which won't work anyway) or <= 100 (which also won't work).
|
||||
if [[ ${CERC_HOST_GID} -ne 1000 && ${CERC_HOST_GID} -ne 0 && ${CERC_HOST_GID} -gt 100 ]]; then \
|
||||
groupmod -g ${CERC_HOST_GID} ${USERNAME}; \
|
||||
fi \
|
||||
&& if [ ${CERC_HOST_UID} -ne 1000 ] ; then \
|
||||
usermod -u ${CERC_HOST_UID} -g ${CERC_HOST_GID} ${USERNAME} && chown ${CERC_HOST_UID}:${CERC_HOST_GID} /home/${USERNAME} ; \
|
||||
&& if [[ ${CERC_HOST_UID} -ne 1000 && ${CERC_HOST_UID} -ne 0 && ${CERC_HOST_UID} -gt 100 ]]; then \
|
||||
usermod -u ${CERC_HOST_UID} -g ${CERC_HOST_GID} ${USERNAME} && chown ${CERC_HOST_UID}:${CERC_HOST_GID} /home/${USERNAME}; \
|
||||
fi
|
||||
|
||||
RUN \
|
||||
|
||||
@@ -18,8 +18,9 @@ fi
|
||||
set -e
|
||||
target_package=$1
|
||||
local_npm_registry_url=$2
|
||||
# TODO: use jq rather than sed here:
|
||||
versioned_target_package=$(grep ${target_package} package.json | sed -e 's#[[:space:]]\{1,\}\"\('${target_package}'\)\":[[:space:]]\{1,\}\"\(.*\)\",#\1@\2#' )
|
||||
# Extract the actual version pinned in yarn.lock
|
||||
# See: https://stackoverflow.com/questions/60454251/how-to-know-the-version-of-currently-installed-package-from-yarn-lock
|
||||
versioned_target_package=$(yarn list --pattern ${target_package} --depth=0 --json --non-interactive --no-progress | jq -r '.data.trees[].name')
|
||||
# Use yarn info to get URL checksums etc from the new registry
|
||||
yarn_info_output=$(yarn info --json $versioned_target_package 2>/dev/null)
|
||||
# First check if the target version actually exists.
|
||||
|
||||
@@ -68,6 +68,7 @@ else
|
||||
--statediff.db.port=$CERC_STATEDIFF_DB_PORT \
|
||||
--statediff.db.user=$CERC_STATEDIFF_DB_USER \
|
||||
--statediff.db.logstatements=${CERC_STATEDIFF_DB_LOG_STATEMENTS:-false} \
|
||||
--statediff.db.copyfrom=${CERC_STATEDIFF_DB_COPY_FROM:-true} \
|
||||
--statediff.waitforsync=true \
|
||||
--statediff.writing=true"
|
||||
fi
|
||||
@@ -78,11 +79,16 @@ else
|
||||
--http \
|
||||
--http.addr="0.0.0.0" \
|
||||
--http.vhosts="*" \
|
||||
--http.api="eth,web3,net,admin,personal,debug,statediff" \
|
||||
--http.api="${CERC_GETH_HTTP_APIS:-eth,web3,net,admin,personal,debug,statediff}" \
|
||||
--http.corsdomain="*" \
|
||||
--authrpc.addr="0.0.0.0" \
|
||||
--authrpc.vhosts="*" \
|
||||
--authrpc.jwtsecret="/opt/testnet/build/el/jwtsecret" \
|
||||
--ws \
|
||||
--ws.addr="0.0.0.0" \
|
||||
--ws.origins="*" \
|
||||
--ws.api="${CERC_GETH_WS_APIS:-eth,web3,net,admin,personal,debug,statediff}" \
|
||||
--http.corsdomain="*" \
|
||||
--networkid="${NETWORK_ID}" \
|
||||
--netrestrict="${NETRESTRICT}" \
|
||||
--gcmode archive \
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile
|
||||
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
|
||||
ARG VARIANT=16-bullseye
|
||||
FROM node:${VARIANT}
|
||||
|
||||
ARG USERNAME=node
|
||||
ARG NPM_GLOBAL=/usr/local/share/npm-global
|
||||
|
||||
# This container pulls npm packages from a local registry configured via these env vars
|
||||
ARG CERC_NPM_URL
|
||||
ARG CERC_NPM_AUTH_TOKEN
|
||||
|
||||
# Add NPM global to PATH.
|
||||
ENV PATH=${NPM_GLOBAL}/bin:${PATH}
|
||||
|
||||
RUN \
|
||||
# Configure global npm install location, use group to adapt to UID/GID changes
|
||||
if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \
|
||||
&& usermod -a -G npm ${USERNAME} \
|
||||
&& umask 0002 \
|
||||
&& mkdir -p ${NPM_GLOBAL} \
|
||||
&& touch /usr/local/etc/npmrc \
|
||||
&& chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \
|
||||
&& chmod g+s ${NPM_GLOBAL} \
|
||||
&& npm config -g set prefix ${NPM_GLOBAL} \
|
||||
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
|
||||
# Install eslint
|
||||
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint" \
|
||||
&& npm cache clean --force > /dev/null 2>&1
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
&& apt-get -y install --no-install-recommends jq
|
||||
|
||||
# [Optional] Uncomment if you want to install an additional version of node using nvm
|
||||
# ARG EXTRA_NODE_VERSION=10
|
||||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
|
||||
|
||||
# We do this to get a yq binary from the published container, for the correct architecture we're building here
|
||||
COPY --from=docker.io/mikefarah/yq:latest /usr/bin/yq /usr/local/bin/yq
|
||||
|
||||
RUN mkdir -p /scripts
|
||||
COPY ./apply-webapp-config.sh /scripts
|
||||
COPY ./start-serving-app.sh /scripts
|
||||
|
||||
# [Optional] Uncomment if you want to install more global node modules
|
||||
# RUN su node -c "npm install -g <your-package-list-here>"
|
||||
|
||||
# Configure the local npm registry
|
||||
RUN npm config set @cerc-io:registry ${CERC_NPM_URL} \
|
||||
&& npm config set @lirewine:registry ${CERC_NPM_URL} \
|
||||
&& npm config set -- ${CERC_NPM_URL}:_authToken ${CERC_NPM_AUTH_TOKEN}
|
||||
|
||||
RUN mkdir -p /config
|
||||
COPY ./config.yml /config
|
||||
|
||||
# Install simple web server for now (use nginx perhaps later)
|
||||
RUN yarn global add http-server
|
||||
|
||||
# Globally install the payload web app package
|
||||
RUN yarn global add @cerc-io/console-app
|
||||
|
||||
# Expose port for http
|
||||
EXPOSE 80
|
||||
|
||||
# Default command sleeps forever so docker doesn't kill it
|
||||
CMD ["/scripts/start-serving-app.sh"]
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
if [[ $# -ne 2 ]]; then
|
||||
echo "Illegal number of parameters" >&2
|
||||
exit 1
|
||||
fi
|
||||
config_file_name=$1
|
||||
webapp_files_dir=$2
|
||||
if ![[ -f ${config_file_name} ]]; then
|
||||
echo "Config file ${config_file_name} does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ![[ -d ${webapp_files_dir} ]]; then
|
||||
echo "Webapp directory ${webapp_files_dir} does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
# First some magic using yq to translate our yaml config file into an array of key value pairs like:
|
||||
# LACONIC_HOSTED_CONFIG_<path-through-objects>=<value>
|
||||
readarray -t config_kv_pair_array < <( yq '.. | select(length > 2) | ([path | join("_"), .] | join("=") )' ${config_file_name} | sed 's/^/LACONIC_HOSTED_CONFIG_/' )
|
||||
declare -p config_kv_pair_array
|
||||
# Then iterate over that kv array making the template substitution in our web app files
|
||||
for kv_pair_string in "${config_kv_pair_array[@]}"
|
||||
do
|
||||
kv_pair=(${kv_pair_string//=/ })
|
||||
template_string_to_replace=${kv_pair[0]}
|
||||
template_value_to_substitute=${kv_pair[1]}
|
||||
# Run find and sed to do the substitution of one variable over all files
|
||||
# See: https://stackoverflow.com/a/21479607/1701505
|
||||
echo "Substituting: ${template_string_to_replace} = ${template_value_to_substitute}"
|
||||
# Note: we do not escape our strings, on the expectation they do not container the '#' char.
|
||||
find ${webapp_files_dir} -type f -exec sed -i 's#'${template_string_to_replace}'#'${template_value_to_substitute}'#g' {} +
|
||||
done
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/laconic-registry-cli
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/laconic-console-host:local -f ${SCRIPT_DIR}/Dockerfile \
|
||||
--add-host gitea.local:host-gateway \
|
||||
--build-arg CERC_NPM_AUTH_TOKEN --build-arg CERC_NPM_URL ${SCRIPT_DIR}
|
||||
@@ -0,0 +1,6 @@
|
||||
# Config for laconic-console running in a fixturenet with laconicd
|
||||
|
||||
services:
|
||||
wns:
|
||||
server: 'http://localhost:9473/api'
|
||||
webui: 'http://localhost:9473/console'
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
# TODO: Don't hard wire this:
|
||||
webapp_files_dir=/usr/local/share/.config/yarn/global/node_modules/@cerc-io/console-app/dist/production
|
||||
/scripts/apply-webapp-config.sh /config/config.yml ${webapp_files_dir}
|
||||
http-server -p 80 ${webapp_files_dir}
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FROM node:16.17.1-alpine3.16
|
||||
|
||||
RUN apk --update --no-cache add python3 alpine-sdk
|
||||
RUN apk --update --no-cache add python3 alpine-sdk jq bash
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
FROM cerc/foundry:local
|
||||
|
||||
# Install node (local foundry is a debian based image)
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y curl \
|
||||
&& curl --silent --location https://deb.nodesource.com/setup_16.x | bash - \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y nodejs git busybox jq \
|
||||
&& node -v
|
||||
|
||||
RUN corepack enable \
|
||||
&& yarn --version
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy optimism repo contents
|
||||
COPY . .
|
||||
|
||||
RUN echo "Building optimism" && \
|
||||
yarn && yarn build
|
||||
|
||||
WORKDIR /app/packages/contracts-bedrock
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/optimism-contracts
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/optimism-contracts:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/optimism
|
||||
@@ -0,0 +1,28 @@
|
||||
import fs from 'fs'
|
||||
|
||||
import { task } from 'hardhat/config'
|
||||
import { hdkey } from 'ethereumjs-wallet'
|
||||
import * as bip39 from 'bip39'
|
||||
|
||||
task('rekey-json', 'Generates a new set of keys for a test network')
|
||||
.addParam('output', 'JSON file to output accounts to')
|
||||
.setAction(async ({ output: outputFile }) => {
|
||||
const mnemonic = bip39.generateMnemonic()
|
||||
const pathPrefix = "m/44'/60'/0'/0"
|
||||
const labels = ['Admin', 'Proposer', 'Batcher', 'Sequencer']
|
||||
const hdwallet = hdkey.fromMasterSeed(await bip39.mnemonicToSeed(mnemonic))
|
||||
|
||||
const output = {}
|
||||
|
||||
for (let i = 0; i < labels.length; i++) {
|
||||
const label = labels[i]
|
||||
const wallet = hdwallet.derivePath(`${pathPrefix}/${i}`).getWallet()
|
||||
const addr = '0x' + wallet.getAddress().toString('hex')
|
||||
const pk = wallet.getPrivateKey().toString('hex')
|
||||
|
||||
output[label] = { address: addr, privateKey: pk }
|
||||
}
|
||||
|
||||
fs.writeFileSync(outputFile, JSON.stringify(output, null, 2))
|
||||
console.log(`L2 account keys written to ${outputFile}`)
|
||||
})
|
||||
@@ -0,0 +1,22 @@
|
||||
import { task } from 'hardhat/config'
|
||||
import '@nomiclabs/hardhat-ethers'
|
||||
import { ethers } from 'ethers'
|
||||
|
||||
task('send-balance', 'Sends Ether to a specified Ethereum account')
|
||||
.addParam('to', 'The Ethereum address to send Ether to')
|
||||
.addParam('amount', 'The amount of Ether to send, in Ether')
|
||||
.addParam('privateKey', 'The private key of the sender')
|
||||
.setAction(async ({ to, amount, privateKey }, {}) => {
|
||||
// Open the wallet using sender's private key
|
||||
const provider = new ethers.providers.JsonRpcProvider(`${process.env.L1_RPC}`)
|
||||
const wallet = new ethers.Wallet(privateKey, provider)
|
||||
|
||||
// Send amount to the specified address
|
||||
const tx = await wallet.sendTransaction({
|
||||
to,
|
||||
value: ethers.utils.parseEther(amount),
|
||||
})
|
||||
|
||||
console.log(`Balance sent to: ${to}, from: ${wallet.address}`)
|
||||
console.log(`Transaction hash: ${tx.hash}`)
|
||||
})
|
||||
+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)
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/optimism-l2geth
|
||||
docker build -t cerc/optimism-l2geth:local ${CERC_REPO_BASE_DIR}/op-geth
|
||||
@@ -0,0 +1,32 @@
|
||||
FROM golang:1.19.0-alpine3.15 as builder
|
||||
|
||||
ARG VERSION=v0.0.0
|
||||
|
||||
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
|
||||
|
||||
# build op-batcher with the shared go.mod & go.sum files
|
||||
COPY ./op-batcher /app/op-batcher
|
||||
COPY ./op-bindings /app/op-bindings
|
||||
COPY ./op-node /app/op-node
|
||||
COPY ./op-service /app/op-service
|
||||
COPY ./op-signer /app/op-signer
|
||||
COPY ./go.mod /app/go.mod
|
||||
COPY ./go.sum /app/go.sum
|
||||
|
||||
COPY ./.git /app/.git
|
||||
|
||||
WORKDIR /app/op-batcher
|
||||
|
||||
RUN go mod download
|
||||
|
||||
ARG TARGETOS TARGETARCH
|
||||
|
||||
RUN make op-batcher VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
|
||||
|
||||
FROM alpine:3.15
|
||||
|
||||
RUN apk add --no-cache jq bash
|
||||
|
||||
COPY --from=builder /app/op-batcher/bin/op-batcher /usr/local/bin
|
||||
|
||||
ENTRYPOINT ["op-batcher"]
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/optimism-op-batcher
|
||||
# TODO: use upstream Dockerfile once its buildx-specific content has been removed
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
docker build -t cerc/optimism-op-batcher:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/optimism
|
||||
@@ -0,0 +1,30 @@
|
||||
FROM golang:1.19.0-alpine3.15 as builder
|
||||
|
||||
ARG VERSION=v0.0.0
|
||||
|
||||
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
|
||||
|
||||
# build op-node with the shared go.mod & go.sum files
|
||||
COPY ./op-node /app/op-node
|
||||
COPY ./op-chain-ops /app/op-chain-ops
|
||||
COPY ./op-service /app/op-service
|
||||
COPY ./op-bindings /app/op-bindings
|
||||
COPY ./go.mod /app/go.mod
|
||||
COPY ./go.sum /app/go.sum
|
||||
COPY ./.git /app/.git
|
||||
|
||||
WORKDIR /app/op-node
|
||||
|
||||
RUN go mod download
|
||||
|
||||
ARG TARGETOS TARGETARCH
|
||||
|
||||
RUN make op-node VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
|
||||
|
||||
FROM alpine:3.15
|
||||
|
||||
RUN apk add --no-cache openssl jq
|
||||
|
||||
COPY --from=builder /app/op-node/bin/op-node /usr/local/bin
|
||||
|
||||
CMD ["op-node"]
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/optimism-op-node
|
||||
# TODO: use upstream Dockerfile once its buildx-specific content has been removed
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
docker build -t cerc/optimism-op-node:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/optimism
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ cerc/ipld-eth-beacon-indexer
|
||||
cerc/ipld-eth-server
|
||||
cerc/laconicd
|
||||
cerc/laconic-registry-cli
|
||||
cerc/laconic-console-host
|
||||
cerc/fixturenet-eth-geth
|
||||
cerc/fixturenet-eth-lighthouse
|
||||
cerc/watcher-mobymask
|
||||
@@ -30,3 +31,6 @@ cerc/tx-spammer
|
||||
cerc/builder-gerbil
|
||||
cerc/act-runner
|
||||
cerc/act-runner-task-executor
|
||||
cerc/optimism-l2geth
|
||||
cerc/optimism-op-batcher
|
||||
cerc/optimism-op-node
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
laconic-sdk
|
||||
laconic-registry-cli
|
||||
gem
|
||||
laconic-console
|
||||
debug
|
||||
crypto
|
||||
sdk
|
||||
gem
|
||||
|
||||
@@ -15,10 +15,12 @@ watcher-erc20
|
||||
watcher-erc721
|
||||
watcher-uniswap-v3
|
||||
watcher-mobymask-v2
|
||||
mobymask-laconicd
|
||||
mobymask-app
|
||||
peer-test-app
|
||||
test
|
||||
eth-probe
|
||||
keycloak
|
||||
tx-spammer
|
||||
kubo
|
||||
foundry
|
||||
fixturenet-optimism
|
||||
|
||||
@@ -9,6 +9,7 @@ cerc-io/ipld-eth-beacon-db
|
||||
cerc-io/laconicd
|
||||
cerc-io/laconic-sdk
|
||||
cerc-io/laconic-registry-cli
|
||||
cerc-io/laconic-console
|
||||
cerc-io/mobymask-watcher
|
||||
cerc-io/watcher-ts
|
||||
cerc-io/react-peer
|
||||
@@ -23,4 +24,7 @@ dboreham/foundry
|
||||
lirewine/gem
|
||||
lirewine/debug
|
||||
lirewine/crypto
|
||||
lirewine/sdk
|
||||
telackey/act_runner
|
||||
ethereum-optimism/op-geth
|
||||
ethereum-optimism/optimism
|
||||
|
||||
@@ -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.
|
||||
|
||||
### 1. Build support containers
|
||||
```
|
||||
$ laconic-so --stack build-support build-containers
|
||||
```
|
||||
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:
|
||||
|
||||
Note: the scheme/gerbil container is excluded as it isn't currently required for the package registry.
|
||||
|
||||
```
|
||||
$ 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 build-containers
|
||||
$ laconic-so --stack package-registry deploy up
|
||||
[+] Running 3/3
|
||||
⠿ 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
|
||||
$
|
||||
```
|
||||
|
||||
Note: the above commands can take several minutes depending on the specs of your machine.
|
||||
|
||||
### 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):
|
||||
```
|
||||
@@ -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):
|
||||
```
|
||||
$ export CERC_NPM_AUTH_TOKEN=84fe66a73698bf11edbdccd0a338236b7d1d5c45
|
||||
$ laconic-so build-npms --include laconic-sdk
|
||||
$ laconic-so build-npms --include laconic-sdk,laconic-registry-cli
|
||||
```
|
||||
|
||||
@@ -5,7 +5,9 @@ repos:
|
||||
- cerc-io/ipld-eth-db
|
||||
- cerc-io/ipld-eth-server
|
||||
- cerc-io/watcher-ts
|
||||
- dboreham/foundry
|
||||
containers:
|
||||
- cerc/foundry
|
||||
- cerc/go-ethereum
|
||||
- cerc/go-ethereum-foundry
|
||||
- cerc/ipld-eth-db
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
version: "1.0"
|
||||
version: "1.1"
|
||||
name: fixturenet-eth
|
||||
decription: "Ethereum Fixturenet"
|
||||
repos:
|
||||
- cerc-io/go-ethereum
|
||||
- cerc-io/tx-spammer
|
||||
- dboreham/foundry
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# Laconic Fixturenet (experimental)
|
||||
|
||||
Testing a "Loaded" fixturenet with console.
|
||||
|
||||
Instructions for deploying a local Laconic blockchain "fixturenet" for development and testing purposes using laconic-stack-orchestrator.
|
||||
|
||||
## 1. Install Laconic Stack Orchestrator
|
||||
Installation is covered in detail [here](https://github.com/cerc-io/stack-orchestrator#user-mode) but if you're on Linux and already have docker installed it should be as simple as:
|
||||
```
|
||||
$ mkdir my-working-dir
|
||||
$ cd my-working-dir
|
||||
$ curl -L -o ./laconic-so https://github.com/cerc-io/stack-orchestrator/releases/latest/download/laconic-so
|
||||
$ chmod +x ./laconic-so
|
||||
$ export PATH=$PATH:$(pwd) # Or move laconic-so to ~/bin or your favorite on-path directory
|
||||
```
|
||||
## 2. Prepare the local build environment
|
||||
Note that this step needs only to be done once on a new machine.
|
||||
Detailed instructions can be found [here](../build-support/README.md). For the impatient run these commands:
|
||||
```
|
||||
$ laconic-so --stack build-support build-containers --exclude cerc/builder-gerbil
|
||||
$ laconic-so --stack package-registry setup-repositories
|
||||
$ laconic-so --stack package-registry deploy-system up
|
||||
```
|
||||
Then add the localhost alias `gitea.local` and set `CERC_NPM_AUTH_TOKEN` to the token printed when the package-registry stack was deployed above:
|
||||
```
|
||||
$ sudo vi /etc/hosts
|
||||
$ export CERC_NPM_AUTH_TOKEN=<my-token>
|
||||
```
|
||||
|
||||
## 3. Clone required repositories
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconicd setup-repositories
|
||||
```
|
||||
## 4. Build the stack's packages and containers
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconicd build-npms
|
||||
$ laconic-so --stack fixturenet-laconicd build-containers
|
||||
```
|
||||
## 5. Deploy the stack
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconicd deploy up
|
||||
```
|
||||
Correct operation should be verified by checking the laconicd container's logs with:
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconicd deploy logs
|
||||
```
|
||||
## 6. Test with the Registry CLI
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconicd deploy exec cli "laconic cns status"
|
||||
```
|
||||
@@ -0,0 +1,30 @@
|
||||
version: "1.0"
|
||||
name: fixturenet-laconic-loaded
|
||||
description: "A full featured laconic fixturenet"
|
||||
repos:
|
||||
- cerc-io/laconicd
|
||||
- lirewine/debug
|
||||
- lirewine/crypto
|
||||
- lirewine/gem
|
||||
- lirewine/sdk
|
||||
- cerc-io/laconic-sdk
|
||||
- cerc-io/laconic-registry-cli
|
||||
- cerc-io/laconic-console
|
||||
npms:
|
||||
- laconic-sdk
|
||||
- laconic-registry-cli
|
||||
- debug
|
||||
- crypto
|
||||
- sdk
|
||||
- gem
|
||||
- laconic-console
|
||||
containers:
|
||||
- cerc/laconicd
|
||||
- cerc/laconic-registry-cli
|
||||
- cerc/laconic-console-host
|
||||
pods:
|
||||
- fixturenet-laconicd
|
||||
- fixturenet-laconic-console
|
||||
config:
|
||||
cli:
|
||||
key: laconicd.mykey
|
||||
@@ -0,0 +1,118 @@
|
||||
# fixturenet-optimism
|
||||
|
||||
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
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism setup-repositories
|
||||
```
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry:
|
||||
* `cerc/go-ethereum`
|
||||
* `cerc/lighthouse`
|
||||
* `cerc/fixturenet-eth-geth`
|
||||
* `cerc/fixturenet-eth-lighthouse`
|
||||
* `cerc/foundry`
|
||||
* `cerc/optimism-contracts`
|
||||
* `cerc/optimism-l2geth`
|
||||
* `cerc/optimism-op-batcher`
|
||||
* `cerc/optimism-op-node`
|
||||
|
||||
## Deploy
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism deploy up
|
||||
```
|
||||
|
||||
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 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
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
* 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
|
||||
|
||||
* `fixturenet-eth` currently starts fresh on a restart
|
||||
* Resource requirements (memory + time) for building the `cerc/foundry` image are on the higher side
|
||||
* `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)
|
||||
@@ -0,0 +1,21 @@
|
||||
version: "1.0"
|
||||
name: fixturenet-optimism
|
||||
decription: "Optimism Fixturenet"
|
||||
repos:
|
||||
- cerc-io/go-ethereum
|
||||
- dboreham/foundry
|
||||
- ethereum-optimism/optimism
|
||||
- ethereum-optimism/op-geth
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/foundry
|
||||
- cerc/optimism-contracts
|
||||
- cerc/optimism-op-node
|
||||
- cerc/optimism-l2geth
|
||||
- cerc/optimism-op-batcher
|
||||
pods:
|
||||
- fixturenet-eth
|
||||
- fixturenet-optimism
|
||||
@@ -1,6 +1,9 @@
|
||||
# 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
|
||||
|
||||
@@ -18,23 +21,23 @@ Checkout to the required versions and branches in repos
|
||||
```bash
|
||||
# watcher-ts
|
||||
cd ~/cerc/watcher-ts
|
||||
git checkout v0.2.31
|
||||
git checkout v0.2.35
|
||||
|
||||
# react-peer
|
||||
cd ~/cerc/react-peer
|
||||
git checkout v0.2.29
|
||||
git checkout v0.2.31
|
||||
|
||||
# mobymask-ui
|
||||
cd ~/cerc/mobymask-ui
|
||||
git checkout laconic
|
||||
|
||||
# laconicd
|
||||
cd ~/cerc/laconicd
|
||||
git checkout v0.8.0
|
||||
|
||||
# MobyMask
|
||||
cd ~/cerc/MobyMask
|
||||
git checkout v0.1.1
|
||||
git checkout v0.1.2
|
||||
|
||||
# Optimism
|
||||
cd ~/cerc/optimism
|
||||
git checkout @eth-optimism/sdk@0.0.0-20230329025055
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
@@ -47,80 +50,28 @@ This should create the required docker images in the local image registry.
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
* Deploy the laconic chain
|
||||
* Deploy the containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd up
|
||||
laconic-so --stack mobymask-v2 deploy-system up
|
||||
```
|
||||
|
||||
* Check that laconic chain status is healthy
|
||||
* List and check the health status of all the containers using `docker ps` and wait for them to be `healthy`
|
||||
|
||||
NOTE: The `mobymask-app` container might not start; if the app is not running at http://localhost:3002, restart the container using it's id:
|
||||
|
||||
```bash
|
||||
docker ps
|
||||
```
|
||||
docker ps -a | grep "mobymask-app"
|
||||
|
||||
* Export the private key from laconicd
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "echo y | laconicd keys export mykey --unarmored-hex --unsafe"
|
||||
```
|
||||
|
||||
* Set the private key in [secrets.json](../../config/watcher-mobymask-v2/secrets.json) file that will be used by mobymask container to deploy contract
|
||||
|
||||
* Create a new account
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "laconicd keys add alice"
|
||||
```
|
||||
|
||||
* Transfer balance to new account
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd 'laconicd tx bank send $(laconicd keys show mykey -a) $(laconicd keys show alice -a) 1000000000000000000000000aphoton --fees 2000aphoton'
|
||||
```
|
||||
|
||||
* Export the private key of new account from laconicd
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "echo y | laconicd keys export alice --unarmored-hex --unsafe"
|
||||
```
|
||||
|
||||
* Set the private key (`PRIVATE_KEY`) in [peer-start.sh](../../config/watcher-mobymask-v2/peer-start.sh) file that will be used to start the peer that sends txs to L2 chain
|
||||
|
||||
* Deploy the other containers
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 up
|
||||
```
|
||||
|
||||
* Check that all containers are healthy using `docker ps`
|
||||
|
||||
NOTE: The `mobymask-ui` container might not start. If mobymask-app is not running at http://localhost:3002, run command again to start the container
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 up
|
||||
docker restart <CONTAINER_ID>
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
Find the watcher container's id:
|
||||
Find the watcher container's id and export it for later use:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 ps | grep "mobymask-watcher-server"
|
||||
```
|
||||
|
||||
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`
|
||||
|
||||
Export it for later use:
|
||||
|
||||
```bash
|
||||
export CONTAINER_ID=<CONTAINER_ID>
|
||||
export CONTAINER_ID=$(docker ps -q --filter "name=mobymask-watcher-server")
|
||||
```
|
||||
|
||||
Run the peer tests:
|
||||
@@ -131,7 +82,11 @@ docker exec -w /app/packages/peer $CONTAINER_ID yarn test
|
||||
|
||||
## Web Apps
|
||||
|
||||
Check that the status for web-app containers are healthy by using `docker ps`
|
||||
Check that the web-app containers are healthy:
|
||||
|
||||
```bash
|
||||
docker ps | grep -E 'mobymask-app|peer-test-app'
|
||||
```
|
||||
|
||||
### mobymask-app
|
||||
|
||||
@@ -158,22 +113,15 @@ Follow the [demo](./demo.md) to try out the MobyMask app with L2 chain
|
||||
Stop all the services running in background run:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 down
|
||||
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd down
|
||||
laconic-so --stack mobymask-v2 deploy-system down
|
||||
```
|
||||
|
||||
Clear volumes:
|
||||
Clear volumes created by this stack:
|
||||
|
||||
* List all 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
|
||||
docker volume ls
|
||||
```
|
||||
|
||||
* Remove volumes created by this stack
|
||||
|
||||
Example:
|
||||
```bash
|
||||
docker volume rm laconic-bfb01caf98b1b8f7c8db4d33f11b905a_moby_data_server
|
||||
```
|
||||
# Remove all the listed volumes
|
||||
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")
|
||||
```
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
# Demo
|
||||
|
||||
* Get the root invite link URL for mobymask-app
|
||||
* Get the root invite link URL for mobymask-app:
|
||||
|
||||
```
|
||||
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 logs mobymask
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
||||
```
|
||||
|
||||
The invite link is seen at the end of the logs
|
||||
Example:
|
||||
```
|
||||
The invite link is seen at the end of the logs. Example log:
|
||||
|
||||
```bash
|
||||
laconic-bfb01caf98b1b8f7c8db4d33f11b905a-mobymask-1 | http://127.0.0.1:3002/#/members?invitation=%7B%22v%22%3A1%2C%22signedDelegations%22%3A%5B%7B%22signature%22%3A%220x7559bd412f02677d60820e38243acf61547f79339395a34f7d4e1630e645aeb30535fc219f79b6fbd3af0ce3bd05132ad46d2b274a9fbc4c36bc71edd09850891b%22%2C%22delegation%22%3A%7B%22delegate%22%3A%220xc0838c92B2b71756E0eAD5B3C1e1F186baeEAAac%22%2C%22authority%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%2C%22caveats%22%3A%5B%7B%22enforcer%22%3A%220x558024C7d593B840E1BfD83E9B287a5CDad4db15%22%2C%22terms%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%7D%5D%7D%7D%5D%2C%22key%22%3A%220x98da9805821f1802196443e578fd32af567bababa0a249c07c82df01ecaa7d8d%22%7D
|
||||
```
|
||||
|
||||
* Open the invite link in browser to use the mobymask-app.
|
||||
* Open the invite link in a browser to use the mobymask-app.
|
||||
|
||||
NOTE: Before opening the invite link, clear the browser cache (local storage) for http://127.0.0.1:3002 to remove old invitations
|
||||
|
||||
* In the debug panel, check if it is connected to the p2p network (It should be connected to atleast one other peer for pubsub to work).
|
||||
* In the debug panel, check if it is connected to the p2p network (it should be connected to at least one other peer for pubsub to work).
|
||||
|
||||
* Create an invite link in the app by clicking on `Create new invite link` button.
|
||||
|
||||
@@ -29,26 +29,18 @@
|
||||
|
||||
* 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 --include watcher-mobymask-v2 ps | grep mobymask-watcher-peer
|
||||
```
|
||||
|
||||
* Check logs
|
||||
|
||||
```bash
|
||||
docker logs -f CONTAINER_ID
|
||||
```
|
||||
|
||||
* It should have received the message, sent transaction to L2 chain and received a transaction receipt 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.
|
||||
|
||||
Example log:
|
||||
|
||||
```
|
||||
2023-03-23T10:25:19.771Z vulcanize:peer-listener [10:25:19] Received a message on mobymask P2P network from peer: PeerId(12D3KooWAVNswtcrX12iDYukEoxdQwD34kJyRWcQTfZ4unGg2xjd)
|
||||
```bash
|
||||
2023-03-23T10:25:19.771Z vulcanize:peer-listener [10:25:19] Received a message on mobymask P2P network from peer: 12D3KooWAVNswtcrX12iDYukEoxdQwD34kJyRWcQTfZ4unGg2xjd
|
||||
2023-03-23T10:25:24.143Z laconic:libp2p-utils Transaction receipt for invoke message {
|
||||
to: '0x558024C7d593B840E1BfD83E9B287a5CDad4db15',
|
||||
blockNumber: 1996,
|
||||
@@ -60,7 +52,7 @@
|
||||
```
|
||||
|
||||
* Check the phisher in watcher GQL: http://localhost:3001/graphql
|
||||
* Use the blockHash from transaction receipt details or query for latest block
|
||||
* Use the blockHash from transaction receipt details or query for latest block:
|
||||
|
||||
```gql
|
||||
query {
|
||||
@@ -71,10 +63,10 @@
|
||||
}
|
||||
```
|
||||
|
||||
* Get the deployed contract address
|
||||
* Get the deployed contract address:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 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
|
||||
@@ -94,7 +86,7 @@
|
||||
}
|
||||
```
|
||||
|
||||
It should return true for reported phisher names.
|
||||
It should return `true` for reported phisher names.
|
||||
|
||||
* Watcher internally is using L2 chain `eth_getStorageAt` method.
|
||||
|
||||
@@ -107,7 +99,7 @@
|
||||
|
||||
* Revocation messages can be seen in the debug panel `MESSAGES` tab of other browsers.
|
||||
|
||||
* Check the watcher peer logs. It should receive a message and log the transaction receipt for revoke message.
|
||||
* Check the watcher peer logs. It should receive a message and log the transaction receipt for a `revoke` message.
|
||||
|
||||
* Try reporting a phisher from the revoked invitee's browser.
|
||||
|
||||
@@ -129,4 +121,4 @@
|
||||
}
|
||||
```
|
||||
|
||||
It should return false as the invitation/delegation used for reporting phishers has been revoked.
|
||||
It should return `false` as the invitation/delegation used for reporting phishers has been revoked.
|
||||
|
||||
@@ -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")
|
||||
```
|
||||
@@ -1,17 +1,31 @@
|
||||
version: "1.0"
|
||||
name: mobymask-v2
|
||||
repos:
|
||||
- cerc-io/go-ethereum
|
||||
- dboreham/foundry
|
||||
- ethereum-optimism/optimism
|
||||
- ethereum-optimism/op-geth
|
||||
- cerc-io/watcher-ts
|
||||
- cerc-io/react-peer
|
||||
- cerc-io/mobymask-ui
|
||||
- cerc-io/laconicd
|
||||
- cerc-io/MobyMask
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/foundry
|
||||
- cerc/optimism-contracts
|
||||
- cerc/optimism-l2geth
|
||||
- cerc/optimism-op-batcher
|
||||
- cerc/optimism-op-node
|
||||
- cerc/watcher-mobymask-v2
|
||||
- cerc/react-peer
|
||||
- cerc/mobymask-ui
|
||||
- cerc/laconicd
|
||||
- cerc/mobymask
|
||||
pods:
|
||||
- mobymask-laconicd
|
||||
- fixturenet-eth
|
||||
- fixturenet-optimism
|
||||
- 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
|
||||
v1.0.33-7e1137f
|
||||
# Manually updated product release version
|
||||
1.1.0
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ def command(ctx):
|
||||
|
||||
# See: https://stackoverflow.com/a/20885799/1701505
|
||||
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
|
||||
version_string = version_file.read().splitlines()[1]
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Builds the shiv "package" for distribution
|
||||
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} .
|
||||
|
||||
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