Use env variable mapping in fixturenet-optimism stack

This commit is contained in:
Prathamesh Musale 2023-04-10 16:12:11 +05:30
parent bb8a222ce3
commit c471e8dca8
3 changed files with 27 additions and 18 deletions

View File

@ -7,11 +7,17 @@ services:
fixturenet-optimism-contracts:
hostname: fixturenet-optimism-contracts
image: cerc/optimism-contracts:local
env_file:
- ../config/fixturenet-optimism/l1-params.env
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
L1_CHAIN_ID: ${L1_CHAIN_ID}
L1_RPC: ${L1_RPC}
L1_ADDRESS: ${L1_ADDRESS}
L1_PRIV_KEY: ${L1_PRIV_KEY}
L1_ADDRESS_2: ${L1_ADDRESS_2}
L1_PRIV_KEY_2: ${L1_PRIV_KEY_2}
# Waits for L1 endpoint to be up before running the script
command: |
"./wait-for-it.sh -h $${L1_HOST} -p $${L1_PORT} -s -t 60 -- ./run.sh"
"./wait-for-it.sh -h ${L1_HOST} -p ${L1_PORT} -s -t 60 -- ./run.sh"
volumes:
- ../config/wait-for-it.sh:/app/packages/contracts-bedrock/wait-for-it.sh
- ../container-build/cerc-optimism-contracts/hardhat-tasks/verify-contract-deployment.ts:/app/packages/contracts-bedrock/tasks/verify-contract-deployment.ts
@ -31,8 +37,9 @@ services:
depends_on:
fixturenet-optimism-contracts:
condition: service_completed_successfully
env_file:
- ../config/fixturenet-optimism/l1-params.env
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
L1_RPC: ${L1_RPC}
volumes:
- ../config/fixturenet-optimism/generate-l2-config.sh:/app/generate-l2-config.sh
- l1_deployment:/contracts-bedrock:ro
@ -65,12 +72,13 @@ services:
# Runs the L2 consensus client (Sequencer node)
op-node:
env_file:
- ../config/fixturenet-optimism/l1-params.env
image: cerc/optimism-op-node:local
depends_on:
op-geth:
condition: service_healthy
image: cerc/optimism-op-node:local
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
L1_RPC: ${L1_RPC}
volumes:
- ../config/fixturenet-optimism/run-op-node.sh:/app/run-op-node.sh
- l2_config:/op-node-data:ro
@ -89,14 +97,15 @@ services:
# Runs the batcher (takes transactions from the Sequencer and publishes them to L1)
op-batcher:
env_file:
- ../config/fixturenet-optimism/l1-params.env
image: cerc/optimism-op-batcher:local
depends_on:
op-node:
condition: service_healthy
op-geth:
condition: service_healthy
image: cerc/optimism-op-batcher:local
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
L1_RPC: ${L1_RPC}
volumes:
- ../config/wait-for-it.sh:/wait-for-it.sh
- ../config/fixturenet-optimism/run-op-batcher.sh:/run-op-batcher.sh
@ -104,7 +113,7 @@ services:
entrypoint: ["sh", "-c"]
# Waits for L1 endpoint to be up before running the batcher
command: |
"/wait-for-it.sh -h $${L1_HOST} -p $${L1_PORT} -s -t 60 -- /run-op-batcher.sh"
"/wait-for-it.sh -h ${L1_HOST} -p ${L1_PORT} -s -t 60 -- /run-op-batcher.sh"
extra_hosts:
- "host.docker.internal:host-gateway"

View File

@ -39,10 +39,12 @@ This should create the required docker images in the local image registry:
## Deploy
Create an env file to be used in the next step with contents from [l1-params.env](../../config/fixturenet-optimism/l1-params.env)
Deploy the stack:
```bash
laconic-so --stack fixturenet-optimism deploy up
laconic-so --stack fixturenet-optimism deploy --env-file <PATH_TO_ENV_FILE> up
```
The `fixturenet-optimism-contracts` service may take a while (`~15 mins`) to complete running as it:

View File

@ -35,16 +35,14 @@ This should create the required docker images in the local image registry:
## 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 an env file to be used in the next step with contents from [l1-params.env](../../config/fixturenet-optimism/l1-params.env); update it with L1 endpoint (`L1_RPC`, `L1_HOST` and `L1_PORT`) and other params
* NOTE:
* Stack Orchestrator needs to be run in [`dev`](/docs/CONTRIBUTING.md#install-developer-mode) mode to be able to edit the env file
* If L1 is running on the host machine, use `host.docker.internal` as the hostname to access the host port
* NOTE: If L1 is running on the host machine, use `host.docker.internal` as the hostname to access the host port
Deploy the stack:
```bash
laconic-so --stack fixturenet-optimism deploy 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: