eth-stack/stack-orchestrator/stacks/eth/README.md

125 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

# eth
## Setup
* Clone the stack repo:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/eth-stack
```
## Create a deployment
* Create a spec file for the deployment, which will map the stack's ports and volumes to the host:
```bash
laconic-so --stack ~/cerc/eth-stack/stack-orchestrator/stacks/eth deploy init --output eth-spec.yml
```
* Edit `network` in the spec file to map container ports to host ports as required:
```yml
...
network:
ports:
eth-geth:
- '8545:8545'
- '8546:8546'
- '6060:6060'
- '30303:30303/tcp'
- '30303:30303/udp'
eth-lighthouse:
- '8001:8001'
- '9000:9000/tcp'
- '9000:9000/udp'
```
* Create a deployment from the spec file:
```bash
laconic-so --stack ~/cerc/eth-stack/stack-orchestrator/stacks/eth deploy create --spec-file eth-spec.yml --deployment-dir eth-deployment
```
* Inside the `eth-deployment` deployment directory, open `config.env` file and set following env variables:
```bash
# Optional
# Network to run the ETH node for (default: sepolia)
# (one of mainnet, sepolia, holesky)
CERC_NETWORK=
# Geth options (https://geth.ethereum.org/docs/fundamentals/command-line-options)
# Allow unprotected txs (default: false)
CERC_ALLOW_UNPROTECTED_TXS=
# Blockchain sync mode (default: full)
CERC_SYNCMODE=
# Garbage collection mode (default: archive)
CERC_GCMODE=
# Verbosity level (default: info)
CERC_GETH_VERBOSITY=
# Lighthouse BN options (https://lighthouse-book.sigmaprime.io/help_bn.html)
# Verbosity level (default: info)
CERC_DEBUG_LEVEL=
# Required
# Beacon node endpoint to use for checkpoint sync
# (https://eth-clients.github.io/checkpoint-sync-endpoints/)
CERC_CHECKPOINT_SYNC_URL=
```
## Start
* Start the deployment:
```bash
laconic-so deployment --dir eth-deployment start
```
## Check status
* To list down and monitor the running containers:
```bash
# With status
docker ps -a
# Follow logs for eth-geth container
laconic-so deployment --dir eth-deployment logs eth-geth -f
# Follow logs for eth-lighthouse container
laconic-so deployment --dir eth-deployment logs eth-lighthouse -f
```
* Once the node has caught up to head, make a request to get the latest block number:
```bash
curl -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
http://localhost:8545
```
## Clean up
* To stop all services running in the background, while preserving chain data:
```bash
laconic-so deployment --dir eth-deployment stop
```
* To stop all services and also delete chain data:
```bash
laconic-so deployment --dir eth-deployment stop --delete-volumes
# Remove the deployment dir
sudo rm -rf eth-deployment
```