Compare commits

..
Author SHA1 Message Date
dboreham cb72e5c03f Simple implementation of LACONIC_HOSTED_ENDPOINT (#342)
Former-commit-id: 172300d7bd
2023-04-17 20:46:05 -06:00
dboreham c7a4d3f4e7 Default token needs to be empty string (#341)
Former-commit-id: 99aa1fa27e
2023-04-17 13:53:16 -06:00
dboreham c715e11a88 Use CERC_NPM_REGISTRY_URL everywhere (#340)
Former-commit-id: 39a54bc62a
2023-04-17 13:40:49 -06:00
dboreham 7673de73bb Add github actions
Former-commit-id: fcbea7984f
2023-04-17 13:11:45 -06:00
dboreham f537cdbe29 Add note on developer-mode-setup script
Former-commit-id: e4b57b5815
2023-04-17 10:06:25 -06:00
Zach 09bca48498 Merge pull request #337 from cerc-io/zramsay-patch-1
docs: add missing step
Former-commit-id: 24174807c8
2023-04-17 11:28:29 -04:00
Zach ecb3b36387 Update README.md
Former-commit-id: dd59579b87
2023-04-17 11:25:21 -04:00
dboreham 5a50e46718 Support for complete laconic stack with console and test registration record (#335)
* Configure cli with necessary gas and fees args and address

* Update version

Former-commit-id: 0068a994f6
2023-04-16 20:14:15 -06:00
dboreham 99af105b9c quiet npm version warning (#331)
Former-commit-id: 2eb93d0933
2023-04-14 21:09:22 -06:00
dboreham bfa86cbc29 Add doc for setup-repositories
Former-commit-id: d464c1c547
2023-04-14 17:51:22 -06:00
dboreham 332085f80b Add force rebuild option (#329)
Former-commit-id: 1443c6c6d2
2023-04-14 14:19:27 -06:00
Zach 7406189596 Merge pull request #326 from cerc-io/typos
typos

Former-commit-id: 4e3eba1194
2023-04-13 12:32:33 -04:00
zramsay f0ce0fef1c typos
Former-commit-id: 16c9607a6c
2023-04-13 12:31:53 -04:00
prathamesh0 3e80f5f238 Wait for transfer tx receipts when configuring Optimism (#323)
Former-commit-id: c99fc0941a
2023-04-13 12:43:41 +05:30
dboreham 13499c6e4b Add MuKnSys npm scope (#322)
Former-commit-id: 6b27731a81
2023-04-12 19:46:50 -06:00
dboreham 6e343bec5a Build with hosting config file (#321)
Former-commit-id: bb9c0706c3
2023-04-12 19:39:37 -06:00
prathamesh0 8b11070870 Configuration fixes for mobymask-v2 stack for multiple deployments (#318)
* Fix contract deployment script in fixturenet-optimism stack

* Configure relay node's announce domain from env

* Configure relay peers list for the relay node from env

* Create and use peer ids from a mounted volume

* Fix command to create watcher config

* Fix mobymask-app deployment script

Former-commit-id: 882f0b16aa
2023-04-12 18:17:13 +05:30
dboreham 5c6fe825fc Add comment to spec doc
Former-commit-id: 249893f5d9
2023-04-12 06:32:40 -06:00
telackey 80c16d2ced Update for latest act_runner. (#316)
Former-commit-id: c7c3cbde8e
2023-04-11 15:05:08 -05:00
dboreham 6e33bd47e2 Fix syntax errors (#314)
Former-commit-id: 7c6c46febb
2023-04-11 07:20:38 -06:00
prathamesh0 c2a3ffe0dd Add an option to pass env file to deploy command (#304)
* Add an option to pass env file to deploy command

* Use env variable mapping in fixturenet-optimism stack

* Use default values from checked in env files

* Use env variable mapping in mobymask-v2 stack

* Update instructions

* Add extra hosts in app compose files and update instructions

* Add CERC prefix to env variables in fixturenet-optimism stack

* Add CERC prefix to env variables in mobymask-v2 stack

Former-commit-id: 6b62247ef7
2023-04-11 16:21:03 +05:30
dboreham ffc24c0be8 Edit readme to trigger CI
Former-commit-id: 9a4b5810af
2023-04-10 14:39:28 -06:00
dboreham 7021f8ed19 Add call to build tag script
Former-commit-id: 440b146e80
2023-04-10 12:17:54 -06:00
dboreham 2e747b17be Publish test workflow (#308)
Former-commit-id: a16b1cd073
2023-04-10 11:50:09 -06:00
94 changed files with 747 additions and 234 deletions
-1
View File
@@ -44,4 +44,3 @@ jobs:
# Hack using endsWith to workaround Gitea sometimes sending "publish-test" vs "refs/heads/publish-test" # Hack using endsWith to workaround Gitea sometimes sending "publish-test" vs "refs/heads/publish-test"
draft: ${{ endsWith('publish-test', github.ref ) }} draft: ${{ endsWith('publish-test', github.ref ) }}
files: ./laconic-so files: ./laconic-so
+2
View File
@@ -21,6 +21,8 @@ jobs:
run: python3 --version run: python3 --version
- name: "Install shiv" - name: "Install shiv"
run: pip install shiv run: pip install shiv
- name: "Generate build version file"
run: ./scripts/create_build_tag_file.sh
- name: "Build local shiv package" - name: "Build local shiv package"
run: ./scripts/build_shiv_package.sh run: ./scripts/build_shiv_package.sh
- name: "Run smoke tests" - name: "Run smoke tests"
+46
View File
@@ -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
+29
View File
@@ -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
View File
@@ -5,4 +5,4 @@ laconic-so
laconic_stack_orchestrator.egg-info laconic_stack_orchestrator.egg-info
__pycache__ __pycache__
*~ *~
build
+1
View File
@@ -96,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). Native aarm64 is _not_ currently supported. x64 emulation on ARM64 macos should work (not yet tested).
+10 -3
View File
@@ -36,13 +36,16 @@ from .util import include_exclude_check, get_parsed_stack_config
@click.command() @click.command()
@click.option('--include', help="only build these containers") @click.option('--include', help="only build these containers")
@click.option('--exclude', help="don\'t 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 @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''' '''build the set of containers required for a complete stack'''
quiet = ctx.obj.quiet quiet = ctx.obj.quiet
verbose = ctx.obj.verbose verbose = ctx.obj.verbose
dry_run = ctx.obj.dry_run dry_run = ctx.obj.dry_run
debug = ctx.obj.debug
local_stack = ctx.obj.local_stack local_stack = ctx.obj.local_stack
stack = ctx.obj.stack stack = ctx.obj.stack
continue_on_error = ctx.obj.continue_on_error continue_on_error = ctx.obj.continue_on_error
@@ -81,13 +84,17 @@ def command(ctx, include, exclude):
# TODO: make this configurable # TODO: make this configurable
container_build_env = { container_build_env = {
"CERC_NPM_URL": "http://gitea.local:3000/api/packages/cerc-io/npm/", "CERC_NPM_REGISTRY_URL": config("CERC_NPM_REGISTRY_URL", default="http://gitea.local:3000/api/packages/cerc-io/npm/"),
"CERC_NPM_AUTH_TOKEN": config("CERC_NPM_AUTH_TOKEN", default="<token-not-supplied>"), "CERC_NPM_AUTH_TOKEN": config("CERC_NPM_AUTH_TOKEN", default=""),
"CERC_REPO_BASE_DIR": dev_root_path, "CERC_REPO_BASE_DIR": dev_root_path,
"CERC_CONTAINER_BASE_DIR": container_build_dir,
"CERC_HOST_UID": f"{os.getuid()}", "CERC_HOST_UID": f"{os.getuid()}",
"CERC_HOST_GID": f"{os.getgid()}", "CERC_HOST_GID": f"{os.getgid()}",
"DOCKER_BUILDKIT": "0" "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): def process_container(container):
if not quiet: if not quiet:
+8 -2
View File
@@ -33,8 +33,10 @@ builder_js_image_name = "cerc/builder-js:local"
@click.command() @click.command()
@click.option('--include', help="only build these packages") @click.option('--include', help="only build these packages")
@click.option('--exclude', help="don\'t 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 @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''' '''build the set of npm packages required for a complete stack'''
quiet = ctx.obj.quiet quiet = ctx.obj.quiet
@@ -119,8 +121,12 @@ def command(ctx, include, exclude):
# Originally we used the PEP 584 merge operator: # Originally we used the PEP 584 merge operator:
# envs = {"CERC_NPM_AUTH_TOKEN": npm_registry_url_token} | ({"CERC_SCRIPT_DEBUG": "true"} if debug else {}) # 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: # 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_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: try:
docker.run(builder_js_image_name, docker.run(builder_js_image_name,
remove=True, remove=True,
@@ -2,5 +2,7 @@ services:
laconic-console: laconic-console:
restart: unless-stopped restart: unless-stopped
image: cerc/laconic-console-host:local image: cerc/laconic-console-host:local
environment:
- LACONIC_HOSTED_ENDPOINT=${LACONIC_HOSTED_ENDPOINT:-http://localhost}
ports: ports:
- "80" - "80"
@@ -8,6 +8,7 @@ services:
# TODO: look at folding these scripts into the container # 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/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-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 # TODO: determine which of the ports below is really needed
ports: ports:
- "6060" - "6060"
@@ -9,9 +9,17 @@ services:
image: cerc/optimism-contracts:local image: cerc/optimism-contracts:local
env_file: env_file:
- ../config/fixturenet-optimism/l1-params.env - ../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 # Waits for L1 endpoint to be up before running the script
command: | 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: volumes:
- ../config/wait-for-it.sh:/app/packages/contracts-bedrock/wait-for-it.sh - ../config/wait-for-it.sh:/app/packages/contracts-bedrock/wait-for-it.sh
- ../container-build/cerc-optimism-contracts/hardhat-tasks/verify-contract-deployment.ts:/app/packages/contracts-bedrock/tasks/verify-contract-deployment.ts - ../container-build/cerc-optimism-contracts/hardhat-tasks/verify-contract-deployment.ts:/app/packages/contracts-bedrock/tasks/verify-contract-deployment.ts
@@ -33,6 +41,9 @@ services:
condition: service_completed_successfully condition: service_completed_successfully
env_file: env_file:
- ../config/fixturenet-optimism/l1-params.env - ../config/fixturenet-optimism/l1-params.env
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_L1_RPC: ${CERC_L1_RPC}
volumes: volumes:
- ../config/fixturenet-optimism/generate-l2-config.sh:/app/generate-l2-config.sh - ../config/fixturenet-optimism/generate-l2-config.sh:/app/generate-l2-config.sh
- l1_deployment:/contracts-bedrock:ro - l1_deployment:/contracts-bedrock:ro
@@ -65,12 +76,15 @@ services:
# Runs the L2 consensus client (Sequencer node) # Runs the L2 consensus client (Sequencer node)
op-node: op-node:
env_file: image: cerc/optimism-op-node:local
- ../config/fixturenet-optimism/l1-params.env
depends_on: depends_on:
op-geth: op-geth:
condition: service_healthy 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: volumes:
- ../config/fixturenet-optimism/run-op-node.sh:/app/run-op-node.sh - ../config/fixturenet-optimism/run-op-node.sh:/app/run-op-node.sh
- l2_config:/op-node-data:ro - l2_config:/op-node-data:ro
@@ -89,14 +103,17 @@ services:
# Runs the batcher (takes transactions from the Sequencer and publishes them to L1) # Runs the batcher (takes transactions from the Sequencer and publishes them to L1)
op-batcher: op-batcher:
env_file: image: cerc/optimism-op-batcher:local
- ../config/fixturenet-optimism/l1-params.env
depends_on: depends_on:
op-node: op-node:
condition: service_healthy condition: service_healthy
op-geth: op-geth:
condition: service_healthy 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: volumes:
- ../config/wait-for-it.sh:/wait-for-it.sh - ../config/wait-for-it.sh:/wait-for-it.sh
- ../config/fixturenet-optimism/run-op-batcher.sh:/run-op-batcher.sh - ../config/fixturenet-optimism/run-op-batcher.sh:/run-op-batcher.sh
@@ -104,7 +121,7 @@ services:
entrypoint: ["sh", "-c"] entrypoint: ["sh", "-c"]
# Waits for L1 endpoint to be up before running the batcher # Waits for L1 endpoint to be up before running the batcher
command: | 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: extra_hosts:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"
@@ -6,16 +6,23 @@ services:
image: cerc/mobymask-ui:local image: cerc/mobymask-ui:local
env_file: env_file:
- ../config/watcher-mobymask-v2/mobymask-params.env - ../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 # Waits for watcher server to be up before app build
# Required when running with watcher stack to get deployed contract address # Required when running with watcher stack to get deployed contract address
command: command:
- sh - sh
- -c - -c
- ./wait-for-it.sh -h $${WATCHER_HOST} -p $${WATCHER_PORT} -s -t 0 -- ./mobymask-app-start.sh - ./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: volumes:
- ../config/wait-for-it.sh:/app/wait-for-it.sh - ../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-config.json:/app/src/mobymask-app-config.json
- ../config/watcher-mobymask-v2/mobymask-app-start.sh:/app/mobymask-app-start.sh - ../config/watcher-mobymask-v2/mobymask-app-start.sh:/app/mobymask-app-start.sh
- peers_ids:/peers
- mobymask_deployment:/server - mobymask_deployment:/server
ports: ports:
- "0.0.0.0:3002:3000" - "0.0.0.0:3002:3000"
@@ -26,6 +33,9 @@ services:
retries: 15 retries: 15
start_period: 10s start_period: 10s
shm_size: '1GB' shm_size: '1GB'
extra_hosts:
- "host.docker.internal:host-gateway"
volumes: volumes:
mobymask_deployment: mobymask_deployment:
peers_ids:
@@ -7,10 +7,14 @@ services:
working_dir: /app/packages/test-app working_dir: /app/packages/test-app
env_file: env_file:
- ../config/watcher-mobymask-v2/mobymask-params.env - ../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"] command: ["sh", "./test-app-start.sh"]
volumes: volumes:
- ../config/watcher-mobymask-v2/test-app-config.json:/app/packages/test-app/src/test-app-config.json - ../config/watcher-mobymask-v2/test-app-config.json:/app/packages/test-app/src/test-app-config.json
- ../config/watcher-mobymask-v2/test-app-start.sh:/app/packages/test-app/test-app-start.sh - ../config/watcher-mobymask-v2/test-app-start.sh:/app/packages/test-app/test-app-start.sh
- peers_ids:/peers
ports: ports:
- "0.0.0.0:3003:3000" - "0.0.0.0:3003:3000"
healthcheck: healthcheck:
@@ -19,3 +23,8 @@ services:
timeout: 5s timeout: 5s
retries: 15 retries: 15
start_period: 10s start_period: 10s
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
peers_ids:
@@ -22,8 +22,8 @@ services:
retries: 15 retries: 15
start_period: 10s start_period: 10s
# Deploys MobyMask contract and generates an invite link # Deploys the MobyMask contract and generates an invite link
# Deployment is skipped if DEPLOYED_CONTRACT env is already set # Deployment is skipped if CERC_DEPLOYED_CONTRACT env is set
mobymask: mobymask:
image: cerc/mobymask:local image: cerc/mobymask:local
working_dir: /app/packages/server working_dir: /app/packages/server
@@ -31,14 +31,19 @@ services:
- ../config/watcher-mobymask-v2/optimism-params.env - ../config/watcher-mobymask-v2/optimism-params.env
- ../config/watcher-mobymask-v2/mobymask-params.env - ../config/watcher-mobymask-v2/mobymask-params.env
environment: environment:
- ENV=PROD 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 # Waits for L2 Optimism Geth and Node servers to be up before deploying contract
command: command:
- sh - sh
- -c - -c
- | - |
./wait-for-it.sh -h $${L2_GETH_HOST} -p $${L2_GETH_PORT} -s -t 0 && \ ./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 $${L2_NODE_HOST} -p $${L2_NODE_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 ./deploy-and-generate-invite.sh
volumes: volumes:
- ../config/wait-for-it.sh:/app/packages/server/wait-for-it.sh - ../config/wait-for-it.sh:/app/packages/server/wait-for-it.sh
@@ -51,23 +56,29 @@ services:
# Starts the mobymask-v2-watcher server # Starts the mobymask-v2-watcher server
mobymask-watcher-server: mobymask-watcher-server:
image: cerc/watcher-mobymask-v2:local
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
mobymask-watcher-db: mobymask-watcher-db:
condition: service_healthy condition: service_healthy
mobymask: mobymask:
condition: service_completed_successfully condition: service_completed_successfully
image: cerc/watcher-mobymask-v2:local
env_file: env_file:
- ../config/watcher-mobymask-v2/optimism-params.env - ../config/watcher-mobymask-v2/optimism-params.env
- ../config/watcher-mobymask-v2/mobymask-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"] command: ["sh", "start-server.sh"]
volumes: volumes:
- ../config/watcher-mobymask-v2/watcher-config-template.toml:/app/packages/mobymask-v2-watcher/environments/watcher-config-template.toml - ../config/watcher-mobymask-v2/watcher-config-template.toml:/app/packages/mobymask-v2-watcher/environments/watcher-config-template.toml
- ../config/watcher-mobymask-v2/peer.env:/app/packages/peer/.env
- ../config/watcher-mobymask-v2/relay-id.json:/app/packages/mobymask-v2-watcher/relay-id.json
- ../config/watcher-mobymask-v2/peer-id.json:/app/packages/mobymask-v2-watcher/peer-id.json
- ../config/watcher-mobymask-v2/start-server.sh:/app/packages/mobymask-v2-watcher/start-server.sh - ../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 - mobymask_deployment:/server
- fixturenet_geth_accounts:/geth-accounts:ro - fixturenet_geth_accounts:/geth-accounts:ro
# Expose GQL, metrics and relay node ports # Expose GQL, metrics and relay node ports
@@ -86,5 +97,6 @@ services:
volumes: volumes:
mobymask_watcher_db_data: mobymask_watcher_db_data:
peers_ids:
mobymask_deployment: mobymask_deployment:
fixturenet_geth_accounts: 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 userKey: REPLACE_WITH_MYKEY
bondId: bondId:
chainId: laconic_9000-1 chainId: laconic_9000-1
gas: 250000
fees: 200000aphoton
@@ -4,6 +4,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
# Check existing config if it exists # Check existing config if it exists
if [ -f /app/jwt.txt ] && [ -f /app/rollup.json ]; then if [ -f /app/jwt.txt ] && [ -f /app/rollup.json ]; then
echo "Found existing L2 config, cross-checking with L1 deployment config" echo "Found existing L2 config, cross-checking with L1 deployment config"
@@ -30,6 +32,6 @@ op-node genesis l2 \
--deployment-dir /contracts-bedrock/deployments/getting-started/ \ --deployment-dir /contracts-bedrock/deployments/getting-started/ \
--outfile.l2 /app/genesis.json \ --outfile.l2 /app/genesis.json \
--outfile.rollup /app/rollup.json \ --outfile.rollup /app/rollup.json \
--l1-rpc $L1_RPC --l1-rpc $CERC_L1_RPC
openssl rand -hex 32 > /app/jwt.txt openssl rand -hex 32 > /app/jwt.txt
@@ -1,14 +1,14 @@
# Change if pointing to an external L1 endpoint # Defaults
# L1 endpoint # L1 endpoint
L1_CHAIN_ID=1212 DEFAULT_CERC_L1_CHAIN_ID=1212
L1_RPC="http://fixturenet-eth-geth-1:8545" DEFAULT_CERC_L1_RPC="http://fixturenet-eth-geth-1:8545"
L1_HOST="fixturenet-eth-geth-1" DEFAULT_CERC_L1_HOST="fixturenet-eth-geth-1"
L1_PORT=8545 DEFAULT_CERC_L1_PORT=8545
# Credentials for accounts on L1 to send balance to Optimism Proxy contract from # Credentials for accounts on L1 to send balance to Optimism Proxy contract from
# (enables them to do transactions on L2) # (enables them to do transactions on L2)
L1_ADDRESS= DEFAULT_CERC_L1_ADDRESS=
L1_PRIV_KEY= DEFAULT_CERC_L1_PRIV_KEY=
L1_ADDRESS_2= DEFAULT_CERC_L1_ADDRESS_2=
L1_PRIV_KEY_2= DEFAULT_CERC_L1_PRIV_KEY_2=
@@ -4,7 +4,15 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
echo "Using L1 RPC endpoint ${L1_RPC}" CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_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}}"
echo "Using L1 RPC endpoint ${CERC_L1_RPC}"
IMPORT_1="import './verify-contract-deployment'" IMPORT_1="import './verify-contract-deployment'"
IMPORT_2="import './rekey-json'" IMPORT_2="import './rekey-json'"
@@ -18,7 +26,7 @@ if ! grep -Fxq "$IMPORT_1" tasks/index.ts; then
fi fi
# Update the chainId in the hardhat config # Update the chainId in the hardhat config
sed -i "/getting-started/ {n; s/.*chainId.*/ chainId: $L1_CHAIN_ID,/}" hardhat.config.ts sed -i "/getting-started/ {n; s/.*chainId.*/ chainId: $CERC_L1_CHAIN_ID,/}" hardhat.config.ts
# Exit if a deployment already exists (on restarts) # Exit if a deployment already exists (on restarts)
# Note: fixturenet-eth-geth currently starts fresh on a restart # Note: fixturenet-eth-geth currently starts fresh on a restart
@@ -57,16 +65,16 @@ SEQUENCER_ADDRESS=$(echo "$KEYS_JSON" | jq -r '.Sequencer.address')
# Read the private key of L1 accounts # Read the private key of L1 accounts
if [ -f /geth-accounts/accounts.csv ]; then if [ -f /geth-accounts/accounts.csv ]; then
echo "Using L1 account credentials from the mounted volume" echo "Using L1 account credentials from the mounted volume"
L1_ADDRESS=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 2) CERC_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) CERC_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) CERC_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_PRIV_KEY_2=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv)
else else
echo "Using L1 account credentials from env" echo "Using L1 account credentials from env"
fi fi
# Select a finalized L1 block as the starting point for roll ups # 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" echo "Waiting for a finalized L1 block to exist, retrying after 10s"
sleep 10 sleep 10
done done
@@ -78,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" echo "Selected L1 block ${L1_BLOCKNUMBER} as the starting block for roll ups"
# Send balances to the above L2 addresses # 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 "${ADMIN_ADDRESS}" --amount 2 --private-key "${CERC_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 "${PROPOSER_ADDRESS}" --amount 5 --private-key "${CERC_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 "${BATCHER_ADDRESS}" --amount 1000 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
echo "Balances sent to L2 accounts" echo "Balances sent to L2 accounts"
# Update the deployment config # Update the deployment config
sed -i 's/"l2OutputOracleStartingTimestamp": TIMESTAMP/"l2OutputOracleStartingTimestamp": '"$L1_BLOCKTIMESTAMP"'/g' deploy-config/getting-started.json 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" node update-config.js deploy-config/getting-started.json "$ADMIN_ADDRESS" "$PROPOSER_ADDRESS" "$BATCHER_ADDRESS" "$SEQUENCER_ADDRESS" "$L1_BLOCKHASH"
echo "Updated the deployment config" echo "Updated the deployment config"
# Create a .env file # 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 "PRIVATE_KEY_DEPLOYER=$ADMIN_PRIV_KEY" >> .env
echo "Deploying the L1 smart contracts, this will take a while..." echo "Deploying the L1 smart contracts, this will take a while..."
@@ -109,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 # Send balance to the above Proxy contract in L1 for reflecting balance in L2
# First account # 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 # 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 "Balance sent to Proxy L2 contract"
echo "Use following accounts for transactions in L2:" echo "Use following accounts for transactions in L2:"
echo "${L1_ADDRESS}" echo "${CERC_L1_ADDRESS}"
echo "${L1_ADDRESS_2}" echo "${CERC_L1_ADDRESS_2}"
echo "Done" echo "Done"
@@ -4,6 +4,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
# Get BACTHER_KEY from keys.json # Get BACTHER_KEY from keys.json
BATCHER_KEY=$(jq -r '.Batcher.privateKey' /l2-accounts/keys.json | tr -d '"') BATCHER_KEY=$(jq -r '.Batcher.privateKey' /l2-accounts/keys.json | tr -d '"')
@@ -20,5 +22,5 @@ op-batcher \
--rpc.enable-admin \ --rpc.enable-admin \
--max-channel-duration=1 \ --max-channel-duration=1 \
--target-l1-tx-size-bytes=2048 \ --target-l1-tx-size-bytes=2048 \
--l1-eth-rpc=$L1_RPC \ --l1-eth-rpc=$CERC_L1_RPC \
--private-key=$BATCHER_KEY --private-key=$BATCHER_KEY
@@ -4,6 +4,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
# Get SEQUENCER KEY from keys.json # Get SEQUENCER KEY from keys.json
SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"') SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')
@@ -19,5 +21,5 @@ op-node \
--p2p.disable \ --p2p.disable \
--rpc.enable-admin \ --rpc.enable-admin \
--p2p.sequencer.key=$SEQUENCER_KEY \ --p2p.sequencer.key=$SEQUENCER_KEY \
--l1=$L1_RPC \ --l1=$CERC_L1_RPC \
--l1.rpckind=any --l1.rpckind=any
@@ -4,30 +4,36 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
echo "Using L2 RPC endpoint ${L2_GETH_RPC}" 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 if [ -f /geth-accounts/accounts.csv ]; then
echo "Using L1 private key from the mounted volume" echo "Using L1 private key from the mounted volume"
# Read the private key of L1 account to deploy contract # Read the private key of L1 account to deploy contract
PRIVATE_KEY_DEPLOYER=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3) CERC_PRIVATE_KEY_DEPLOYER=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3)
else else
echo "Using PRIVATE_KEY_DEPLOYER from env" echo "Using CERC_PRIVATE_KEY_DEPLOYER from env"
fi fi
# Set the private key # Set the private key
jq --arg privateKey "$PRIVATE_KEY_DEPLOYER" '.privateKey = $privateKey' secrets-template.json > secrets.json jq --arg privateKey "$CERC_PRIVATE_KEY_DEPLOYER" '.privateKey = $privateKey' secrets-template.json > secrets.json
# Set the RPC URL # Set the RPC URL
jq --arg rpcUrl "$L2_GETH_RPC" '.rpcUrl = $rpcUrl' secrets.json > secrets_updated.json && mv secrets_updated.json secrets.json 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 # Set the MobyMask app base URI
jq --arg baseURI "$MOBYMASK_APP_BASE_URI" '.baseURI = $baseURI' secrets.json > secrets_updated.json && mv secrets_updated.json secrets.json jq --arg baseURI "$CERC_MOBYMASK_APP_BASE_URI" '.baseURI = $baseURI' secrets.json > secrets_updated.json && mv secrets_updated.json secrets.json
export RPC_URL="${L2_GETH_RPC}" export RPC_URL="${CERC_L2_GETH_RPC}"
# Check if DEPLOYED_CONTRACT environment variable set to skip contract deployment # Check if CERC_DEPLOYED_CONTRACT environment variable set to skip contract deployment
if [[ -n "$DEPLOYED_CONTRACT" ]]; then if [ -n "$CERC_DEPLOYED_CONTRACT" ]; then
echo "DEPLOYED_CONTRACT is set to '$DEPLOYED_CONTRACT'" echo "CERC_DEPLOYED_CONTRACT is set to '$CERC_DEPLOYED_CONTRACT'"
echo "Exiting without deploying contract" echo "Exiting without deploying contract"
exit 0 exit 0
fi fi
@@ -53,7 +59,7 @@ fi
# Wait until balance for deployer account is updated # Wait until balance for deployer account is updated
cd ../hardhat cd ../hardhat
while true; do while true; do
ACCOUNT_BALANCE=$(yarn balance --network optimism "$PRIVATE_KEY_DEPLOYER" | grep ETH) ACCOUNT_BALANCE=$(yarn balance --network optimism "$CERC_PRIVATE_KEY_DEPLOYER" | grep ETH)
if [ "$ACCOUNT_BALANCE" != "0.0 ETH" ]; then if [ "$ACCOUNT_BALANCE" != "0.0 ETH" ]; then
echo "Account balance updated: $ACCOUNT_BALANCE" echo "Account balance updated: $ACCOUNT_BALANCE"
@@ -1,8 +1,6 @@
{ {
"name": "MobyMask", "name": "MobyMask",
"relayNodes": [ "relayNodes": [],
"/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"
],
"peer": { "peer": {
"enableDebugInfo": true "enableDebugInfo": true
} }
@@ -4,22 +4,37 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
# Use config from mounted volume if available (when running web-app along with watcher stack) CERC_CHAIN_ID="${CERC_CHAIN_ID:-${DEFAULT_CERC_CHAIN_ID}}"
if [ -f /server/config.json ]; then CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}"
echo "Merging config for deployed contract from mounted volume" CERC_RELAY_NODES="${CERC_RELAY_NODES:-${DEFAULT_CERC_RELAY_NODES}}"
# Merging config files to get deployed contract address CERC_APP_WATCHER_URL="${CERC_APP_WATCHER_URL:-${DEFAULT_CERC_APP_WATCHER_URL}}"
jq -s '.[0] * .[1]' /app/src/mobymask-app-config.json /server/config.json > /app/src/config.json
else
echo "Setting deployed contract details from env"
# Set config values from environment variables # If not set (or []), check the mounted volume for relay peer id
jq --arg address "$DEPLOYED_CONTRACT" \ if [ -z "$CERC_RELAY_NODES" ] || [ "$CERC_RELAY_NODES" = "[]" ]; then
--argjson chainId $CHAIN_ID \ echo "CERC_RELAY_NODES not provided, taking from the mounted volume"
--argjson relayNodes "$RELAY_NODES" \ CERC_RELAY_NODES="[\"/ip4/127.0.0.1/tcp/9090/ws/p2p/$(jq -r '.id' /peers/relay-id.json)\"]"
'.address = $address | .chainId = $chainId | .relayNodes = $relayNodes' \
/app/src/mobymask-app-config.json > /app/src/config.json
fi fi
REACT_APP_WATCHER_URI="$APP_WATCHER_URL/graphql" npm run build 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 serve -s build
@@ -1,20 +1,28 @@
# Change if pointing web app to external watcher endpoint # Defaults
WATCHER_HOST="mobymask-watcher-server"
WATCHER_PORT=3001 # Watcher endpoint
APP_WATCHER_URL="http://localhost:3001" 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) # Base URI for mobymask-app (used for generating invite)
MOBYMASK_APP_BASE_URI="http://127.0.0.1:3002/#" DEFAULT_CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3002/#"
# Set to false for disabling watcher peer to send txs to L2 # Set to false for disabling watcher peer to send txs to L2
ENABLE_PEER_L2_TXS=true DEFAULT_CERC_ENABLE_PEER_L2_TXS=true
# Set deployed MobyMask contract address to avoid deploying contract in stack # Set deployed MobyMask contract address to avoid deploying contract in stack
# mobymask-app will use this contract address in config if run separately # mobymask-app will use this contract address in config if run separately
DEPLOYED_CONTRACT= DEFAULT_CERC_DEPLOYED_CONTRACT=
# Chain ID is used by mobymask web-app for txs # Chain ID is used by mobymask web-app for txs
CHAIN_ID=42069 DEFAULT_CERC_CHAIN_ID=42069
# Set relay nodes to be used by web-apps # Set of relay nodes to be used by web-apps
RELAY_NODES=["/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"] DEFAULT_CERC_RELAY_NODES=[]
@@ -1,13 +1,13 @@
# Change if pointing to an external optimism geth endpoint # Defaults
# L2 endpoints # L2 endpoints
L2_GETH_RPC="http://op-geth:8545" DEFAULT_CERC_L2_GETH_RPC="http://op-geth:8545"
L2_GETH_HOST="op-geth" DEFAULT_CERC_L2_GETH_HOST="op-geth"
L2_GETH_PORT=8545 DEFAULT_CERC_L2_GETH_PORT=8545
L2_NODE_HOST="op-node" DEFAULT_CERC_L2_NODE_HOST="op-node"
L2_NODE_PORT=8547 DEFAULT_CERC_L2_NODE_PORT=8547
# Credentials for accounts to perform txs on L2 # Credentials for accounts to perform txs on L2
PRIVATE_KEY_DEPLOYER= DEFAULT_CERC_PRIVATE_KEY_DEPLOYER=
PRIVATE_KEY_PEER= 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"
}
@@ -4,11 +4,40 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
echo "Using L2 RPC endpoint ${L2_GETH_RPC}" 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 # Use contract address from environment variable or set from config.json in mounted volume
if [ -n "$DEPLOYED_CONTRACT" ]; then if [ -n "$CERC_DEPLOYED_CONTRACT" ]; then
CONTRACT_ADDRESS="${DEPLOYED_CONTRACT}" CONTRACT_ADDRESS="${CERC_DEPLOYED_CONTRACT}"
else else
# Assign deployed contract address from server config (created by mobymask container after deploying contract) # Assign deployed contract address from server config (created by mobymask container after deploying contract)
CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"') CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"')
@@ -17,22 +46,27 @@ fi
if [ -f /geth-accounts/accounts.csv ]; then if [ -f /geth-accounts/accounts.csv ]; then
echo "Using L1 private key from the mounted volume" echo "Using L1 private key from the mounted volume"
# Read the private key of L1 account for sending txs from peer # Read the private key of L1 account for sending txs from peer
PRIVATE_KEY_PEER=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv) CERC_PRIVATE_KEY_PEER=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv)
else else
echo "Using PRIVATE_KEY_PEER from env" echo "Using CERC_PRIVATE_KEY_PEER from env"
fi fi
# Read in the config template TOML file and modify it # Read in the config template TOML file and modify it
WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml) WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml)
WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \ WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
sed -E "s/REPLACE_WITH_ENABLE_PEER_L2_TXS/${ENABLE_PEER_L2_TXS}/g; \ sed -E "s|REPLACE_WITH_CERC_RELAY_PEERS|${CERC_RELAY_PEERS}|g; \
s/REPLACE_WITH_PRIVATE_KEY_PEER/${PRIVATE_KEY_PEER}/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_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/g; \
s|REPLACE_WITH_L2_GETH_RPC_ENDPOINT|${L2_GETH_RPC}| ") s|REPLACE_WITH_CERC_L2_GETH_RPC_ENDPOINT|${CERC_L2_GETH_RPC}| ")
# Write the modified content to a new file # Write the modified content to a new file
echo "$WATCHER_CONFIG" > environments/local.toml 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' echo 'yarn server'
yarn server yarn server
@@ -1,7 +1,5 @@
{ {
"relayNodes": [ "relayNodes": [],
"/ip4/127.0.0.1/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t"
],
"peer": { "peer": {
"enableDebugInfo": true "enableDebugInfo": true
} }
@@ -4,8 +4,18 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
# Set relay nodes in config from RELAY_NODES environment variable CERC_RELAY_NODES="${CERC_RELAY_NODES:-${DEFAULT_CERC_RELAY_NODES}}"
jq --argjson relayNodes "$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' \ '.relayNodes = $relayNodes' \
./src/test-app-config.json > ./src/config.json ./src/test-app-config.json > ./src/config.json
@@ -26,19 +26,20 @@
[server.p2p.relay] [server.p2p.relay]
host = "0.0.0.0" host = "0.0.0.0"
port = 9090 port = 9090
relayPeers = [] relayPeers = REPLACE_WITH_CERC_RELAY_PEERS
peerIdFile = './relay-id.json' peerIdFile = './peers/relay-id.json'
announce = 'REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN'
enableDebugInfo = true enableDebugInfo = true
[server.p2p.peer] [server.p2p.peer]
relayMultiaddr = '/dns4/mobymask-watcher-server/tcp/9090/ws/p2p/12D3KooWSPCsVkHVyLQoCqhu2YRPvvM7o6r6NRYyLM5zeA6Uig5t' relayMultiaddr = 'REPLACE_WITH_CERC_RELAY_MULTIADDR'
pubSubTopic = 'mobymask' pubSubTopic = 'mobymask'
peerIdFile = './peer-id.json' peerIdFile = './peers/peer-id.json'
enableDebugInfo = true enableDebugInfo = true
enableL2Txs = REPLACE_WITH_ENABLE_PEER_L2_TXS enableL2Txs = REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS
[server.p2p.peer.l2TxsConfig] [server.p2p.peer.l2TxsConfig]
privateKey = 'REPLACE_WITH_PRIVATE_KEY_PEER' privateKey = 'REPLACE_WITH_CERC_PRIVATE_KEY_PEER'
contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS' contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS'
[metrics] [metrics]
@@ -60,7 +61,7 @@
[upstream] [upstream]
[upstream.ethServer] [upstream.ethServer]
gqlApiEndpoint = "http://ipld-eth-server:8083/graphql" gqlApiEndpoint = "http://ipld-eth-server:8083/graphql"
rpcProviderEndpoint = "REPLACE_WITH_L2_GETH_RPC_ENDPOINT" rpcProviderEndpoint = "REPLACE_WITH_CERC_L2_GETH_RPC_ENDPOINT"
blockDelayInMilliSecs = 60000 blockDelayInMilliSecs = 60000
[upstream.cache] [upstream.cache]
+13
View File
@@ -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 #!/usr/bin/env bash
# Build a local version of the task executor for act-runner # 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 #!/usr/bin/env bash
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# Build a local version of the act-runner image # 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
@@ -29,6 +29,9 @@ RUN \
usermod -u ${CERC_HOST_UID} -g ${CERC_HOST_GID} ${USERNAME} && chown ${CERC_HOST_UID}:${CERC_HOST_GID} /home/${USERNAME}; \ usermod -u ${CERC_HOST_UID} -g ${CERC_HOST_GID} ${USERNAME} && chown ${CERC_HOST_UID}:${CERC_HOST_GID} /home/${USERNAME}; \
fi fi
# Prevents npm from printing version warnings
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
RUN \ RUN \
# Configure global npm install location, use group to adapt to UID/GID changes # 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 \ if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \
@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Usage: build-npm-package-local-dependencies.sh <registry-url> <publish-with-this-version> # 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 # 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 if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
@@ -18,7 +18,7 @@ set -e
local_npm_registry_url=$1 local_npm_registry_url=$1
package_publish_version=$2 package_publish_version=$2
# If we need to handle an additional scope, add it to the list below: # 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[@]} for npm_scope_for_local in ${npm_scopes_to_handle[@]}
do do
# We need to configure the local registry # We need to configure the local registry
@@ -24,13 +24,23 @@ package_name=$( cat package.json | jq -r .name )
local_npm_registry_url=$1 local_npm_registry_url=$1
npm config set @cerc-io:registry ${local_npm_registry_url} npm config set @cerc-io:registry ${local_npm_registry_url}
npm config set @lirewine: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 # 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 ) 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 if [[ ! -z "$package_exists" && "$package_exists" != "null" ]]; then
echo "${package_publish_version} of ${package_name} already exists in the registry, skipping build" 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 exit 0
fi fi
fi
echo "Build and publish ${package_name} version ${package_publish_version}" echo "Build and publish ${package_name} version ${package_publish_version}"
yarn install yarn install
yarn build yarn build
@@ -1,3 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build cerc/eth-probe # 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 #!/usr/bin/env bash
# Build cerc/eth-statediff-fill-service # 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 #!/usr/bin/env bash
# Build cerc/eth-statediff-service # 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 #!/usr/bin/env bash
# Build cerc/fixturenet-eth-geth # Build cerc/fixturenet-eth-geth
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 #!/usr/bin/env bash
# Build cerc/fixturenet-eth-lighthouse # Build cerc/fixturenet-eth-lighthouse
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 #!/usr/bin/env bash
# Build a local version of the foundry-rs/foundry image # 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 #!/usr/bin/env bash
# Build cerc/go-ethereum-foundry # Build cerc/go-ethereum-foundry
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 #!/usr/bin/env bash
# Build cerc/go-ethereum # 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 #!/usr/bin/env bash
# Build cerc/ipld-eth-beacon-db # 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 #!/usr/bin/env bash
# Build cerc/ipld-eth-beacon-indexer # 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 #!/usr/bin/env bash
# Build cerc/ipld-eth-db # 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 #!/usr/bin/env bash
# Build cerc/ipld-eth-server # 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 #Build cerc/keycloack
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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}
@@ -7,11 +7,13 @@ ARG USERNAME=node
ARG NPM_GLOBAL=/usr/local/share/npm-global ARG NPM_GLOBAL=/usr/local/share/npm-global
# This container pulls npm packages from a local registry configured via these env vars # This container pulls npm packages from a local registry configured via these env vars
ARG CERC_NPM_URL ARG CERC_NPM_REGISTRY_URL
ARG CERC_NPM_AUTH_TOKEN ARG CERC_NPM_AUTH_TOKEN
# Add NPM global to PATH. # Add NPM global to PATH.
ENV PATH=${NPM_GLOBAL}/bin:${PATH} ENV PATH=${NPM_GLOBAL}/bin:${PATH}
# Prevents npm from printing version warnings
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
RUN \ RUN \
# Configure global npm install location, use group to adapt to UID/GID changes # Configure global npm install location, use group to adapt to UID/GID changes
@@ -47,9 +49,9 @@ COPY ./start-serving-app.sh /scripts
# RUN su node -c "npm install -g <your-package-list-here>" # RUN su node -c "npm install -g <your-package-list-here>"
# Configure the local npm registry # Configure the local npm registry
RUN npm config set @cerc-io:registry ${CERC_NPM_URL} \ RUN npm config set @cerc-io:registry ${CERC_NPM_REGISTRY_URL} \
&& npm config set @lirewine:registry ${CERC_NPM_URL} \ && npm config set @lirewine:registry ${CERC_NPM_REGISTRY_URL} \
&& npm config set -- ${CERC_NPM_URL}:_authToken ${CERC_NPM_AUTH_TOKEN} && npm config set -- ${CERC_NPM_REGISTRY_URL}:_authToken ${CERC_NPM_AUTH_TOKEN}
RUN mkdir -p /config RUN mkdir -p /config
COPY ./config.yml /config COPY ./config.yml /config
@@ -26,9 +26,10 @@ do
kv_pair=(${kv_pair_string//=/ }) kv_pair=(${kv_pair_string//=/ })
template_string_to_replace=${kv_pair[0]} template_string_to_replace=${kv_pair[0]}
template_value_to_substitute=${kv_pair[1]} template_value_to_substitute=${kv_pair[1]}
template_value_to_substitute_expanded=${template_value_to_substitute//LACONIC_HOSTED_ENDPOINT/${LACONIC_HOSTED_ENDPOINT}}
# Run find and sed to do the substitution of one variable over all files # Run find and sed to do the substitution of one variable over all files
# See: https://stackoverflow.com/a/21479607/1701505 # See: https://stackoverflow.com/a/21479607/1701505
echo "Substituting: ${template_string_to_replace} = ${template_value_to_substitute}" echo "Substituting: ${template_string_to_replace} = ${template_value_to_substitute_expanded}"
# Note: we do not escape our strings, on the expectation they do not container the '#' char. # Note: we do not escape our strings, on the expectation they do not container the '#' char.
find ${webapp_files_dir} -type f -exec sed -i 's#'${template_string_to_replace}'#'${template_value_to_substitute}'#g' {} + find ${webapp_files_dir} -type f -exec sed -i 's#'${template_string_to_replace}'#'${template_value_to_substitute_expanded}'#g' {} +
done done
@@ -1,9 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build cerc/laconic-registry-cli # Build cerc/laconic-registry-cli
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 \ --add-host gitea.local:host-gateway \
--build-arg CERC_NPM_AUTH_TOKEN --build-arg CERC_NPM_URL ${SCRIPT_DIR} --build-arg CERC_NPM_AUTH_TOKEN --build-arg CERC_NPM_REGISTRY_URL ${SCRIPT_DIR}
@@ -2,5 +2,5 @@
services: services:
wns: wns:
server: 'http://localhost:9473/api' server: 'LACONIC_HOSTED_ENDPOINT:9473/api'
webui: 'http://localhost:9473/console' webui: 'LACONIC_HOSTED_ENDPOINT:9473/console'
@@ -7,11 +7,13 @@ ARG USERNAME=node
ARG NPM_GLOBAL=/usr/local/share/npm-global ARG NPM_GLOBAL=/usr/local/share/npm-global
# This container pulls npm packages from a local registry configured via these env vars # This container pulls npm packages from a local registry configured via these env vars
ARG CERC_NPM_URL ARG CERC_NPM_REGISTRY_URL
ARG CERC_NPM_AUTH_TOKEN ARG CERC_NPM_AUTH_TOKEN
# Add NPM global to PATH. # Add NPM global to PATH.
ENV PATH=${NPM_GLOBAL}/bin:${PATH} ENV PATH=${NPM_GLOBAL}/bin:${PATH}
# Prevents npm from printing version warnings
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
RUN \ RUN \
# Configure global npm install location, use group to adapt to UID/GID changes # Configure global npm install location, use group to adapt to UID/GID changes
@@ -40,9 +42,9 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# RUN su node -c "npm install -g <your-package-list-here>" # RUN su node -c "npm install -g <your-package-list-here>"
# Configure the local npm registry # Configure the local npm registry
RUN npm config set @cerc-io:registry ${CERC_NPM_URL} \ RUN npm config set @cerc-io:registry ${CERC_NPM_REGISTRY_URL} \
&& npm config set @lirewine:registry ${CERC_NPM_URL} \ && npm config set @lirewine:registry ${CERC_NPM_REGISTRY_URL} \
&& npm config set -- ${CERC_NPM_URL}:_authToken ${CERC_NPM_AUTH_TOKEN} && npm config set -- ${CERC_NPM_REGISTRY_URL}:_authToken ${CERC_NPM_AUTH_TOKEN}
# TODO: the image at this point could be made a base image for several different CLI images # TODO: the image at this point could be made a base image for several different CLI images
# that install different Node-based CLI commands # that install different Node-based CLI commands
@@ -53,7 +55,9 @@ RUN yarn global add @cerc-io/laconic-registry-cli
# Add scripts # Add scripts
RUN mkdir /scripts RUN mkdir /scripts
ENV PATH="${PATH}:/scripts" ENV PATH="${PATH}:/scripts"
COPY ./create-demo-records.sh /scripts
COPY ./import-key.sh /scripts COPY ./import-key.sh /scripts
COPY ./import-address.sh /scripts
# Default command sleeps forever so docker doesn't kill it # Default command sleeps forever so docker doesn't kill it
CMD ["sh", "-c", "while :; do sleep 600; done"] CMD ["sh", "-c", "while :; do sleep 600; done"]
@@ -1,9 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build cerc/laconic-registry-cli # Build cerc/laconic-registry-cli
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 \ --add-host gitea.local:host-gateway \
--build-arg CERC_NPM_AUTH_TOKEN --build-arg CERC_NPM_URL ${SCRIPT_DIR} --build-arg CERC_NPM_AUTH_TOKEN --build-arg CERC_NPM_REGISTRY_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 #!/usr/bin/env bash
# Build cerc/chiba-clonk # Build cerc/laconicd
docker build -t cerc/laconicd:local ${CERC_REPO_BASE_DIR}/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 #!/usr/bin/env bash
# Build cerc/lighthouse # Build cerc/lighthouse
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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,7 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build cerc/mobymask-ui # Build cerc/mobymask-ui
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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,7 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build cerc/mobymask # Build cerc/mobymask
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 #!/usr/bin/env bash
# Build cerc/optimism-contracts # Build cerc/optimism-contracts
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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') .addParam('privateKey', 'The private key of the sender')
.setAction(async ({ to, amount, privateKey }, {}) => { .setAction(async ({ to, amount, privateKey }, {}) => {
// Open the wallet using sender's private key // 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) const wallet = new ethers.Wallet(privateKey, provider)
// Send amount to the specified address // Send amount to the specified address
@@ -16,7 +16,11 @@ task('send-balance', 'Sends Ether to a specified Ethereum account')
to, to,
value: ethers.utils.parseEther(amount), value: ethers.utils.parseEther(amount),
}) })
const txReceipt = await tx.wait()
console.log(`Balance sent to: ${to}, from: ${wallet.address}`) console.log(`Balance sent to: ${to}, from: ${wallet.address}`)
console.log(
`Block: { number: ${txReceipt.blockNumber}, hash: ${txReceipt.blockHash} }`
)
console.log(`Transaction hash: ${tx.hash}`) console.log(`Transaction hash: ${tx.hash}`)
}) })
@@ -9,7 +9,7 @@ task(
.addParam('transactionHash', 'Hash of the deployment transaction') .addParam('transactionHash', 'Hash of the deployment transaction')
.setAction(async ({ contract, transactionHash }, { ethers }) => { .setAction(async ({ contract, transactionHash }, { ethers }) => {
const provider = new ethers.providers.JsonRpcProvider( const provider = new ethers.providers.JsonRpcProvider(
`${process.env.L1_RPC}` `${process.env.CERC_L1_RPC}`
) )
// Get the deployment tx receipt // Get the deployment tx receipt
@@ -1,3 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build cerc/optimism-l2geth # 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 #!/usr/bin/env bash
# Build cerc/optimism-op-batcher # Build cerc/optimism-op-batcher
# TODO: use upstream Dockerfile once its buildx-specific content has been removed # 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 ) 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 #!/usr/bin/env bash
# Build cerc/optimism-op-node # Build cerc/optimism-op-node
# TODO: use upstream Dockerfile once its buildx-specific content has been removed # 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 ) 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,7 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build cerc/react-peer # Build cerc/react-peer
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 #!/usr/bin/env bash
# Build cerc/test-container # Build cerc/test-container
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 #!/usr/bin/env bash
# Build cerc/test-contract # 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 #!/usr/bin/env bash
# Build cerc/tx-spammer # 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 #!/usr/bin/env bash
# Build cerc/uniswap-v3-info # Build cerc/uniswap-v3-info
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 #!/usr/bin/env bash
# Build cerc/watcher-erc20 # Build cerc/watcher-erc20
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 #!/usr/bin/env bash
# Build cerc/watcher-erc721 # Build cerc/watcher-erc721
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 #!/usr/bin/env bash
# Build cerc/watcher-mobymask-v2 # Build cerc/watcher-mobymask-v2
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 #!/usr/bin/env bash
# Build cerc/watcher-mobymask # Build cerc/watcher-mobymask
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 # TODO: add a mechanism to pass two repos into a container rather than the parent directory
@@ -1,7 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build cerc/watcher-uniswap-v3 # Build cerc/watcher-uniswap-v3
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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
+4 -5
View File
@@ -1,14 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Usage: default-build.sh <image-tag> [<repo-relative-path>] # 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 <repo-relative-path> is not supplied, the context is the directory where the Dockerfile lives
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
set -x source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
fi
if [[ $# -ne 2 ]]; then if [[ $# -ne 2 ]]; then
echo "Illegal number of parameters" >&2 echo "Illegal number of parameters" >&2
exit 1 exit 1
fi fi
image_tag=$1 image_tag=$1
build_dir=$2 build_dir=$2
echo "Building ${image_tag} in ${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}
docker build -t ${image_tag} --build-arg CERC_HOST_UID=${CERC_HOST_UID} --build-arg CERC_HOST_GID=${CERC_HOST_GID} ${build_dir}
@@ -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 build-support build-containers --exclude cerc/builder-gerbil
$ laconic-so --stack package-registry setup-repositories $ laconic-so --stack package-registry setup-repositories
$ laconic-so --stack package-registry build-containers
$ laconic-so --stack package-registry deploy-system up $ 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: 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" $ 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 name: fixturenet-laconic-loaded
description: "A full featured laconic fixturenet" description: "A full featured laconic fixturenet"
repos: repos:
@@ -28,3 +28,5 @@ pods:
config: config:
cli: cli:
key: laconicd.mykey key: laconicd.mykey
address: laconicd.myaddress
@@ -16,3 +16,4 @@ pods:
config: config:
cli: cli:
key: laconicd.mykey key: laconicd.mykey
address: laconicd.myaddress
@@ -10,6 +10,8 @@ Clone required repositories:
```bash ```bash
laconic-so --stack fixturenet-optimism setup-repositories laconic-so --stack fixturenet-optimism setup-repositories
# 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: Checkout to the required versions and branches in repos:
@@ -109,7 +111,7 @@ docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_geth_accounts
docker volume rm $(docker volume ls -q --filter name=l2_geth_data) docker volume rm $(docker volume ls -q --filter name=l2_geth_data)
``` ```
* Reuse the deployment command used in [Deploy](#deploy) to restart the stopped containers * Re-run the deployment command used in [Deploy](#deploy) to restart the stopped containers
## Known Issues ## Known Issues
+21 -6
View File
@@ -10,6 +10,8 @@ Clone required repositories:
```bash ```bash
laconic-so --stack fixturenet-optimism setup-repositories --exclude cerc-io/go-ethereum 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: Checkout to the required versions and branches in repos:
@@ -35,16 +37,29 @@ This should create the required docker images in the local image registry:
## Deploy ## Deploy
Update the [l1-params.env](../../config/fixturenet-optimism/l1-params.env) file with L1 endpoint (`L1_RPC`, `L1_HOST` and `L1_PORT`) and other params Create and update an env file to be used in the next step ([defaults](../../config/fixturenet-optimism/l1-params.env)):
* NOTE: ```bash
* Stack Orchestrator needs to be run in [`dev`](/docs/CONTRIBUTING.md#install-developer-mode) mode to be able to edit the env file # External L1 endpoint
* If L1 is running on the host machine, use `host.docker.internal` as the hostname to access the host port 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: Deploy the stack:
```bash ```bash
laconic-so --stack fixturenet-optimism deploy up --include fixturenet-optimism 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: The `fixturenet-optimism-contracts` service may take a while (`~15 mins`) to complete running as it:
@@ -69,7 +84,7 @@ docker logs -f <CONTAINER_ID>
Stop all services running in the background: Stop all services running in the background:
```bash ```bash
laconic-so --stack fixturenet-optimism deploy down --include fixturenet-optimism laconic-so --stack fixturenet-optimism deploy --include fixturenet-optimism down
``` ```
Clear volumes created by this stack: Clear volumes created by this stack:
+5 -3
View File
@@ -1,10 +1,12 @@
# MobyMask v2 watcher # MobyMask v2 watcher
Instructions to setup and deploy an end-to-end MobyMask v2 stack ([L1](../fixturenet-eth/) + [L2](../fixturenet-optimism/) chains + watcher) using [laconic-stack-orchestrator](/README.md#install) 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. We support running just the watcher part of stack, given an external L2 Optimism endpoint.
Follow [mobymask-only](./mobymask-only.md) for the same. 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 ## Setup
Clone required repositories: Clone required repositories:
@@ -120,8 +122,8 @@ Clear volumes created by this stack:
```bash ```bash
# List all relevant volumes # List all relevant volumes
docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*mobymask_deployment|.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data" 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"
# Remove all the listed volumes # Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*mobymask_deployment|.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data") 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")
``` ```
+50 -11
View File
@@ -10,6 +10,8 @@ Clone required repositories:
```bash ```bash
laconic-so --stack mobymask-v2 setup-repositories --include cerc-io/MobyMask,cerc-io/watcher-ts 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: Checkout to the required versions and branches in repos:
@@ -36,19 +38,44 @@ This should create the required docker images in the local image registry
### Configuration ### Configuration
* In [mobymask-params.env](../../config/watcher-mobymask-v2/mobymask-params.env) file set `DEPLOYED_CONTRACT` to existing deployed mobymask contract address Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v2/)):
* Setting `DEPLOYED_CONTRACT` will skip contract deployment when running stack
* `ENABLE_PEER_L2_TXS` is used to enable/disable sending txs to L2 chain from watcher peer. ```bash
* Update the [optimism-params.env](../../config/watcher-mobymask-v2/optimism-params.env) file with Optimism endpoints and other params for the Optimism running separately # External L2 endpoints
* `PRIVATE_KEY_PEER` is used by watcher peer to send txs to L2 chain CERC_L2_GETH_RPC=
* NOTE: CERC_L2_GETH_HOST=
* Stack Orchestrator needs to be run in [`dev`](/docs/CONTRIBUTING.md#install-developer-mode) mode to be able to edit the env file CERC_L2_GETH_PORT=
* If Optimism is running on the host machine, use `host.docker.internal` as the hostname to access the host 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 ### Deploy the stack
```bash ```bash
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 up 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: To list down and monitor the running containers:
@@ -63,10 +90,22 @@ docker ps
docker logs -f <CONTAINER_ID> 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 ## Tests
See [Tests](./README.md#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 ## Clean up
Stop all services running in the background: Stop all services running in the background:
@@ -79,8 +118,8 @@ Clear volumes created by this stack:
```bash ```bash
# List all relevant volumes # List all relevant volumes
docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*mobymask_deployment|.*fixturenet_geth_accounts" docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*peers_ids|.*mobymask_deployment|.*fixturenet_geth_accounts"
# Remove all the listed volumes # Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*mobymask_deployment|.*fixturenet_geth_accounts") docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*peers_ids|.*mobymask_deployment|.*fixturenet_geth_accounts")
``` ```
+41 -12
View File
@@ -10,6 +10,8 @@ Clone required repositories:
```bash ```bash
laconic-so --stack mobymask-v2 setup-repositories --include cerc-io/react-peer,cerc-io/mobymask-ui 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: Checkout to the required versions and branches in repos:
@@ -36,36 +38,63 @@ This should create the required docker images in the local image registry
### Configuration ### Configuration
* Update the [mobymask-params.env](../../config/watcher-mobymask-v2/mobymask-params.env) file with watcher endpoints and other params required by the web-apps Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v2/mobymask-params.env)):
* `WATCHER_HOST` and `WATCHER_PORT` is used to check if watcher is up before building and deploying mobymask-app
* `APP_WATCHER_URL` is used by mobymask-app to make GQL queries ```bash
* `DEPLOYED_CONTRACT` and `CHAIN_ID` is used by mobymask-app in app config when creating messgaes for L2 txs # Set of relay nodes to be used by the web-app
* `RELAY_NODES` is used by the web-apps to connect to the relay nodes (run in watcher) # (use double quotes " for strings)
* NOTE: # Eg. CERC_RELAY_NODES=["/dns4/example.com/tcp/443/wss/p2p/12D3KooWGHmDDCc93XUWL16FMcTPCGu2zFaMkf67k8HZ4gdQbRDr"]
* Stack Orchestrator needs to be run in [`dev`](/docs/CONTRIBUTING.md#install-developer-mode) mode to be able to edit the env file CERC_RELAY_NODES=[]
* If watcher is running on the host machine, use `host.docker.internal` as the hostname to access the host port
# 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 ### Deploy the stack
For running mobymask-app For running mobymask-app
```bash ```bash
laconic-so --stack mobymask-v2 deploy --include mobymask-app up 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 For running peer-test-app
```bash ```bash
laconic-so --stack mobymask-v2 deploy --include peer-test-app up 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: To list down and monitor the running containers:
```bash ```bash
laconic-so --stack mobymask-v2 deploy --include [mobymask-app | peer-test-app] ps
docker ps docker ps
# Check logs for a container # Check logs for a container
docker logs -f <CONTAINER_ID> docker logs -f <CONTAINER_ID>
``` ```
## Demo
Follow the [demo](./demo.md) to try out the MobyMask app with L2 chain
## Clean up ## Clean up
Stop all services running in the background: Stop all services running in the background:
@@ -84,8 +113,8 @@ Clear volumes created by this stack:
```bash ```bash
# List all relevant volumes # List all relevant volumes
docker volume ls -q --filter "name=.*mobymask_deployment" docker volume ls -q --filter "name=.*mobymask_deployment|.*peers_ids"
# Remove all the listed volumes # Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_deployment") docker volume rm $(docker volume ls -q --filter "name=.*mobymask_deployment|.*peers_ids")
``` ```
+3 -2
View File
@@ -32,11 +32,12 @@ from .util import include_exclude_check, get_parsed_stack_config
@click.command() @click.command()
@click.option("--include", help="only start these components") @click.option("--include", help="only start these components")
@click.option("--exclude", help="don\'t start these components") @click.option("--exclude", help="don\'t start these components")
@click.option("--env-file", help="env file to be used")
@click.option("--cluster", help="specify a non-default cluster name") @click.option("--cluster", help="specify a non-default cluster name")
@click.argument('command', required=True) # help: command: up|down|ps @click.argument('command', required=True) # help: command: up|down|ps
@click.argument('extra_args', nargs=-1) # help: command: up|down|ps <service1> <service2> @click.argument('extra_args', nargs=-1) # help: command: up|down|ps <service1> <service2>
@click.pass_context @click.pass_context
def command(ctx, include, exclude, cluster, command, extra_args): def command(ctx, include, exclude, env_file, cluster, command, extra_args):
'''deploy a stack''' '''deploy a stack'''
# TODO: implement option exclusion and command value constraint lost with the move from argparse to click # TODO: implement option exclusion and command value constraint lost with the move from argparse to click
@@ -51,7 +52,7 @@ def command(ctx, include, exclude, cluster, command, extra_args):
cluster_context = _make_cluster_context(ctx.obj, include, exclude, cluster) cluster_context = _make_cluster_context(ctx.obj, include, exclude, cluster)
# See: https://gabrieldemarmiesse.github.io/python-on-whales/sub-commands/compose/ # See: https://gabrieldemarmiesse.github.io/python-on-whales/sub-commands/compose/
docker = DockerClient(compose_files=cluster_context.compose_files, compose_project_name=cluster_context.cluster) docker = DockerClient(compose_files=cluster_context.compose_files, compose_project_name=cluster_context.cluster, compose_env_file=env_file)
extra_args_list = list(extra_args) or None extra_args_list = list(extra_args) or None
+3 -1
View File
@@ -34,7 +34,9 @@ In addition to the pre-requisites listed in the [README](/README.md), the follow
$ cd stack-orchestrator $ cd stack-orchestrator
``` ```
3. Create and activate a venv: 3. (This and the next step can be done by running `source ./scripts/developer-mode-setup.sh`)
Create and activate a venv:
``` ```
$ python3 -m venv venv $ python3 -m venv venv
$ source ./venv/bin/activate $ source ./venv/bin/activate
+64
View File
@@ -1,3 +1,67 @@
# laconic-so # laconic-so
Sub-commands and flags Sub-commands and flags
## setup-repositories
Clone a single repository:
```
$ laconic-so setup-repositories --include cerc-io/go-ethereum
```
Clone the repositories for a stack:
```
$ laconic-so --stack fixturenet-eth setup-repositories
```
Pull latest commits from origin:
```
$ laconic-so --stack fixturenet-eth setup-repositories --pull
```
Use SSH rather than https:
```
$ laconic-so --stack fixturenet-eth setup-repositories --git-ssh
```
## build-containers
Build a single container:
```
$ laconic-so build-containers --include <container-name>
```
e.g.
```
$ laconic-so build-containers --include cerc/go-ethereum
```
Build the containers for a stack:
```
$ laconic-so --stack <stack-name> build-containers
```
e.g.
```
$ laconic-so --stack fixturenet-eth build-containers
```
Force full rebuild of container images:
```
$ laconic-so build-containers --include <container-name> --force-rebuild
```
## build-npms
Build a single package:
```
$ laconic-so build-npms --include <package-name>
```
e.g.
```
$ laconic-so build-npms --include laconic-sdk
```
Build the packages for a stack:
```
$ laconic-so --stack <stack-name> build-npms
```
e.g.
```
$ laconic-so --stack fixturenet-laconicd build-npms
```
Force full rebuild of packages:
```
$ laconic-so build-npms --include <package-name> --force-rebuild
```
+2
View File
@@ -1,5 +1,7 @@
# Specification # Specification
(note this page is out of date)
## Implementation ## Implementation
+1 -1
View File
@@ -60,7 +60,7 @@ sudo apt -y install jq
# laconic-so depends on git # laconic-so depends on git
sudo apt -y install git sudo apt -y install git
# curl used below # curl used below
sudo apt -y install jq sudo apt -y install curl
# docker repo add depends on gnupg and updated ca-certificates # docker repo add depends on gnupg and updated ca-certificates
sudo apt -y install ca-certificates gnupg sudo apt -y install ca-certificates gnupg