Feat/isolate nodes per container - #3
Conversation
- Without this, geth implicitly bumps the default cache to 4096MB when treating the setup as mainnet, which instantly exhausts Docker's memory limit (~8GB) when spinning up a 4-node local cluster.
- modify p2p address from localhost to use docker internal DNS name - only handle geth initialization, but not start the node
- Introduce `NODE_TYPE` and `NODE_INDEX` environment variables to uniquely identify each container and correctly mount its respective data dir (`.local/nodeX`).
- Makefile for lifecycle - docker initialization script "node_entrypoint.sh" for booting geth based on node type (validator, sentry, fullnode)
forces Geth to output logs to standard output instead of local files, enabling docker's default logging driver to capture
- Replaced `mv` with `cp` when extracting the compiled geth binary. prevent redundant rebuilds. - Removed unused `exit_previous` func - Add cluster-restart for fast restart without wiping blockchain data or trigger re-initialization.
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis pull request introduces a complete Docker-based orchestration system for managing a local BSC validator cluster. It adds a Makefile with lifecycle management targets ( Sequence Diagram(s)sequenceDiagram
participant User
participant Make as Makefile<br/>(make cluster-up)
participant Toolbox as Toolbox Container<br/>(docker_cluster.sh)
participant Genesis as Genesis Module<br/>(prep & build)
participant Geth as Geth Binary<br/>(compile/copy)
participant Compose as Docker Compose<br/>(generate & start)
participant Nodes as Node Services<br/>(validators/sentries)
User->>Make: make cluster-up
Make->>Toolbox: run docker_cluster.sh prepare
Toolbox->>Geth: clone/build BSC geth (if needed)
Geth-->>Toolbox: geth binary
Toolbox->>Genesis: reset to compatible commit
Genesis->>Genesis: install dependencies (poetry/npm)
Genesis-->>Toolbox: prepared genesis module
Toolbox->>Toolbox: extract validator addresses from keystores
Toolbox->>Toolbox: generate validators.conf & genesis.json
Toolbox->>Toolbox: initialize geth datadirs (geth init)
Toolbox->>Toolbox: patch config.toml files
Toolbox->>Compose: generate docker-compose.cluster.yml
Compose-->>Toolbox: compose file ready
Toolbox-->>Make: prepare phase complete
Make->>Compose: docker compose up -d
Compose->>Nodes: start validator/sentry/fullnode services
Nodes-->>Compose: services running
Compose-->>User: cluster operational
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes The changes introduce substantial new infrastructure (~500 lines across five files) with heterogeneous components: orchestration logic (docker_cluster.sh, node_entrypoint.sh), build system integration (Makefile), and documentation. The docker_cluster.sh script presents significant logic density including keystore parsing, geth binary handling, genesis module reset with artifact preservation, config patching via sed, docker-compose YAML generation with dynamic service definitions, and StakeHub validator registration. The node_entrypoint.sh script handles environment variable validation, consensus address derivation, and complex geth flag construction. The integration across multiple layers—build system, container orchestration, node initialization—requires careful verification of correctness and concurrency safety. Possibly related PRs
🚥 Pre-merge checks | ✅ 5 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary by CodeRabbit
Release Notes
New Features
cluster-up,cluster-down,cluster-logs,cluster-clean,cluster-restart) for simplified local BSC cluster operationsDocumentation