This document provides comprehensive guidance for running Mysticeti validator nodes in Docker containers, including cluster management, network configuration, and troubleshooting.
mysticeti/
βββ Dockerfile # Docker image for Mysticeti validator
βββ docker-compose.yml # 4-node cluster configuration
βββ Makefile # Management commands
βββ env.example # Environment variables template
βββ docker-network-debug.sh # Network debugging script
βββ data/ # Persistent data storage (created automatically)
β βββ node0/
β βββ node1/
β βββ node2/
β βββ node3/
βββ README.md # This file
Copy and configure the environment file:
cp env.example .env
# Edit .env file to customize network settings (optional)
nano .env
make build
make start
make status
make logs
make build # Build Docker image
make start # Start 4-node cluster
make stop # Stop cluster
make restart # Restart cluster
make clean # Stop and remove everything
make status # Show cluster status and endpoints
make logs # Show logs from all nodes
make logs-node0 # Show logs from node 0
make logs-node1 # Show logs from node 1
make logs-node2 # Show logs from node 2
make logs-node3 # Show logs from node 3
make single # Start single node (node0) for testing
make health # Check health of all nodes
make test-tx # Test transaction submission
The Mysticeti cluster uses a custom Docker bridge network with static IP addresses to ensure reliable peer connectivity:
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β mysticeti- β β mysticeti- β β mysticeti- β β mysticeti- β
β node0 β β node1 β β node2 β β node3 β
β 172.20.0.10 β β 172.20.0.11 β β 172.20.0.12 β β 172.20.0.13 β
β Port: 26657 β β Port: 26657 β β Port: 26657 β β Port: 26657 β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β β
βββββββββββββββββββββββββΌββββββββββββββββββββββββΌββββββββββββββββββββββββ
β β
Docker Bridge Network (172.20.0.0/16)
Node | Internal IP | Host Port | Endpoint |
---|---|---|---|
Node 0 | 172.20.0.10 | 26657 | http://localhost:26657 |
Node 1 | 172.20.0.11 | 26658 | http://localhost:26658 |
Node 2 | 172.20.0.12 | 26659 | http://localhost:26659 |
Node 3 | 172.20.0.13 | 26660 | http://localhost:26660 |
The configuration uses environment variables for flexibility and easy customization:
NETWORK_SUBNET
: Docker network subnet (default:172.20.0.0/16
)NETWORK_GATEWAY
: Network gateway (default:172.20.0.1
)
NODE0_IP
: IP address for node 0 (default:172.20.0.10
)NODE1_IP
: IP address for node 1 (default:172.20.0.11
)NODE2_IP
: IP address for node 2 (default:172.20.0.12
)NODE3_IP
: IP address for node 3 (default:172.20.0.13
)
PEER_ADDRESSES_NODE0
: Peer addresses for node 0PEER_ADDRESSES_NODE1
: Peer addresses for node 1PEER_ADDRESSES_NODE2
: Peer addresses for node 2PEER_ADDRESSES_NODE3
: Peer addresses for node 3
You can customize the network by setting environment variables:
# Custom network subnet
export NETWORK_SUBNET=192.168.1.0/24
# Custom node IPs
export NODE0_IP=192.168.1.10
export NODE1_IP=192.168.1.11
export NODE2_IP=192.168.1.12
export NODE3_IP=192.168.1.13
# Custom peer addresses
export PEER_ADDRESSES_NODE0=192.168.1.11:26657,192.168.1.12:26657,192.168.1.13:26657
# Start with custom configuration
docker-compose up -d
curl http://localhost:26657/health
curl -X POST http://localhost:26657/broadcast_tx_async \
-H "Content-Type: application/json" \
-d '{"transaction": "dGVzdCB0cmFuc2FjdGlvbg=="}'
curl http://localhost:26657/status
The cluster consists of 4 validator nodes:
- mysticeti-node0: Authority index 0, RPC port 26657
- mysticeti-node1: Authority index 1, RPC port 26658
- mysticeti-node2: Authority index 2, RPC port 26659
- mysticeti-node3: Authority index 3, RPC port 26660
Use the provided debug script to diagnose network issues:
./docker-network-debug.sh
This script will:
- Check container status
- Verify network configuration
- Test inter-container connectivity
- Check Mysticeti logs for connection errors
Symptoms: Containers fail to start or exit immediately
Solutions:
# Check container status
docker compose ps
# Check Docker logs
docker compose logs mysticeti-node0
# Ensure ports are available
netstat -tulpn | grep -E ":(26657|26658|26659|26660|26670|26671|26672|26673)"
Symptoms: Nodes can't communicate with each other
Solutions:
# Check if containers can reach each other
docker exec mysticeti-node0 ping -c 1 172.20.0.11
# Verify network configuration
docker network inspect mysticeti_mysticeti-network
# Check container IPs
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysticeti-node0
Symptoms: Network doesn't reach consensus, transactions not processed
Solutions:
# Check if all nodes are running
docker ps --filter "name=mysticeti-node"
# Check Mysticeti logs for connection errors
docker logs mysticeti-node0 | grep -E "(Error|WARN|disconnected)"
# Restart specific node
docker compose restart mysticeti-node0
# Check container status
docker compose ps
# View container logs
docker compose logs mysticeti-node0
# Access container shell
docker compose exec mysticeti-node0 /bin/bash
# Restart specific node
docker compose restart mysticeti-node0
# Clean start
make clean
make build
make start
# Check container status
docker ps --filter "name=mysticeti-node"
# Check network configuration
docker network inspect mysticeti_mysticeti-network
# Check container IPs
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysticeti-node0
# Test connectivity between containers
docker exec mysticeti-node0 ping -c 1 172.20.0.11
# Check logs for errors
docker logs mysticeti-node0 --tail 50
make health
make logs
docker stats
After starting the cluster:
- Initial Connection: Nodes may show connection warnings during startup (this is normal)
- Peer Discovery: Nodes should discover each other within 30-60 seconds
- Consensus: The network should reach consensus once all nodes are connected
- Transaction Processing: Transactions should be processed normally
- Each node runs as a non-root user (
mysticeti
) - Data is persisted in
./data/
directory - Network is isolated using Docker bridge network
- Ports are exposed only to localhost by default
- Cryptographic keys are generated per container
- Network isolation prevents unauthorized access
cargo build --release --bin single-validator
./target/release/single-validator --authority-index 0 --rpc-port 26657
You can modify the docker-compose.yml
file to:
- Change port mappings
- Add environment variables
- Modify volume mounts
- Adjust resource limits
Logs are available at different levels:
- Container logs:
docker compose logs
- Application logs: Inside containers at
/app/data/
- System logs:
docker system logs
To update the cluster:
- Stop the cluster:
make stop
- Rebuild the image:
make build
- Start the cluster:
make start
- Network Latency: Docker bridge networks add minimal latency
- Bandwidth: Network bandwidth is limited by host system
- Scalability: This configuration supports up to 254 nodes in the subnet
- Resource Usage: Monitor CPU and memory usage with
docker stats
The Docker configuration addresses previous connectivity issues by:
- Static IP Addresses: Each container gets a fixed IP in the
172.20.0.0/16
subnet - Environment Variables: All network configuration uses environment variables for flexibility
- Peer Address Configuration: Each node knows the addresses of all other peers
- Committee Configuration: Added
docker_committee_and_keys()
function for Docker network addresses
- docker-compose.yml: Added environment variables for all network settings
- orchestrator/examples/docker-compose.yml: Updated with same variable approach
- config/src/test_committee.rs: Added
docker_committee_and_keys()
function - execute/src/bin/validator.rs: Added
--peer-addresses
argument - orchestrator/src/bin/local_network.rs: Improved error handling
- env.example: Environment variables template
- docker-network-debug.sh: Network debugging script
- README.md: This comprehensive documentation
- Flexibility: Easy to customize network configuration without editing docker-compose files
- Maintainability: Single source of truth for network settings
- Deployment: Different configurations for different environments
- Testing: Easy to test with different network topologies
- Documentation: Clear separation between configuration and code
If you encounter issues:
- Use the debug script:
./docker-network-debug.sh
- Check the troubleshooting section above
- Review container logs:
docker compose logs
- Verify network connectivity between containers
- Ensure all environment variables are properly set
For additional support, refer to the Mysticeti documentation or submit an issue to the project repository.