Switch to multiple container setup

This commit is contained in:
deadmanoz
2025-06-27 11:45:04 +08:00
parent ec3a2f29f0
commit d83a833b4d
8 changed files with 305 additions and 99 deletions

View File

@@ -1,18 +1,18 @@
# BRK multi-container Docker Compose configuration
services:
brk:
brk-processor:
build:
context: .
dockerfile: Dockerfile
image: brk:latest
container_name: brk
container_name: brk-processor
restart: unless-stopped
ports:
- 7070:3110 # Map host port 7070 to container port 3110
volumes:
# Bitcoin Core data directory (read-only)
# For access to raw block data
- ${BITCOIN_DATA_DIR:-/path/to/bitcoin}:/bitcoin:ro
# BRK data directory for outputs and state
# BRK data directory for outputs and state (shared with server)
# Option 1: Use a named volume (default)
- ${BRK_DATA_VOLUME:-brk-data}:/home/brk/.brk
# Option 2: Use a bind mount (uncomment and set BRK_DATA_DIR in .env)
@@ -22,8 +22,7 @@ services:
- BITCOINDIR=/bitcoin
- BLOCKSDIR=/bitcoin/blocks
# RPC configuration
# RPC node access is for chain validation, chain sync status etc.
# RPC configuration (required for processor)
- RPCCONNECT=${BTC_RPC_HOST:-localhost}
- RPCPORT=${BTC_RPC_PORT:-8332}
# - RPCCOOKIEFILE=/bitcoin/.cookie
@@ -37,7 +36,6 @@ services:
- COMPUTATION=${BRK_COMPUTATION:-lazy}
- FORMAT=${BRK_FORMAT:-raw}
- FETCH=${BRK_FETCH:-true}
- MCP=${BRK_MCP:-true}
command:
- --bitcoindir
- /bitcoin
@@ -50,7 +48,45 @@ services:
- --rpcpassword
- "${BTC_RPC_PASSWORD:-bitcoin}"
- --services
- "${BRK_SERVICES:-all}" # Can be: all, processor, server
- processor
healthcheck:
test: ["CMD", "pgrep", "-f", "brk"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
brk-server:
build:
context: .
dockerfile: Dockerfile
image: brk:latest
container_name: brk-server
restart: unless-stopped
ports:
- 7070:3110 # Map host port 7070 to container port 3110
volumes:
# BRK data directory (shared with processor)
# Option 1: Use a named volume (default)
- ${BRK_DATA_VOLUME:-brk-data}:/home/brk/.brk
# Option 2: Use a bind mount (uncomment and set BRK_DATA_DIR in .env)
# - ${BRK_DATA_DIR:-./brk-data}:/home/brk/.brk
environment:
# BRK configuration (server doesn't need Bitcoin RPC)
- BRKDIR=/home/brk/.brk
- MCP=${BRK_MCP:-true}
command:
- --brkdir
- /home/brk/.brk
- --services
- server
# Note: Server can start without processor, will serve empty data until processor indexes blocks
healthcheck:
test: ["CMD", "sh", "-c", "nc -z localhost 3110 || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
volumes:
brk-data: