forked from cerc-io/stack-orchestrator
Compare commits
67
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7673de73bb | ||
|
|
f537cdbe29 | ||
|
|
09bca48498 | ||
|
|
ecb3b36387 | ||
|
|
5a50e46718 | ||
|
|
99af105b9c | ||
|
|
bfa86cbc29 | ||
|
|
332085f80b | ||
|
|
7406189596 | ||
|
|
f0ce0fef1c | ||
|
|
3e80f5f238 | ||
|
|
13499c6e4b | ||
|
|
6e343bec5a | ||
|
|
8b11070870 | ||
|
|
5c6fe825fc | ||
|
|
80c16d2ced | ||
|
|
6e33bd47e2 | ||
|
|
c2a3ffe0dd | ||
|
|
ffc24c0be8 | ||
|
|
7021f8ed19 | ||
|
|
2e747b17be | ||
|
|
607b85f447 | ||
|
|
ce6ef81fe5 | ||
|
|
7bcad7b936 | ||
|
|
d72dcb6c74 | ||
|
|
1559330fd7 | ||
|
|
75958adf82 | ||
|
|
b3732bc7a6 | ||
|
|
317608140f | ||
|
|
21d7a1ba61 | ||
|
|
17d5e37368 | ||
|
|
f90000d9cc | ||
|
|
bf85c61711 | ||
|
|
59afaf66ae | ||
|
|
18279fcef3 | ||
|
|
a8815924c6 | ||
|
|
fe77955845 | ||
|
|
8fb9e6d39b | ||
|
|
0d6bc81233 | ||
|
|
35d7649689 | ||
|
|
504ed542c3 | ||
|
|
6dad03c031 | ||
|
|
124a838ab5 | ||
|
|
b36f9bc974 | ||
|
|
4ae959eb4f | ||
|
|
af82c8c431 | ||
|
|
d2c85e6f1d | ||
|
|
53516f3109 | ||
|
|
5a27a94a7d | ||
|
|
4fa9d675ba | ||
|
|
dcc0f91140 | ||
|
|
e8139bd372 | ||
|
|
b915db426d | ||
|
|
69d215e8ec | ||
|
|
060ac520e4 | ||
|
|
484d80be5f | ||
|
|
792887a121 | ||
|
|
129d581141 | ||
|
|
44421049ae | ||
|
|
86f13e9c6b | ||
|
|
72737bfa29 | ||
|
|
63fbaa7ae3 | ||
|
|
464ef89a01 | ||
|
|
0c5f252465 | ||
|
|
b4d9a3a831 | ||
|
|
4da19b652e | ||
|
|
22bb1a0bfa |
@@ -0,0 +1,46 @@
|
||||
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,29 @@
|
||||
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: "Generate build version file"
|
||||
run: ./scripts/create_build_tag_file.sh
|
||||
- name: "Build local shiv package"
|
||||
run: ./scripts/build_shiv_package.sh
|
||||
- name: "Run smoke tests"
|
||||
run: ./tests/smoke-test/run-smoke-test.sh
|
||||
@@ -0,0 +1,46 @@
|
||||
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: actions/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: softprops/action-gh-release@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,29 @@
|
||||
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: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.8'
|
||||
- name: "Print Python version"
|
||||
run: python3 --version
|
||||
- name: "Install shiv"
|
||||
run: pip install shiv
|
||||
- name: "Generate build version file"
|
||||
run: ./scripts/create_build_tag_file.sh
|
||||
- name: "Build local shiv package"
|
||||
run: ./scripts/build_shiv_package.sh
|
||||
- name: "Run smoke tests"
|
||||
run: ./tests/smoke-test/run-smoke-test.sh
|
||||
+1
-1
@@ -5,4 +5,4 @@ laconic-so
|
||||
laconic_stack_orchestrator.egg-info
|
||||
__pycache__
|
||||
*~
|
||||
|
||||
build
|
||||
|
||||
@@ -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)
|
||||
@@ -91,3 +96,4 @@ See the [CONTRIBUTING.md](/docs/CONTRIBUTING.md) for developer mode install.
|
||||
|
||||
Native aarm64 is _not_ currently supported. x64 emulation on ARM64 macos should work (not yet tested).
|
||||
|
||||
|
||||
|
||||
@@ -36,13 +36,16 @@ from .util import include_exclude_check, get_parsed_stack_config
|
||||
@click.command()
|
||||
@click.option('--include', help="only build these containers")
|
||||
@click.option('--exclude', help="don\'t build these containers")
|
||||
@click.option("--force-rebuild", is_flag=True, default=False, help="Override dependency checking -- always rebuild")
|
||||
@click.option("--extra-build-args", help="Supply extra arguments to build")
|
||||
@click.pass_context
|
||||
def command(ctx, include, exclude):
|
||||
def command(ctx, include, exclude, force_rebuild, extra_build_args):
|
||||
'''build the set of containers required for a complete stack'''
|
||||
|
||||
quiet = ctx.obj.quiet
|
||||
verbose = ctx.obj.verbose
|
||||
dry_run = ctx.obj.dry_run
|
||||
debug = ctx.obj.debug
|
||||
local_stack = ctx.obj.local_stack
|
||||
stack = ctx.obj.stack
|
||||
continue_on_error = ctx.obj.continue_on_error
|
||||
@@ -84,10 +87,14 @@ def command(ctx, include, exclude):
|
||||
"CERC_NPM_URL": "http://gitea.local:3000/api/packages/cerc-io/npm/",
|
||||
"CERC_NPM_AUTH_TOKEN": config("CERC_NPM_AUTH_TOKEN", default="<token-not-supplied>"),
|
||||
"CERC_REPO_BASE_DIR": dev_root_path,
|
||||
"CERC_CONTAINER_BASE_DIR": container_build_dir,
|
||||
"CERC_HOST_UID": f"{os.getuid()}",
|
||||
"CERC_HOST_GID": f"{os.getgid()}",
|
||||
"DOCKER_BUILDKIT": "0"
|
||||
}
|
||||
container_build_env.update({"CERC_SCRIPT_DEBUG": "true"} if debug else {})
|
||||
container_build_env.update({"CERC_FORCE_REBUILD": "true"} if force_rebuild else {})
|
||||
container_build_env.update({"CERC_CONTAINER_EXTRA_BUILD_ARGS": extra_build_args} if extra_build_args else {})
|
||||
|
||||
def process_container(container):
|
||||
if not quiet:
|
||||
|
||||
+8
-2
@@ -33,8 +33,10 @@ builder_js_image_name = "cerc/builder-js:local"
|
||||
@click.command()
|
||||
@click.option('--include', help="only build these packages")
|
||||
@click.option('--exclude', help="don\'t build these packages")
|
||||
@click.option("--force-rebuild", is_flag=True, default=False, help="Override existing target package version check -- force rebuild")
|
||||
@click.option("--extra-build-args", help="Supply extra arguments to build")
|
||||
@click.pass_context
|
||||
def command(ctx, include, exclude):
|
||||
def command(ctx, include, exclude, force_rebuild, extra_build_args):
|
||||
'''build the set of npm packages required for a complete stack'''
|
||||
|
||||
quiet = ctx.obj.quiet
|
||||
@@ -119,8 +121,12 @@ def command(ctx, include, exclude):
|
||||
# Originally we used the PEP 584 merge operator:
|
||||
# envs = {"CERC_NPM_AUTH_TOKEN": npm_registry_url_token} | ({"CERC_SCRIPT_DEBUG": "true"} if debug else {})
|
||||
# but that isn't available in Python 3.8 (default in Ubuntu 20) so for now we use dict.update:
|
||||
envs = {"CERC_NPM_AUTH_TOKEN": npm_registry_url_token}
|
||||
envs = {"CERC_NPM_AUTH_TOKEN": npm_registry_url_token,
|
||||
"LACONIC_HOSTED_CONFIG_FILE": "config-hosted.yml" # Convention used by our web app packages
|
||||
}
|
||||
envs.update({"CERC_SCRIPT_DEBUG": "true"} if debug else {})
|
||||
envs.update({"CERC_FORCE_REBUILD": "true"} if force_rebuild else {})
|
||||
envs.update({"CERC_CONTAINER_EXTRA_BUILD_ARGS": extra_build_args} if extra_build_args else {})
|
||||
try:
|
||||
docker.run(builder_js_image_name,
|
||||
remove=True,
|
||||
|
||||
@@ -8,6 +8,7 @@ services:
|
||||
# TODO: look at folding these scripts into the container
|
||||
- ../config/fixturenet-laconicd/create-fixturenet.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
||||
- ../config/fixturenet-laconicd/export-mykey.sh:/docker-entrypoint-scripts.d/export-mykey.sh
|
||||
- ../config/fixturenet-laconicd/export-myaddress.sh:/docker-entrypoint-scripts.d/export-myaddress.sh
|
||||
# TODO: determine which of the ports below is really needed
|
||||
ports:
|
||||
- "6060"
|
||||
|
||||
@@ -9,11 +9,20 @@ services:
|
||||
image: cerc/optimism-contracts:local
|
||||
env_file:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_L1_CHAIN_ID: ${CERC_L1_CHAIN_ID}
|
||||
CERC_L1_RPC: ${CERC_L1_RPC}
|
||||
CERC_L1_ADDRESS: ${CERC_L1_ADDRESS}
|
||||
CERC_L1_PRIV_KEY: ${CERC_L1_PRIV_KEY}
|
||||
CERC_L1_ADDRESS_2: ${CERC_L1_ADDRESS_2}
|
||||
CERC_L1_PRIV_KEY_2: ${CERC_L1_PRIV_KEY_2}
|
||||
# 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"
|
||||
"./wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_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
|
||||
@@ -24,7 +33,7 @@ services:
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# Generates the config files required for L2 (outputs to volume op_node_data)
|
||||
# Generates the config files required for L2 (outputs to volume l2_config)
|
||||
op-node-l2-config-gen:
|
||||
image: cerc/optimism-op-node:local
|
||||
depends_on:
|
||||
@@ -32,15 +41,18 @@ services:
|
||||
condition: service_completed_successfully
|
||||
env_file:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_L1_RPC: ${CERC_L1_RPC}
|
||||
volumes:
|
||||
- ../config/fixturenet-optimism/generate-l2-config.sh:/app/generate-l2-config.sh
|
||||
- l1_deployment:/contracts-bedrock:ro
|
||||
- op_node_data:/app
|
||||
- l2_config:/app
|
||||
command: ["sh", "/app/generate-l2-config.sh"]
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# Initializes and runs the L2 execution client
|
||||
# Initializes and runs the L2 execution client (outputs to volume l2_geth_data)
|
||||
op-geth:
|
||||
image: cerc/optimism-l2geth:local
|
||||
depends_on:
|
||||
@@ -48,12 +60,13 @@ services:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- ../config/fixturenet-optimism/run-op-geth.sh:/run-op-geth.sh
|
||||
- op_node_data:/op-node:ro
|
||||
- l2_config:/op-node:ro
|
||||
- l2_accounts:/l2-accounts:ro
|
||||
- l2_geth_data:/datadir
|
||||
entrypoint: "sh"
|
||||
command: "/run-op-geth.sh"
|
||||
ports:
|
||||
- "8545"
|
||||
- "0.0.0.0:8545:8545"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost:8545"]
|
||||
interval: 30s
|
||||
@@ -63,19 +76,22 @@ services:
|
||||
|
||||
# Runs the L2 consensus client (Sequencer node)
|
||||
op-node:
|
||||
env_file:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
image: cerc/optimism-op-node:local
|
||||
depends_on:
|
||||
op-geth:
|
||||
condition: service_healthy
|
||||
image: cerc/optimism-op-node:local
|
||||
env_file:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_L1_RPC: ${CERC_L1_RPC}
|
||||
volumes:
|
||||
- ../config/fixturenet-optimism/run-op-node.sh:/app/run-op-node.sh
|
||||
- op_node_data:/op-node-data:ro
|
||||
- l2_config:/op-node-data:ro
|
||||
- l2_accounts:/l2-accounts:ro
|
||||
command: ["sh", "/app/run-op-node.sh"]
|
||||
ports:
|
||||
- "8547"
|
||||
- "0.0.0.0:8547:8547"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost:8547"]
|
||||
interval: 30s
|
||||
@@ -87,14 +103,17 @@ services:
|
||||
|
||||
# Runs the batcher (takes transactions from the Sequencer and publishes them to L1)
|
||||
op-batcher:
|
||||
env_file:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
image: cerc/optimism-op-batcher:local
|
||||
depends_on:
|
||||
op-node:
|
||||
condition: service_healthy
|
||||
op-geth:
|
||||
condition: service_healthy
|
||||
image: cerc/optimism-op-batcher:local
|
||||
env_file:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_L1_RPC: ${CERC_L1_RPC}
|
||||
volumes:
|
||||
- ../config/wait-for-it.sh:/wait-for-it.sh
|
||||
- ../config/fixturenet-optimism/run-op-batcher.sh:/run-op-batcher.sh
|
||||
@@ -102,7 +121,7 @@ services:
|
||||
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"
|
||||
"/wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- /run-op-batcher.sh"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
@@ -110,4 +129,5 @@ volumes:
|
||||
fixturenet_geth_accounts:
|
||||
l1_deployment:
|
||||
l2_accounts:
|
||||
op_node_data:
|
||||
l2_config:
|
||||
l2_geth_data:
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
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
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_CHAIN_ID: ${CERC_CHAIN_ID}
|
||||
CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT}
|
||||
CERC_APP_WATCHER_URL: ${CERC_APP_WATCHER_URL}
|
||||
CERC_RELAY_NODES: ${CERC_RELAY_NODES}
|
||||
# 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 ${CERC_WATCHER_HOST:-$${DEFAULT_CERC_WATCHER_HOST}} -p ${CERC_WATCHER_PORT:-$${DEFAULT_CERC_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
|
||||
- peers_ids:/peers
|
||||
- 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'
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
volumes:
|
||||
mobymask_deployment:
|
||||
peers_ids:
|
||||
@@ -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,30 @@
|
||||
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
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_RELAY_NODES: ${CERC_RELAY_NODES}
|
||||
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
|
||||
- peers_ids:/peers
|
||||
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:
|
||||
peers_ids:
|
||||
@@ -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,53 +22,66 @@ services:
|
||||
retries: 15
|
||||
start_period: 10s
|
||||
|
||||
# Deploys the MobyMask contract and generates an invite link
|
||||
# Deployment is skipped if CERC_DEPLOYED_CONTRACT env is set
|
||||
mobymask:
|
||||
restart: unless-stopped
|
||||
image: cerc/mobymask:local
|
||||
working_dir: /app/packages/server
|
||||
depends_on:
|
||||
op-node:
|
||||
condition: service_healthy
|
||||
op-geth:
|
||||
condition: service_healthy
|
||||
# TODO: Configure env file for ETH RPC URL & private key
|
||||
env_file:
|
||||
- ../config/watcher-mobymask-v2/optimism-params.env
|
||||
- ../config/watcher-mobymask-v2/mobymask-params.env
|
||||
environment:
|
||||
- ENV=PROD
|
||||
command: ["sh", "./deploy-and-generate-invite.sh"]
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
ENV: "PROD"
|
||||
CERC_L2_GETH_RPC: ${CERC_L2_GETH_RPC}
|
||||
CERC_PRIVATE_KEY_DEPLOYER: ${CERC_PRIVATE_KEY_DEPLOYER}
|
||||
CERC_MOBYMASK_APP_BASE_URI: ${CERC_MOBYMASK_APP_BASE_URI}
|
||||
CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT}
|
||||
# Waits for L2 Optimism Geth and Node servers to be up before deploying contract
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
./wait-for-it.sh -h ${CERC_L2_GETH_HOST:-$${DEFAULT_CERC_L2_GETH_HOST}} -p ${CERC_L2_GETH_PORT:-$${DEFAULT_CERC_L2_GETH_PORT}} -s -t 0 && \
|
||||
./wait-for-it.sh -h ${CERC_L2_NODE_HOST:-$${DEFAULT_CERC_L2_NODE_HOST}} -p ${CERC_L2_NODE_PORT:-$${DEFAULT_CERC_L2_NODE_PORT}} -s -t 0 && \
|
||||
./deploy-and-generate-invite.sh
|
||||
volumes:
|
||||
# TODO: add a script to set RPC endpoint from env
|
||||
# add manually if running seperately
|
||||
- ../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
|
||||
- moby_data_server:/app/packages/server
|
||||
- mobymask_deployment:/app/packages/server
|
||||
- fixturenet_geth_accounts:/geth-accounts:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "3330"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 10s
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# Starts the mobymask-v2-watcher server
|
||||
mobymask-watcher-server:
|
||||
# TODO: pass optimism RPC endpoint
|
||||
image: cerc/watcher-mobymask-v2:local
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
mobymask-watcher-db:
|
||||
condition: service_healthy
|
||||
mobymask:
|
||||
condition: service_healthy
|
||||
image: cerc/watcher-mobymask-v2:local
|
||||
command: ["sh", "server-start.sh"]
|
||||
condition: service_completed_successfully
|
||||
env_file:
|
||||
- ../config/watcher-mobymask-v2/optimism-params.env
|
||||
- ../config/watcher-mobymask-v2/mobymask-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_L2_GETH_RPC: ${CERC_L2_GETH_RPC}
|
||||
CERC_PRIVATE_KEY_PEER: ${CERC_PRIVATE_KEY_PEER}
|
||||
CERC_RELAY_PEERS: ${CERC_RELAY_PEERS}
|
||||
CERC_RELAY_ANNOUNCE_DOMAIN: ${CERC_RELAY_ANNOUNCE_DOMAIN}
|
||||
CERC_ENABLE_PEER_L2_TXS: ${CERC_ENABLE_PEER_L2_TXS}
|
||||
CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT}
|
||||
command: ["sh", "start-server.sh"]
|
||||
volumes:
|
||||
# TODO: add a script to set RPC endpoint from env
|
||||
# add manually if running seperately
|
||||
- ../config/watcher-mobymask-v2/watcher-config-template.toml:/app/packages/mobymask-v2-watcher/environments/watcher-config-template.toml
|
||||
- ../config/watcher-mobymask-v2/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/server-start.sh:/app/packages/mobymask-v2-watcher/server-start.sh
|
||||
- moby_data_server:/server
|
||||
- ../config/watcher-mobymask-v2/start-server.sh:/app/packages/mobymask-v2-watcher/start-server.sh
|
||||
- peers_ids:/app/packages/mobymask-v2-watcher/peers
|
||||
- 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"
|
||||
@@ -78,50 +92,11 @@ services:
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
|
||||
# TODO: Move to a separate pod
|
||||
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:
|
||||
peers_ids:
|
||||
mobymask_deployment:
|
||||
fixturenet_geth_accounts:
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
laconicd keys show mykey | grep address | cut -d ' ' -f 3
|
||||
@@ -5,3 +5,5 @@ services:
|
||||
userKey: REPLACE_WITH_MYKEY
|
||||
bondId:
|
||||
chainId: laconic_9000-1
|
||||
gas: 250000
|
||||
fees: 200000aphoton
|
||||
|
||||
@@ -4,11 +4,34 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
|
||||
# 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
|
||||
--l1-rpc $CERC_L1_RPC
|
||||
|
||||
openssl rand -hex 32 > /app/jwt.txt
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
# Change if pointing to an external L1 endpoint
|
||||
L1_RPC="http://fixturenet-eth-geth-1:8545"
|
||||
L1_CHAIN_ID=1212
|
||||
L1_HOST="fixturenet-eth-geth-1"
|
||||
L1_PORT=8545
|
||||
L1_ADDRESS=
|
||||
L1_PRIV_KEY=
|
||||
L1_ADDRESS_2=
|
||||
L1_PRIV_KEY_2=
|
||||
# Defaults
|
||||
|
||||
# L1 endpoint
|
||||
DEFAULT_CERC_L1_CHAIN_ID=1212
|
||||
DEFAULT_CERC_L1_RPC="http://fixturenet-eth-geth-1:8545"
|
||||
DEFAULT_CERC_L1_HOST="fixturenet-eth-geth-1"
|
||||
DEFAULT_CERC_L1_PORT=8545
|
||||
|
||||
# Credentials for accounts on L1 to send balance to Optimism Proxy contract from
|
||||
# (enables them to do transactions on L2)
|
||||
DEFAULT_CERC_L1_ADDRESS=
|
||||
DEFAULT_CERC_L1_PRIV_KEY=
|
||||
DEFAULT_CERC_L1_ADDRESS_2=
|
||||
DEFAULT_CERC_L1_PRIV_KEY_2=
|
||||
|
||||
@@ -4,21 +4,50 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# TODO Support restarts; fixturenet-eth-geth currently starts fresh on a restart
|
||||
# Exit if a deployment already exists (on restarts)
|
||||
# if [ -d "deployments/getting-started" ]; then
|
||||
# echo "Deployment directory deployments/getting-started already exists, exiting"
|
||||
# exit 0
|
||||
# fi
|
||||
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
|
||||
echo "Using L1 RPC endpoint ${L1_RPC}"
|
||||
CERC_L1_ADDRESS="${CERC_L1_ADDRESS:-${DEFAULT_CERC_L1_ADDRESS}}"
|
||||
CERC_L1_PRIV_KEY="${CERC_L1_PRIV_KEY:-${DEFAULT_CERC_L1_PRIV_KEY}}"
|
||||
CERC_L1_ADDRESS_2="${CERC_L1_ADDRESS_2:-${DEFAULT_CERC_L1_ADDRESS_2}}"
|
||||
CERC_L1_PRIV_KEY_2="${CERC_L1_PRIV_KEY_2:-${DEFAULT_CERC_L1_PRIV_KEY_2}}"
|
||||
|
||||
# Append tasks/index.ts file
|
||||
echo "import './rekey-json'" >> tasks/index.ts
|
||||
echo "import './send-balance'" >> tasks/index.ts
|
||||
echo "Using L1 RPC endpoint ${CERC_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
|
||||
sed -i "/getting-started/ {n; s/.*chainId.*/ chainId: $CERC_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
|
||||
@@ -36,16 +65,16 @@ 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)
|
||||
CERC_L1_ADDRESS=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 2)
|
||||
CERC_L1_PRIV_KEY=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3)
|
||||
CERC_L1_ADDRESS_2=$(awk -F, 'NR==2{print $(NF-1)}' /geth-accounts/accounts.csv)
|
||||
CERC_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
|
||||
until FINALIZED_BLOCK=$(cast block finalized --rpc-url "$CERC_L1_RPC"); do
|
||||
echo "Waiting for a finalized L1 block to exist, retrying after 10s"
|
||||
sleep 10
|
||||
done
|
||||
@@ -57,22 +86,22 @@ 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
|
||||
yarn hardhat send-balance --to "${ADMIN_ADDRESS}" --amount 2 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${PROPOSER_ADDRESS}" --amount 5 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${BATCHER_ADDRESS}" --amount 1000 --private-key "${CERC_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
|
||||
jq --arg chainid "$CERC_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 "L1_RPC=$CERC_L1_RPC" > .env
|
||||
echo "PRIVATE_KEY_DEPLOYER=$ADMIN_PRIV_KEY" >> .env
|
||||
|
||||
echo "Deploying the L1 smart contracts, this will take a while..."
|
||||
@@ -88,12 +117,12 @@ 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
|
||||
yarn hardhat send-balance --to "${PROXY_ADDRESS}" --amount 1 --private-key "${CERC_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
|
||||
yarn hardhat send-balance --to "${PROXY_ADDRESS}" --amount 1 --private-key "${CERC_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 "${CERC_L1_ADDRESS}"
|
||||
echo "${CERC_L1_ADDRESS_2}"
|
||||
echo "Done"
|
||||
|
||||
@@ -4,6 +4,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
|
||||
# Get BACTHER_KEY from keys.json
|
||||
BATCHER_KEY=$(jq -r '.Batcher.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
|
||||
@@ -20,5 +22,5 @@ op-batcher \
|
||||
--rpc.enable-admin \
|
||||
--max-channel-duration=1 \
|
||||
--target-l1-tx-size-bytes=2048 \
|
||||
--l1-eth-rpc=$L1_RPC \
|
||||
--l1-eth-rpc=$CERC_L1_RPC \
|
||||
--private-key=$BATCHER_KEY
|
||||
|
||||
@@ -4,34 +4,50 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
mkdir datadir
|
||||
|
||||
echo "pwd" > datadir/password
|
||||
|
||||
# TODO: Add in container build or use other tool
|
||||
echo "installing jq"
|
||||
echo "Installing jq"
|
||||
apk update && apk add jq
|
||||
|
||||
# Get SEQUENCER KEY from keys.json
|
||||
# Get SEQUENCER key from keys.json
|
||||
SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
echo $SEQUENCER_KEY > datadir/block-signer-key
|
||||
|
||||
geth account import --datadir=datadir --password=datadir/password datadir/block-signer-key
|
||||
# Initialize op-geth if datadir/geth not found
|
||||
if [ -f /op-node/jwt.txt ] && [ -d datadir/geth ]; then
|
||||
echo "Found existing datadir, checking block signer key"
|
||||
|
||||
while [ ! -f "/op-node/jwt.txt" ]
|
||||
do
|
||||
echo "Config files not created. Checking after 5 seconds."
|
||||
sleep 5
|
||||
done
|
||||
BLOCK_SIGNER_KEY=$(cat datadir/block-signer-key)
|
||||
|
||||
echo "Config files created by op-node, proceeding with script..."
|
||||
if [ "$SEQUENCER_KEY" = "$BLOCK_SIGNER_KEY" ]; then
|
||||
echo "Sequencer and block signer keys match, skipping initialization"
|
||||
else
|
||||
echo "Sequencer and block signer keys don't match, please clear L2 geth data volume before starting"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Initializing op-geth"
|
||||
|
||||
cp /op-node/genesis.json ./
|
||||
geth init --datadir=datadir genesis.json
|
||||
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}"
|
||||
cp /op-node/jwt.txt ./
|
||||
|
||||
# Run op-geth
|
||||
geth \
|
||||
--datadir ./datadir \
|
||||
--http \
|
||||
@@ -52,7 +68,7 @@ geth \
|
||||
--authrpc.vhosts="*" \
|
||||
--authrpc.addr=0.0.0.0 \
|
||||
--authrpc.port=8551 \
|
||||
--authrpc.jwtsecret=./jwt.txt \
|
||||
--authrpc.jwtsecret=/op-node/jwt.txt \
|
||||
--rollup.disabletxpoolgossip=true \
|
||||
--password=./datadir/password \
|
||||
--allow-insecure-unlock \
|
||||
|
||||
@@ -4,6 +4,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
|
||||
# Get SEQUENCER KEY from keys.json
|
||||
SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
|
||||
@@ -19,5 +21,5 @@ op-node \
|
||||
--p2p.disable \
|
||||
--rpc.enable-admin \
|
||||
--p2p.sequencer.key=$SEQUENCER_KEY \
|
||||
--l1=$L1_RPC \
|
||||
--l1=$CERC_L1_RPC \
|
||||
--l1.rpckind=any
|
||||
|
||||
Regular → Executable
+69
-5
@@ -1,11 +1,75 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# Read the private key of L1 account to deploy contract
|
||||
# TODO: Take from env if /geth-accounts volume doesn't exist to allow using separately running L1
|
||||
L1_PRIV_KEY=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3)
|
||||
CERC_L2_GETH_RPC="${CERC_L2_GETH_RPC:-${DEFAULT_CERC_L2_GETH_RPC}}"
|
||||
CERC_PRIVATE_KEY_DEPLOYER="${CERC_PRIVATE_KEY_DEPLOYER:-${DEFAULT_CERC_PRIVATE_KEY_DEPLOYER}}"
|
||||
|
||||
CERC_MOBYMASK_APP_BASE_URI="${CERC_MOBYMASK_APP_BASE_URI:-${DEFAULT_CERC_MOBYMASK_APP_BASE_URI}}"
|
||||
CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}"
|
||||
|
||||
echo "Using L2 RPC endpoint ${CERC_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
|
||||
CERC_PRIVATE_KEY_DEPLOYER=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3)
|
||||
else
|
||||
echo "Using CERC_PRIVATE_KEY_DEPLOYER from env"
|
||||
fi
|
||||
|
||||
# Set the private key
|
||||
jq --arg privateKey "$L1_PRIV_KEY" '.privateKey = ($privateKey)' secrets-template.json > secrets.json
|
||||
jq --arg privateKey "$CERC_PRIVATE_KEY_DEPLOYER" '.privateKey = $privateKey' secrets-template.json > secrets.json
|
||||
|
||||
npm start
|
||||
# Set the RPC URL
|
||||
jq --arg rpcUrl "$CERC_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 "$CERC_MOBYMASK_APP_BASE_URI" '.baseURI = $baseURI' secrets.json > secrets_updated.json && mv secrets_updated.json secrets.json
|
||||
|
||||
export RPC_URL="${CERC_L2_GETH_RPC}"
|
||||
|
||||
# Check if CERC_DEPLOYED_CONTRACT environment variable set to skip contract deployment
|
||||
if [ -n "$CERC_DEPLOYED_CONTRACT" ]; then
|
||||
echo "CERC_DEPLOYED_CONTRACT is set to '$CERC_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 "$CERC_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,7 +1,6 @@
|
||||
{
|
||||
"relayNodes": [
|
||||
"/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"
|
||||
],
|
||||
"name": "MobyMask",
|
||||
"relayNodes": [],
|
||||
"peer": {
|
||||
"enableDebugInfo": true
|
||||
}
|
||||
|
||||
@@ -1,9 +1,40 @@
|
||||
#!/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
|
||||
CERC_CHAIN_ID="${CERC_CHAIN_ID:-${DEFAULT_CERC_CHAIN_ID}}"
|
||||
CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}"
|
||||
CERC_RELAY_NODES="${CERC_RELAY_NODES:-${DEFAULT_CERC_RELAY_NODES}}"
|
||||
CERC_APP_WATCHER_URL="${CERC_APP_WATCHER_URL:-${DEFAULT_CERC_APP_WATCHER_URL}}"
|
||||
|
||||
npm run build
|
||||
# If not set (or []), check the mounted volume for relay peer id
|
||||
if [ -z "$CERC_RELAY_NODES" ] || [ "$CERC_RELAY_NODES" = "[]" ]; then
|
||||
echo "CERC_RELAY_NODES not provided, taking from the mounted volume"
|
||||
CERC_RELAY_NODES="[\"/ip4/127.0.0.1/tcp/9090/ws/p2p/$(jq -r '.id' /peers/relay-id.json)\"]"
|
||||
fi
|
||||
|
||||
echo "Using CERC_RELAY_NODES $CERC_RELAY_NODES"
|
||||
|
||||
# Use config from mounted volume if available (when running web-app along with watcher stack)
|
||||
if [ -f /server/config.json ]; then
|
||||
echo "Taking config for deployed contract from mounted volume"
|
||||
|
||||
# Get deployed contract address and chain id
|
||||
CERC_DEPLOYED_CONTRACT=$(jq -r '.address' /server/config.json | tr -d '"')
|
||||
CERC_CHAIN_ID=$(jq -r '.chainId' /server/config.json)
|
||||
else
|
||||
echo "Taking deployed contract details from env"
|
||||
fi
|
||||
|
||||
# Export config values in a json file
|
||||
jq --arg address "$CERC_DEPLOYED_CONTRACT" \
|
||||
--argjson chainId "$CERC_CHAIN_ID" \
|
||||
--argjson relayNodes "$CERC_RELAY_NODES" \
|
||||
'.address = $address | .chainId = $chainId | .relayNodes = $relayNodes' \
|
||||
/app/src/mobymask-app-config.json > /app/src/config.json
|
||||
|
||||
REACT_APP_WATCHER_URI="$CERC_APP_WATCHER_URL/graphql" npm run build
|
||||
|
||||
serve -s build
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
REACT_APP_WATCHER_URI=http://localhost:3001/graphql
|
||||
@@ -0,0 +1,28 @@
|
||||
# Defaults
|
||||
|
||||
# Watcher endpoint
|
||||
DEFAULT_CERC_WATCHER_HOST="mobymask-watcher-server"
|
||||
DEFAULT_CERC_WATCHER_PORT=3001
|
||||
DEFAULT_CERC_APP_WATCHER_URL="http://localhost:3001"
|
||||
|
||||
# Set of relay peers to connect to from the relay node
|
||||
DEFAULT_CERC_RELAY_PEERS=[]
|
||||
|
||||
# Domain to be used in the relay node's announce address
|
||||
DEFAULT_CERC_RELAY_ANNOUNCE_DOMAIN=
|
||||
|
||||
# Base URI for mobymask-app (used for generating invite)
|
||||
DEFAULT_CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3002/#"
|
||||
|
||||
# Set to false for disabling watcher peer to send txs to L2
|
||||
DEFAULT_CERC_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
|
||||
DEFAULT_CERC_DEPLOYED_CONTRACT=
|
||||
|
||||
# Chain ID is used by mobymask web-app for txs
|
||||
DEFAULT_CERC_CHAIN_ID=42069
|
||||
|
||||
# Set of relay nodes to be used by web-apps
|
||||
DEFAULT_CERC_RELAY_NODES=[]
|
||||
@@ -0,0 +1,13 @@
|
||||
# Defaults
|
||||
|
||||
# L2 endpoints
|
||||
DEFAULT_CERC_L2_GETH_RPC="http://op-geth:8545"
|
||||
DEFAULT_CERC_L2_GETH_HOST="op-geth"
|
||||
DEFAULT_CERC_L2_GETH_PORT=8545
|
||||
|
||||
DEFAULT_CERC_L2_NODE_HOST="op-node"
|
||||
DEFAULT_CERC_L2_NODE_PORT=8547
|
||||
|
||||
# Credentials for accounts to perform txs on L2
|
||||
DEFAULT_CERC_PRIVATE_KEY_DEPLOYER=
|
||||
DEFAULT_CERC_PRIVATE_KEY_PEER=
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"id": "12D3KooWK6myjc8r1KBnfP9igp31qJkPaVfsKDjKrjoSefV5SDEo",
|
||||
"privKey": "CAESQJMHbMaH+UEOtjGOzXYtoPO/cdHakCtN1hcnknIWzx/6ie1lxb+8kfzBjwt7apfj8fHlTCYSIVK8Q2AWu9a2h3g=",
|
||||
"pubKey": "CAESIIntZcW/vJH8wY8Le2qX4/Hx5UwmEiFSvENgFrvWtod4"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
RELAY="/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"id": "12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t",
|
||||
"privKey": "CAESQGsqG5o4VlWJZM9XlA3MjabyZOXWQ2MLZU5AhBQsjXGt9iSlGtTuNOrHX5xSRgLBxLuMoqWsjGxE/dDB9c46RI8=",
|
||||
"pubKey": "CAESIPYkpRrU7jTqx1+cUkYCwcS7jKKlrIxsRP3QwfXOOkSP"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"rpcUrl": "http://op-geth:8545",
|
||||
"rpcUrl": "",
|
||||
"privateKey": "",
|
||||
"baseURI": "http://127.0.0.1:3002/#"
|
||||
"baseURI": ""
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Assign deployed contract address from server config
|
||||
CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"')
|
||||
L1_PRIV_KEY_2=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv)
|
||||
|
||||
sed "s/REPLACE_WITH_PRIVATE_KEY/${L1_PRIV_KEY_2}/" environments/watcher-config-template.toml > environments/local.toml
|
||||
sed -i "s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/" environments/local.toml
|
||||
|
||||
echo 'yarn server'
|
||||
yarn server
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
CERC_L2_GETH_RPC="${CERC_L2_GETH_RPC:-${DEFAULT_CERC_L2_GETH_RPC}}"
|
||||
CERC_PRIVATE_KEY_PEER="${CERC_PRIVATE_KEY_PEER:-${DEFAULT_CERC_PRIVATE_KEY_PEER}}"
|
||||
|
||||
CERC_RELAY_PEERS="${CERC_RELAY_PEERS:-${DEFAULT_CERC_RELAY_PEERS}}"
|
||||
CERC_RELAY_ANNOUNCE_DOMAIN="${CERC_RELAY_ANNOUNCE_DOMAIN:-${DEFAULT_CERC_RELAY_ANNOUNCE_DOMAIN}}"
|
||||
CERC_ENABLE_PEER_L2_TXS="${CERC_ENABLE_PEER_L2_TXS:-${DEFAULT_CERC_ENABLE_PEER_L2_TXS}}"
|
||||
CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}"
|
||||
|
||||
echo "Using L2 RPC endpoint ${CERC_L2_GETH_RPC}"
|
||||
|
||||
# Check for peer ids in ./peers folder, create if not present
|
||||
if [ -f ./peers/relay-id.json ]; then
|
||||
echo "Using peer id for relay node from the mounted volume"
|
||||
else
|
||||
echo "Creating a new peer id for relay node"
|
||||
cd ../peer
|
||||
yarn create-peer -f ../mobymask-v2-watcher/peers/relay-id.json
|
||||
cd ../mobymask-v2-watcher
|
||||
fi
|
||||
|
||||
if [ -f ./peers/peer-id.json ]; then
|
||||
echo "Using peer id for peer node from the mounted volume"
|
||||
else
|
||||
echo "Creating a new peer id for peer node"
|
||||
cd ../peer
|
||||
yarn create-peer -f ../mobymask-v2-watcher/peers/peer-id.json
|
||||
cd ../mobymask-v2-watcher
|
||||
fi
|
||||
|
||||
CERC_RELAY_MULTIADDR="/dns4/mobymask-watcher-server/tcp/9090/ws/p2p/$(jq -r '.id' ./peers/relay-id.json)"
|
||||
|
||||
# Use contract address from environment variable or set from config.json in mounted volume
|
||||
if [ -n "$CERC_DEPLOYED_CONTRACT" ]; then
|
||||
CONTRACT_ADDRESS="${CERC_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
|
||||
CERC_PRIVATE_KEY_PEER=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv)
|
||||
else
|
||||
echo "Using CERC_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_CERC_RELAY_PEERS|${CERC_RELAY_PEERS}|g; \
|
||||
s/REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN/${CERC_RELAY_ANNOUNCE_DOMAIN}/g; \
|
||||
s|REPLACE_WITH_CERC_RELAY_MULTIADDR|${CERC_RELAY_MULTIADDR}|g; \
|
||||
s/REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS/${CERC_ENABLE_PEER_L2_TXS}/g; \
|
||||
s/REPLACE_WITH_CERC_PRIVATE_KEY_PEER/${CERC_PRIVATE_KEY_PEER}/g; \
|
||||
s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/g; \
|
||||
s|REPLACE_WITH_CERC_L2_GETH_RPC_ENDPOINT|${CERC_L2_GETH_RPC}| ")
|
||||
|
||||
# Write the modified content to a new file
|
||||
echo "$WATCHER_CONFIG" > environments/local.toml
|
||||
|
||||
# Write the relay node's multiaddr to /app/packages/peer/.env for running tests
|
||||
echo "RELAY=\"$CERC_RELAY_MULTIADDR\"" > /app/packages/peer/.env
|
||||
|
||||
echo 'yarn server'
|
||||
yarn server
|
||||
@@ -1,7 +1,5 @@
|
||||
{
|
||||
"relayNodes": [
|
||||
"/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"
|
||||
],
|
||||
"relayNodes": [],
|
||||
"peer": {
|
||||
"enableDebugInfo": true
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
CERC_RELAY_NODES="${CERC_RELAY_NODES:-${DEFAULT_CERC_RELAY_NODES}}"
|
||||
|
||||
# If not set (or []), check the mounted volume for relay peer id
|
||||
if [ -z "$CERC_RELAY_NODES" ] || [ "$CERC_RELAY_NODES" = "[]" ]; then
|
||||
echo "CERC_RELAY_NODES not provided, taking from the mounted volume"
|
||||
CERC_RELAY_NODES="[\"/ip4/127.0.0.1/tcp/9090/ws/p2p/$(jq -r '.id' /peers/relay-id.json)\"]"
|
||||
fi
|
||||
|
||||
echo "Using CERC_RELAY_NODES $CERC_RELAY_NODES"
|
||||
|
||||
# Set relay nodes in config using CERC_RELAY_NODES
|
||||
jq --argjson relayNodes "$CERC_RELAY_NODES" \
|
||||
'.relayNodes = $relayNodes' \
|
||||
./src/test-app-config.json > ./src/config.json
|
||||
|
||||
yarn build
|
||||
|
||||
serve -s build
|
||||
@@ -26,18 +26,20 @@
|
||||
[server.p2p.relay]
|
||||
host = "0.0.0.0"
|
||||
port = 9090
|
||||
relayPeers = []
|
||||
peerIdFile = './relay-id.json'
|
||||
relayPeers = REPLACE_WITH_CERC_RELAY_PEERS
|
||||
peerIdFile = './peers/relay-id.json'
|
||||
announce = 'REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN'
|
||||
enableDebugInfo = true
|
||||
|
||||
[server.p2p.peer]
|
||||
relayMultiaddr = '/dns4/mobymask-watcher-server/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t'
|
||||
relayMultiaddr = 'REPLACE_WITH_CERC_RELAY_MULTIADDR'
|
||||
pubSubTopic = 'mobymask'
|
||||
peerIdFile = './peer-id.json'
|
||||
peerIdFile = './peers/peer-id.json'
|
||||
enableDebugInfo = true
|
||||
enableL2Txs = REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS
|
||||
|
||||
[server.p2p.peer.l2TxConfig]
|
||||
privateKey = 'REPLACE_WITH_PRIVATE_KEY'
|
||||
[server.p2p.peer.l2TxsConfig]
|
||||
privateKey = 'REPLACE_WITH_CERC_PRIVATE_KEY_PEER'
|
||||
contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS'
|
||||
|
||||
[metrics]
|
||||
@@ -59,7 +61,7 @@
|
||||
[upstream]
|
||||
[upstream.ethServer]
|
||||
gqlApiEndpoint = "http://ipld-eth-server:8083/graphql"
|
||||
rpcProviderEndpoint = "http://op-geth:8545"
|
||||
rpcProviderEndpoint = "REPLACE_WITH_CERC_L2_GETH_RPC_ENDPOINT"
|
||||
blockDelayInMilliSecs = 60000
|
||||
|
||||
[upstream.cache]
|
||||
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
# source'ed into container build scripts to do generic command setup
|
||||
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
||||
set -x
|
||||
echo "Build environment variables:"
|
||||
env
|
||||
fi
|
||||
build_command_args=""
|
||||
if [[ ${CERC_FORCE_REBUILD} == "true" ]]; then
|
||||
build_command_args="${build_command_args} --no-cache"
|
||||
fi
|
||||
if [[ -n "$CERC_CONTAINER_EXTRA_BUILD_ARGS" ]]; then
|
||||
build_command_args="${build_command_args} ${CERC_CONTAINER_EXTRA_BUILD_ARGS}"
|
||||
fi
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build a local version of the task executor for act-runner
|
||||
docker build -t cerc/act-runner-task-executor:local -f ${CERC_REPO_BASE_DIR}/act_runner/Dockerfile.task-executor ${CERC_REPO_BASE_DIR}/act_runner
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/act-runner-task-executor:local -f ${CERC_REPO_BASE_DIR}/hosting/gitea/Dockerfile.task-executor ${build_command_args} ${CERC_REPO_BASE_DIR}/hosting
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
# Build a local version of the act-runner image
|
||||
docker build -t cerc/act-runner:local -f ${CERC_REPO_BASE_DIR}/act_runner/Dockerfile ${CERC_REPO_BASE_DIR}/act_runner
|
||||
# TODO: enhance the default build code path to cope with this container (repo has an _ which needs to be converted to - in the image tag)
|
||||
docker build -t cerc/act-runner:local -f ${CERC_REPO_BASE_DIR}/act_runner/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/act_runner
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,6 +29,9 @@ RUN \
|
||||
usermod -u ${CERC_HOST_UID} -g ${CERC_HOST_GID} ${USERNAME} && chown ${CERC_HOST_UID}:${CERC_HOST_GID} /home/${USERNAME}; \
|
||||
fi
|
||||
|
||||
# Prevents npm from printing version warnings
|
||||
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
|
||||
|
||||
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 \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# Usage: build-npm-package-local-dependencies.sh <registry-url> <publish-with-this-version>
|
||||
# Runs build-npm-package.sh after first fixing up yarn.lock to use a local
|
||||
# npm registry for all packages in a spcific scope (currently @cerc-io and @lirewine)
|
||||
# npm registry for all packages in a specific scope (currently @cerc-io, @lirewine and @muknsys)
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
@@ -18,7 +18,7 @@ set -e
|
||||
local_npm_registry_url=$1
|
||||
package_publish_version=$2
|
||||
# If we need to handle an additional scope, add it to the list below:
|
||||
npm_scopes_to_handle=("@cerc-io" "@lirewine")
|
||||
npm_scopes_to_handle=("@cerc-io" "@lirewine" "@muknsys")
|
||||
for npm_scope_for_local in ${npm_scopes_to_handle[@]}
|
||||
do
|
||||
# We need to configure the local registry
|
||||
|
||||
@@ -24,12 +24,22 @@ package_name=$( cat package.json | jq -r .name )
|
||||
local_npm_registry_url=$1
|
||||
npm config set @cerc-io:registry ${local_npm_registry_url}
|
||||
npm config set @lirewine:registry ${local_npm_registry_url}
|
||||
npm config set -- ${local_npm_registry_url}:_authToken ${CERC_NPM_AUTH_TOKEN}
|
||||
npm config set @muknsys:registry ${local_npm_registry_url}
|
||||
# Workaround bug in npm unpublish where it needs the url to be of the form //<foo> and not http://<foo>
|
||||
local_npm_registry_url_fixed=$( echo ${local_npm_registry_url} | sed -e 's/^http[s]\{0,1\}://')
|
||||
npm config set -- ${local_npm_registry_url_fixed}:_authToken ${CERC_NPM_AUTH_TOKEN}
|
||||
# First check if the version of this package we're trying to build already exists in the registry
|
||||
package_exists=$( yarn info --json ${package_name}@${package_publish_version} 2>/dev/null | jq -r .data.dist.tarball )
|
||||
if [[ ! -z "$package_exists" && "$package_exists" != "null" ]]; then
|
||||
echo "${package_publish_version} of ${package_name} already exists in the registry, skipping build"
|
||||
exit 0
|
||||
echo "${package_publish_version} of ${package_name} already exists in the registry"
|
||||
if [[ ${CERC_FORCE_REBUILD} == "true" ]]; then
|
||||
# Attempt to unpublish the existing package
|
||||
echo "NOTE: unpublishing existing package version since force rebuild is enabled"
|
||||
npm unpublish --force ${package_name}@${package_publish_version}
|
||||
else
|
||||
echo "skipping build since target version already exists"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
echo "Build and publish ${package_name} version ${package_publish_version}"
|
||||
yarn install
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/eth-probe
|
||||
docker build -t cerc/eth-probe:local ${CERC_REPO_BASE_DIR}/eth-probe
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/eth-probe:local ${build_command_args} ${CERC_REPO_BASE_DIR}/eth-probe
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/eth-statediff-fill-service
|
||||
docker build -t cerc/eth-statediff-fill-service:local ${CERC_REPO_BASE_DIR}/eth-statediff-fill-service
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/eth-statediff-fill-service:local ${build_command_args} ${CERC_REPO_BASE_DIR}/eth-statediff-fill-service
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/eth-statediff-service
|
||||
docker build -t cerc/eth-statediff-service:local ${CERC_REPO_BASE_DIR}/eth-statediff-service
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/eth-statediff-service:local ${build_command_args} ${CERC_REPO_BASE_DIR}/eth-statediff-service
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/fixturenet-eth-geth
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/fixturenet-eth-geth:local -f ${SCRIPT_DIR}/Dockerfile $SCRIPT_DIR
|
||||
docker build -t cerc/fixturenet-eth-geth:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/fixturenet-eth-lighthouse
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/fixturenet-eth-lighthouse:local -f ${SCRIPT_DIR}/Dockerfile $SCRIPT_DIR
|
||||
docker build -t cerc/fixturenet-eth-lighthouse:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build a local version of the foundry-rs/foundry image
|
||||
docker build -t cerc/foundry:local -f ${CERC_REPO_BASE_DIR}/foundry/Dockerfile-debian ${CERC_REPO_BASE_DIR}/foundry
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/foundry:local -f ${CERC_REPO_BASE_DIR}/foundry/Dockerfile-debian ${build_command_args} ${CERC_REPO_BASE_DIR}/foundry
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/go-ethereum-foundry
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/go-ethereum-foundry:local --build-arg GENESIS_FILE_PATH=genesis-automine.json ${SCRIPT_DIR}
|
||||
docker build -t cerc/go-ethereum-foundry:local --build-arg GENESIS_FILE_PATH=genesis-automine.json ${build_command_args} ${SCRIPT_DIR}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/go-ethereum
|
||||
docker build -t cerc/go-ethereum:local ${CERC_REPO_BASE_DIR}/go-ethereum
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/go-ethereum:local ${build_command_args} ${CERC_REPO_BASE_DIR}/go-ethereum
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/ipld-eth-beacon-db
|
||||
docker build -t cerc/ipld-eth-beacon-db:local ${CERC_REPO_BASE_DIR}/ipld-eth-beacon-db
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/ipld-eth-beacon-db:local ${build_command_args} ${build_command_args} ${CERC_REPO_BASE_DIR}/ipld-eth-beacon-db
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/ipld-eth-beacon-indexer
|
||||
docker build -t cerc/ipld-eth-beacon-indexer:local ${CERC_REPO_BASE_DIR}/ipld-eth-beacon-indexer
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/ipld-eth-beacon-indexer:local ${build_command_args} ${CERC_REPO_BASE_DIR}/ipld-eth-beacon-indexer
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/ipld-eth-db
|
||||
docker build -t cerc/ipld-eth-db:local ${CERC_REPO_BASE_DIR}/ipld-eth-db
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/ipld-eth-db:local ${build_command_args} ${CERC_REPO_BASE_DIR}/ipld-eth-db
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/ipld-eth-server
|
||||
docker build -t cerc/ipld-eth-server:local ${CERC_REPO_BASE_DIR}/ipld-eth-server
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/ipld-eth-server:local ${build_command_args} ${CERC_REPO_BASE_DIR}/ipld-eth-server
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
#
|
||||
#Build cerc/keycloack
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/keycloak:local ${SCRIPT_DIR}
|
||||
docker build -t cerc/keycloak:local ${build_command_args} ${SCRIPT_DIR}
|
||||
|
||||
@@ -12,6 +12,8 @@ ARG CERC_NPM_AUTH_TOKEN
|
||||
|
||||
# Add NPM global to PATH.
|
||||
ENV PATH=${NPM_GLOBAL}/bin:${PATH}
|
||||
# Prevents npm from printing version warnings
|
||||
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
|
||||
|
||||
RUN \
|
||||
# Configure global npm install location, use group to adapt to UID/GID changes
|
||||
|
||||
@@ -8,11 +8,11 @@ if [[ $# -ne 2 ]]; then
|
||||
fi
|
||||
config_file_name=$1
|
||||
webapp_files_dir=$2
|
||||
if ![[ -f ${config_file_name} ]]; then
|
||||
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
|
||||
if ! [[ -d ${webapp_files_dir} ]]; then
|
||||
echo "Webapp directory ${webapp_files_dir} does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/laconic-registry-cli
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# 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 \
|
||||
docker build -t cerc/laconic-console-host:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile \
|
||||
--add-host gitea.local:host-gateway \
|
||||
--build-arg CERC_NPM_AUTH_TOKEN --build-arg CERC_NPM_URL ${SCRIPT_DIR}
|
||||
|
||||
@@ -12,6 +12,8 @@ ARG CERC_NPM_AUTH_TOKEN
|
||||
|
||||
# Add NPM global to PATH.
|
||||
ENV PATH=${NPM_GLOBAL}/bin:${PATH}
|
||||
# Prevents npm from printing version warnings
|
||||
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
|
||||
|
||||
RUN \
|
||||
# Configure global npm install location, use group to adapt to UID/GID changes
|
||||
@@ -53,7 +55,9 @@ RUN yarn global add @cerc-io/laconic-registry-cli
|
||||
# Add scripts
|
||||
RUN mkdir /scripts
|
||||
ENV PATH="${PATH}:/scripts"
|
||||
COPY ./create-demo-records.sh /scripts
|
||||
COPY ./import-key.sh /scripts
|
||||
COPY ./import-address.sh /scripts
|
||||
|
||||
# Default command sleeps forever so docker doesn't kill it
|
||||
CMD ["sh", "-c", "while :; do sleep 600; done"]
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/laconic-registry-cli
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/laconic-registry-cli:local -f ${SCRIPT_DIR}/Dockerfile \
|
||||
docker build -t cerc/laconic-registry-cli:local ${build_command_args} -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,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# Create some demo/test records in the registry
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
registry_command="laconic cns"
|
||||
record_1_filename=demo-record-1.yml
|
||||
cat <<EOF > ${record_1_filename}
|
||||
record:
|
||||
type: WebsiteRegistrationRecord
|
||||
url: 'https://cerc.io'
|
||||
repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||
build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||
tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
||||
version: 1.0.23
|
||||
EOF
|
||||
# Check we have funds
|
||||
funds_response=$(${registry_command} account get --address $(cat my-address.txt))
|
||||
funds_balance=$(echo ${funds_response} | jq -r .[0].balance[0].quantity)
|
||||
echo "Balance is: ${funds_balance}"
|
||||
# Create a bond
|
||||
bond_create_result=$(${registry_command} bond create --type aphoton --quantity 1000000000)
|
||||
bond_id=$(echo ${bond_create_result} | jq -r .bondId)
|
||||
echo "Created bond with id: ${bond_id}"
|
||||
# Publish a demo record
|
||||
publish_response=$(${registry_command} record publish --filename ${record_1_filename} --bond-id ${bond_id})
|
||||
published_record_id=$(echo ${publish_response} | jq -r .id)
|
||||
echo "Published ${record_1_filename} with id: ${published_record_id}"
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
echo ${1} > my-address.txt
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/chiba-clonk
|
||||
docker build -t cerc/laconicd:local ${CERC_REPO_BASE_DIR}/laconicd
|
||||
# Build cerc/laconicd
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/laconicd:local ${build_command_args} ${CERC_REPO_BASE_DIR}/laconicd
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/lighthouse
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/lighthouse:local ${SCRIPT_DIR}
|
||||
docker build -t cerc/lighthouse:local ${build_command_args} ${SCRIPT_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,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/mobymask-ui
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/mobymask-ui:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/mobymask-ui
|
||||
docker build -t cerc/mobymask-ui:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/mobymask-ui
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FROM node:16.17.1-alpine3.16
|
||||
|
||||
RUN apk --update --no-cache add python3 alpine-sdk jq
|
||||
RUN apk --update --no-cache add python3 alpine-sdk jq bash
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/mobymask
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/mobymask:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/MobyMask
|
||||
docker build -t cerc/mobymask:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/MobyMask
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/optimism-contracts
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# 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
|
||||
docker build -t cerc/optimism-contracts:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/optimism
|
||||
|
||||
@@ -8,7 +8,7 @@ task('send-balance', 'Sends Ether to a specified Ethereum account')
|
||||
.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 provider = new ethers.providers.JsonRpcProvider(`${process.env.CERC_L1_RPC}`)
|
||||
const wallet = new ethers.Wallet(privateKey, provider)
|
||||
|
||||
// Send amount to the specified address
|
||||
@@ -16,7 +16,11 @@ task('send-balance', 'Sends Ether to a specified Ethereum account')
|
||||
to,
|
||||
value: ethers.utils.parseEther(amount),
|
||||
})
|
||||
const txReceipt = await tx.wait()
|
||||
|
||||
console.log(`Balance sent to: ${to}, from: ${wallet.address}`)
|
||||
console.log(
|
||||
`Block: { number: ${txReceipt.blockNumber}, hash: ${txReceipt.blockHash} }`
|
||||
)
|
||||
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.CERC_L1_RPC}`
|
||||
)
|
||||
|
||||
// Get the deployment tx receipt
|
||||
const receipt = await provider.getTransactionReceipt(transactionHash)
|
||||
if (
|
||||
receipt &&
|
||||
receipt.contractAddress &&
|
||||
receipt.contractAddress === contract
|
||||
) {
|
||||
console.log(
|
||||
`Deployment for contract ${contract} in transaction ${transactionHash} verified`
|
||||
)
|
||||
process.exit(0)
|
||||
} else {
|
||||
console.log(`Contract ${contract} deployment verification failed`)
|
||||
process.exit(1)
|
||||
}
|
||||
})
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/optimism-l2geth
|
||||
docker build -t cerc/optimism-l2geth:local ${CERC_REPO_BASE_DIR}/op-geth
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/optimism-l2geth:local ${build_command_args} ${CERC_REPO_BASE_DIR}/op-geth
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/optimism-op-batcher
|
||||
# TODO: use upstream Dockerfile once its buildx-specific content has been removed
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
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
|
||||
docker build -t cerc/optimism-op-batcher:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/optimism
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/optimism-op-node
|
||||
# TODO: use upstream Dockerfile once its buildx-specific content has been removed
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
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
|
||||
docker build -t cerc/optimism-op-node:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${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
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/react-peer
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/react-peer:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/react-peer
|
||||
docker build -t cerc/react-peer:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/react-peer
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/test-container
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
docker build -t cerc/test-container:local -f ${SCRIPT_DIR}/Dockerfile $SCRIPT_DIR
|
||||
docker build -t cerc/test-container:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/test-contract
|
||||
docker build -t cerc/test-contract:local --build-arg ETH_ADDR=http://go-ethereum:8545 ${CERC_REPO_BASE_DIR}/ipld-eth-db-validator/test/contract
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/test-contract:local --build-arg ETH_ADDR=http://go-ethereum:8545 ${build_command_args} ${CERC_REPO_BASE_DIR}/ipld-eth-db-validator/test/contract
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/tx-spammer
|
||||
docker build -t cerc/tx-spammer:local ${CERC_REPO_BASE_DIR}/tx-spammer
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/tx-spammer:local ${build_command_args} ${CERC_REPO_BASE_DIR}/tx-spammer
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/uniswap-v3-info
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/uniswap-v3-info:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/uniswap-v3-info
|
||||
docker build -t cerc/uniswap-v3-info:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/uniswap-v3-info
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/watcher-erc20
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/watcher-erc20:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/watcher-ts
|
||||
docker build -t cerc/watcher-erc20:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/watcher-ts
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/watcher-erc721
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/watcher-erc721:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/watcher-ts
|
||||
docker build -t cerc/watcher-erc721:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/watcher-ts
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/watcher-mobymask-v2
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/watcher-mobymask-v2:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/watcher-ts
|
||||
docker build -t cerc/watcher-mobymask-v2:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/watcher-ts
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/watcher-mobymask
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/watcher-mobymask:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/watcher-ts
|
||||
docker build -t cerc/watcher-mobymask:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/watcher-ts
|
||||
|
||||
# TODO: add a mechanism to pass two repos into a container rather than the parent directory
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/watcher-uniswap-v3
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/watcher-uniswap-v3:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/uniswap-watcher-ts
|
||||
docker build -t cerc/watcher-uniswap-v3:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/uniswap-watcher-ts
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# Usage: default-build.sh <image-tag> [<repo-relative-path>]
|
||||
# if <repo-relative-path> is not supplied, the context is the directory where the Dockerfile lives
|
||||
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
if [[ $# -ne 2 ]]; then
|
||||
echo "Illegal number of parameters" >&2
|
||||
exit 1
|
||||
fi
|
||||
image_tag=$1
|
||||
build_dir=$2
|
||||
echo "Building ${image_tag} in ${build_dir}"
|
||||
docker build -t ${image_tag} --build-arg CERC_HOST_UID=${CERC_HOST_UID} --build-arg CERC_HOST_GID=${CERC_HOST_GID} ${build_dir}
|
||||
docker build -t ${image_tag} ${build_command_args} --build-arg CERC_HOST_UID=${CERC_HOST_UID} --build-arg CERC_HOST_GID=${CERC_HOST_GID} ${build_dir}
|
||||
|
||||
@@ -15,7 +15,8 @@ watcher-erc20
|
||||
watcher-erc721
|
||||
watcher-uniswap-v3
|
||||
watcher-mobymask-v2
|
||||
mobymask-laconicd
|
||||
mobymask-app
|
||||
peer-test-app
|
||||
test
|
||||
eth-probe
|
||||
keycloak
|
||||
|
||||
@@ -12,10 +12,9 @@ To use a user-supplied registry set these environment variables:
|
||||
Leave `CERC_NPM_REGISTRY_URL` un-set to use the local gitea registry.
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
@@ -19,6 +19,7 @@ Detailed instructions can be found [here](../build-support/README.md). For the i
|
||||
```
|
||||
$ laconic-so --stack build-support build-containers --exclude cerc/builder-gerbil
|
||||
$ laconic-so --stack package-registry setup-repositories
|
||||
$ laconic-so --stack package-registry build-containers
|
||||
$ 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:
|
||||
@@ -48,3 +49,18 @@ $ laconic-so --stack fixturenet-laconicd deploy logs
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconicd deploy exec cli "laconic cns status"
|
||||
```
|
||||
## 7. View the laconic console
|
||||
Get the URL for the console web app with this command (the port number will be different for each deployment):
|
||||
```
|
||||
$ echo http://localhost:$(laconic-so --stack fixturenet-laconic-loaded deploy port laconic-console 80 | cut -d ':' -f 2)
|
||||
http://localhost:58364
|
||||
```
|
||||
Open that address with a browser. The console should display
|
||||
## 8. Load demo data into the registry
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconic-loaded deploy exec cli ./scripts/create-demo-records.sh
|
||||
Balance is: 99998999999999998999600000
|
||||
Created bond with id: dd88e8d6f9567b32b28e70552aea4419c5dd3307ebae85a284d1fe38904e301a
|
||||
Published demo-record-1.yml with id: bafyreierh3xnfivexlscdwubvczmddsnf46uytyfvrbdhkjzztvsz6ruly
|
||||
```
|
||||
The published record should be visible in the console.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version: "1.0"
|
||||
version: "1.1"
|
||||
name: fixturenet-laconic-loaded
|
||||
description: "A full featured laconic fixturenet"
|
||||
repos:
|
||||
@@ -28,3 +28,5 @@ pods:
|
||||
config:
|
||||
cli:
|
||||
key: laconicd.mykey
|
||||
address: laconicd.myaddress
|
||||
|
||||
|
||||
@@ -16,3 +16,4 @@ pods:
|
||||
config:
|
||||
cli:
|
||||
key: laconicd.mykey
|
||||
address: laconicd.myaddress
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
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:
|
||||
@@ -9,8 +11,7 @@ Clone required repositories:
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism setup-repositories
|
||||
|
||||
# Exclude cerc-io/go-ethereum repository if running L1 separately
|
||||
laconic-so --stack fixturenet-optimism setup-repositories --exclude cerc-io/go-ethereum
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
|
||||
```
|
||||
|
||||
Checkout to the required versions and branches in repos:
|
||||
@@ -25,9 +26,6 @@ Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism build-containers
|
||||
|
||||
# Only build containers required for L2 if running L1 separately
|
||||
laconic-so --stack fixturenet-optimism build-containers --include cerc/foundry,cerc/optimism-contracts,cerc/optimism-op-node,cerc/optimism-l2geth,cerc/optimism-op-batcher
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry:
|
||||
@@ -43,19 +41,10 @@ This should create the required docker images in the local image registry:
|
||||
|
||||
## Deploy
|
||||
|
||||
(Optional) Update the [l1-params.env](../../config/fixturenet-optimism/l1-params.env) file with L1 endpoint (`L1_RPC`, `L1_HOST` and `L1_PORT`) and other params if running L1 separately
|
||||
|
||||
* NOTE:
|
||||
* Stack Orchestrator needs to be run in [`dev`](/docs/CONTRIBUTING.md#install-developer-mode) mode to be able to edit the env file
|
||||
* If L1 is running on the host machine, use `host.docker.internal` as the hostname to access the host port
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism deploy up
|
||||
|
||||
# Only start fixturenet-optimism pod (L2) if running L1 separately
|
||||
laconic-so --stack fixturenet-optimism deploy up --include fixturenet-optimism
|
||||
```
|
||||
|
||||
The `fixturenet-optimism-contracts` service may take a while (`~15 mins`) to complete running as it:
|
||||
@@ -81,24 +70,51 @@ Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism deploy down
|
||||
|
||||
# If only ran fixturenet-optimism pod (L2)
|
||||
laconic-so --stack fixturenet-optimism deploy down --include fixturenet-optimism
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter name=laconic*
|
||||
docker volume ls -q --filter "name=.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter name=laconic*)
|
||||
docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data")
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
* If `op-geth` service aborts or is restarted, the following error might occur in the `op-node` service:
|
||||
|
||||
```bash
|
||||
WARN [02-16|21:22:02.868] Derivation process temporary error attempts=14 err="stage 0 failed resetting: temp: failed to find the L2 Heads to start from: failed to fetch L2 block by hash 0x0000000000000000000000000000000000000000000000000000000000000000: failed to determine block-hash of hash 0x0000000000000000000000000000000000000000000000000000000000000000, could not get payload: not found"
|
||||
```
|
||||
|
||||
* This means that the data directory that `op-geth` is using is corrupted and needs to be reinitialized; the containers `op-geth`, `op-node` and `op-batcher` need to be started afresh:
|
||||
* Stop and remove the concerned containers:
|
||||
|
||||
```bash
|
||||
# List the containers
|
||||
docker ps -f "name=op-geth|op-node|op-batcher"
|
||||
|
||||
# Force stop and remove the listed containers
|
||||
docker rm -f $(docker ps -qf "name=op-geth|op-node|op-batcher")
|
||||
```
|
||||
|
||||
* Remove the concerned volume:
|
||||
|
||||
```bash
|
||||
# List the volume
|
||||
docker volume ls -q --filter name=l2_geth_data
|
||||
|
||||
# Remove the listed volume
|
||||
docker volume rm $(docker volume ls -q --filter name=l2_geth_data)
|
||||
```
|
||||
|
||||
* Re-run the deployment command used in [Deploy](#deploy) to restart the stopped containers
|
||||
|
||||
## Known Issues
|
||||
|
||||
* Currently not supported:
|
||||
* Stopping and restarting the stack from where it left off; currently starts fresh on a restart
|
||||
* Resource requirements (memory + time) for building `cerc/foundry` image are on the higher side
|
||||
* `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,102 @@
|
||||
# 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
|
||||
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
Create and update an env file to be used in the next step ([defaults](../../config/fixturenet-optimism/l1-params.env)):
|
||||
|
||||
```bash
|
||||
# External L1 endpoint
|
||||
CERC_L1_CHAIN_ID=
|
||||
CERC_L1_RPC=
|
||||
CERC_L1_HOST=
|
||||
CERC_L1_PORT=
|
||||
|
||||
# Credentials for accounts on L1 to send balance to Optimism Proxy contract from
|
||||
# (enables them to do transactions on L2)
|
||||
CERC_L1_ADDRESS=
|
||||
CERC_L1_PRIV_KEY=
|
||||
CERC_L1_ADDRESS_2=
|
||||
CERC_L1_PRIV_KEY_2=
|
||||
```
|
||||
|
||||
* NOTE: 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 --include fixturenet-optimism --env-file <PATH_TO_ENV_FILE> 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 --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 --include fixturenet-optimism 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
|
||||
|
||||
See [Troubleshooting](./README.md#troubleshooting)
|
||||
@@ -1,6 +1,11 @@
|
||||
# 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 + web-app(s)) 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.
|
||||
|
||||
We also support running just the web-app(s), given external watcher GQL (for mobymask-app) and relay node endpoints. Follow [web-apps.md](./web-apps.md) for the same.
|
||||
|
||||
## Setup
|
||||
|
||||
@@ -18,7 +23,7 @@ Checkout to the required versions and branches in repos
|
||||
```bash
|
||||
# watcher-ts
|
||||
cd ~/cerc/watcher-ts
|
||||
git checkout v0.2.34
|
||||
git checkout v0.2.35
|
||||
|
||||
# react-peer
|
||||
cd ~/cerc/react-peer
|
||||
@@ -30,7 +35,7 @@ git checkout laconic
|
||||
|
||||
# MobyMask
|
||||
cd ~/cerc/MobyMask
|
||||
git checkout v0.1.1
|
||||
git checkout v0.1.2
|
||||
|
||||
# Optimism
|
||||
cd ~/cerc/optimism
|
||||
@@ -68,19 +73,9 @@ Deploy the stack:
|
||||
Find the watcher container's id and export it for later use:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system ps | grep "mobymask-watcher-server"
|
||||
|
||||
export CONTAINER_ID=<CONTAINER_ID>
|
||||
export CONTAINER_ID=$(docker ps -q --filter "name=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`
|
||||
|
||||
Run the peer tests:
|
||||
|
||||
```bash
|
||||
@@ -123,16 +118,12 @@ Stop all the services running in background run:
|
||||
laconic-so --stack mobymask-v2 deploy-system down
|
||||
```
|
||||
|
||||
Clear volumes:
|
||||
Clear volumes created by this stack:
|
||||
|
||||
* List all relevant volumes:
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*peers_ids|.*mobymask_deployment|.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data"
|
||||
|
||||
```bash
|
||||
docker volume ls -q --filter name=laconic*
|
||||
```
|
||||
|
||||
* Remove all the listed volumes:
|
||||
|
||||
```bash
|
||||
docker volume rm $(docker volume ls -q --filter name=laconic*)
|
||||
```
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*peers_ids|.*mobymask_deployment|.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data")
|
||||
```
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Get the root invite link URL for mobymask-app:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system logs mobymask
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
||||
```
|
||||
|
||||
The invite link is seen at the end of the logs. Example log:
|
||||
@@ -29,19 +29,11 @@
|
||||
|
||||
* 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
|
||||
laconic-so --stack mobymask-v2 deploy-system ps | grep mobymask-watcher-server
|
||||
```
|
||||
|
||||
* Check logs:
|
||||
|
||||
```bash
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-watcher-server")
|
||||
```
|
||||
|
||||
* It should have received the message, sent transaction to L2 chain and received a transaction receipt for an `invoke` message with block details.
|
||||
|
||||
@@ -74,7 +66,7 @@
|
||||
* Get the deployed contract address:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system exec mobymask-app "cat src/config.json"
|
||||
docker exec -it $(docker ps -aq --filter name="mobymask-app") cat src/config.json
|
||||
```
|
||||
|
||||
The value of `address` field is the deployed contract address
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
# 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
|
||||
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v2/)):
|
||||
|
||||
```bash
|
||||
# External L2 endpoints
|
||||
CERC_L2_GETH_RPC=
|
||||
CERC_L2_GETH_HOST=
|
||||
CERC_L2_GETH_PORT=
|
||||
|
||||
CERC_L2_NODE_HOST=
|
||||
CERC_L2_NODE_PORT=
|
||||
|
||||
# Credentials for accounts to perform txs on L2
|
||||
CERC_PRIVATE_KEY_DEPLOYER=
|
||||
CERC_PRIVATE_KEY_PEER=
|
||||
|
||||
# Base URI for mobymask-app
|
||||
# (used for generating a root invite link after deploying the contract)
|
||||
CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3002/#"
|
||||
|
||||
# (Optional) Set of relay peers to connect to from the relay node
|
||||
CERC_RELAY_PEERS=[]
|
||||
|
||||
# (Optional) Domain to be used in the relay node's announce address
|
||||
CERC_RELAY_ANNOUNCE_DOMAIN=
|
||||
|
||||
# Set to false for disabling watcher peer to send txs to L2
|
||||
CERC_ENABLE_PEER_L2_TXS=true
|
||||
|
||||
# (Optional) Set already deployed MobyMask contract address to avoid deploying contract in the stack
|
||||
CERC_DEPLOYED_CONTRACT=
|
||||
```
|
||||
|
||||
* NOTE: 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 --env-file <PATH_TO_ENV_FILE> 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>
|
||||
```
|
||||
|
||||
The watcher endpoint is exposed on host port `3001` and the relay node endpoint is exposed on host port `9090`
|
||||
|
||||
Check the logs of the deployment container to get the deployed contract's address and generated root invite link:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
See [Tests](./README.md#tests)
|
||||
|
||||
## Web Apps
|
||||
|
||||
For deploying the web-app(s) separately after deploying the watcher, follow [web-apps.md](./web-apps.md)
|
||||
|
||||
## 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|.*peers_ids|.*mobymask_deployment|.*fixturenet_geth_accounts"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*peers_ids|.*mobymask_deployment|.*fixturenet_geth_accounts")
|
||||
```
|
||||
@@ -27,3 +27,5 @@ pods:
|
||||
- fixturenet-eth
|
||||
- fixturenet-optimism
|
||||
- watcher-mobymask-v2
|
||||
- mobymask-app
|
||||
- peer-test-app
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
# 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
|
||||
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v2/mobymask-params.env)):
|
||||
|
||||
```bash
|
||||
# Set of relay nodes to be used by the web-app
|
||||
# (use double quotes " for strings)
|
||||
# Eg. CERC_RELAY_NODES=["/dns4/example.com/tcp/443/wss/p2p/12D3KooWGHmDDCc93XUWL16FMcTPCGu2zFaMkf67k8HZ4gdQbRDr"]
|
||||
CERC_RELAY_NODES=[]
|
||||
|
||||
# Also add if running MobyMask app:
|
||||
|
||||
# External watcher endpoint (to check if watcher is up)
|
||||
CERC_WATCHER_HOST=
|
||||
CERC_WATCHER_PORT=
|
||||
|
||||
# Watcher endpoint used by the app for GQL queries
|
||||
CERC_APP_WATCHER_URL="http://127.0.0.1:3001"
|
||||
|
||||
# Set deployed MobyMask contract address to be used in MobyMask app's config
|
||||
CERC_DEPLOYED_CONTRACT=
|
||||
|
||||
# L2 Chain ID used by mobymask web-app for L2 txs
|
||||
CERC_CHAIN_ID=42069
|
||||
```
|
||||
|
||||
* NOTE: 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 --env-file <PATH_TO_ENV_FILE> up
|
||||
|
||||
# Runs on host port 3002
|
||||
```
|
||||
|
||||
For running peer-test-app
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --include peer-test-app --env-file <PATH_TO_ENV_FILE> up
|
||||
|
||||
# Runs on host port 3003
|
||||
```
|
||||
|
||||
To list down and monitor the running containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --include [mobymask-app | peer-test-app] ps
|
||||
|
||||
docker ps
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
## Demo
|
||||
|
||||
Follow the [demo](./demo.md) to try out the MobyMask app with L2 chain
|
||||
|
||||
## 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|.*peers_ids"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_deployment|.*peers_ids")
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user