A Docker configuration repository for peer-observer, providing easy deployment and orchestration of Bitcoin network monitoring tools.
This project contains Docker configurations and orchestration files for running the peer-observer suite, which is a collection of tools for monitoring the Bitcoin network. The peer-observer project helps analyze Bitcoin node connectivity, peer relationships, and network health metrics.
Purpose: This repository specifically focuses on providing Docker containerization and orchestration configurations for the peer-observer tools, making it easier to deploy and run the monitoring infrastructure without complex manual setup.
The base system consists of:
- Bitcoin Node: A full Bitcoin Core node instrumented for monitoring.
- ebpf-extractor: An extractor tool that consumes ebpf kernel events and routes messages to the NATS server.
- NATS: Message broker for inter-service communication.
The default network is regtest for test and development, it is provided by docker-compose.yml and doesn't require command line arguments.
Other networks are provided by node.mainnet.yml, node.signet.yml, and node.regtest.yml. You refer to one of them using the -f option, e.g., docker compose -f node.mainnet.yml up.
There are currently four tools that consume events from the NATS server:
- Logger: Logs peer connection events and activities
- Metrics: Exposes monitoring metrics via HTTP endpoint
- WebSocket: Provides real-time data via WebSocket connections
- Connectivity Check: Monitors network connectivity and health
Refer to https://github.com/0xB10C/peer-observer for tooling documentation.
Each tool is configured as a service with the monitoring profile and a profile with the tool name. A profile is an opt-in mechanism in docker compose, that is, you only get a service running if you explicitly ask for it. That allows on to start and stop tools in the monitoring pipeline without having to restart the base system (see examples below).
- Docker Engine: version 20.10.0 or later
- Docker Compose CLI Plugin: version 2.20.0 or later (Required for support of profiles: and include: directives in Compose files)
- Depending on the chosen Bitcoin network:
- Disk space: varies (e.g., several hundred GB for mainnet)
- Internet connection: required for peer connectivity and block synchronization
-
Clone the repository:
git clone <repository-url> cd peer-observer-docker
-
Build everything:
docker compose --profile monitoring build --no-cache-
Start the base system in regtest:
docker compose up -d
-
Check service status:
docker compose ps
You should see two containers running since the bitcoin node and the ebpf-extractor tool should run in the same container.
- Start the logger tool:
docker compose --profile logger up -dYou should now have three containers.
- View logs:
docker compose --profile logger logs -f
| Service | Port | Description |
|---|---|---|
| Bitcoin Node | 8332, 8333 | Bitcoin RPC and P2P ports |
| NATS | 4222 | Message broker |
| Metrics | 8282 | Metrics HTTP endpoint |
| WebSocket | 47482 | Real-time data WebSocket |
| Connectivity Check | 18282 | Connectivity metrics |
In mainnet the Bitcoin node will need to sync with the network on first startup. This process can take several hours to days depending on your internet connection and hardware. Monitor the progress with:
docker compose logs -f bitcoin-nodeOnce all services are running:
- Metrics:
http://localhost:8282 - Connectivity Metrics:
http://localhost:18282 - WebSocket Connection:
ws://localhost:47482
# Stop all services
docker compose --profile monitoring down
# Stop and remove volumes (WARNING: This will delete blockchain data)
docker compose --profile monitoring down -vBitcoin blockchain data is stored in the bitcoin-data Docker volume. This ensures data persistence across container restarts.
# Build Bitcoin node
docker compose build bitcoin-node
# Build a specific peer observer tool (logger)
docker compose --profile monitoring build logger
# Build NATS
docker compose build natsTo access a running container for debugging:
# Access Bitcoin node container
docker compose exec bitcoin-node bash
# Access peer observer tools container
docker compose --profile logger exec logger bashSome services include health checks:
- Bitcoin Node: Checks if the node is responsive
- NATS: Verifies the message broker is healthy
- Other services depend on NATS being healthy before starting
- Out of disk space: Ensure you have sufficient disk space for Bitcoin blockchain data
- Memory issues: Increase Docker's memory limit if containers are being killed
- Port conflicts: Ensure the required ports are not in use by other applications
Check service logs for detailed error information:
docker compose logs [service-name]- Fork the repository
- Create a feature branch
- Make your changes
- Test with
docker compose up - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- peer-observer - The main peer observer tools
- Bitcoin Core - Bitcoin reference implementation
For issues related to:
- Docker configurations: Open an issue in this repository
- Peer observer tools: Check the main peer-observer repository